The Moth
Developer, Former MVP, now at Microsoft - Best of
2004
,
2005
,
2006
,
2007
,
2008
,
2009
« Silverlight Browser Integration aka HTML...
|
Home
|
Use of Silverlight at Tech Ed US site »
Decompiling Silverlight 2 Apps – Enter the XAP
Sun, March 9, 2008, 10:40 AM under
Silverlight
When you build a Silverlight 2 application, you compile your source files (inc. XAML and embedded resources) into assemblies (dlls). Those assemblies (plus any 3rd party ones plus MS assemblies that are not part of Silverlight) are then collected together along with a manifest into a packaged archive – or in other words, a ZIP file. Except, the extension is changed to be a .XAP (pronounced "ZAP"). The benefits of packaging everything into a XAP should be obvious but in case they are not,
Pete has discussed that on his blog (inc. screenshots)
. Note that if your web server is on IIS (prior to version 7) you need to
register that MIME type
.
As an aside, my web server happens to be Apache (shocking I know!) and I had to configure nothing – it just worked.
So, if I had given you a Winforms EXE file you wouldn't ask me for the source code, you would probably just pass it through your favourite decompiler and you've got it all. Same with Silverlight apps: if I point you to my web page that is running a Silverlight app (e.g.
the one from this post
) all you have to do is:
1. View HTML source
, e.g. for this: http://www.danielmoth.com/SL/HtmlBridge/index.html
2. Locate the tag that points to a XAP file
and copy the full path, e.g. ClientBin/DemoIntegration.xap
3. Use that path to "Save As"
the xap file locally.
4. Rename the XAP file to ZIP
and explode it to get the DLLs inside.
5. Party away by tossing the DLL(s) to the decompiler
, e.g. Reflector.
Obviously authors of serious SL apps may not condone that behaviour, but feel free to do it with all of mine, for example the
DeepZoom/MultiScaleImage that I have now updated to also use mouse wheel
.
Comments [6]
|
Permalink
Sunday, March 09, 2008 7:02:00 PM (Pacific Standard Time, UTC-08:00)
Nice tip. The ability to view source on HTML pages is one of the things that has made the web great. I'm glad we can still do the same thing when we see a great Silverlight app and wonder "how did they do that".
Dave Gardner
Monday, March 10, 2008 5:11:00 AM (Pacific Standard Time, UTC-08:00)
There's a Reflector plug-in for Silverlight 1.1 that did all this for you.
Can't imagine it'll be long before that's updated to 2.
Mike.
Mike
Wednesday, March 12, 2008 2:44:00 AM (Pacific Standard Time, UTC-08:00)
Is it possible to protect your .XAP file against this 'feature'?
Sander
Sander
Thursday, March 20, 2008 11:13:21 AM (Pacific Standard Time, UTC-08:00)
Dave: Agreed :)
Mike: Nice one!
Sander: Not that I know of. Once someone gets your managed assemblies it is the same .NET story that has been there from the start (obfuscation etc)...
Daniel Moth
Tuesday, April 15, 2008 5:23:11 AM (Pacific Daylight Time, UTC-07:00)
Note to Self: I mentioned above "resources" but it turns out referencing these things is not as straightforward so I had to read the manual (RTFM). For future reference here are two good links:
1.
MSDN Reference on Resources
2.
Blog post on Resources
Daniel Moth
Monday, May 25, 2009 11:31:01 PM (Pacific Daylight Time, UTC-07:00)
The ability to view source on HTML pages is one of the things that has made the web unstable. Millions of people using the easy way, copying and pasting blocs of codes "as is" instead of trying to understand how it works...
Anonymous
Comments are closed.
About
My team's page on MSDN
Subscribe
Contact Form
My screencasts on channel9
Tags
AboutPresenting (5)
Blogging (7)
Career (5)
Communication (5)
dotNET (120)
Events (93)
GPGPU (2)
HPC (6)
IE7 RSS (6)
Links (129)
LINQ (23)
MobileAndEmbedded (148)
Orcas (128)
ParallelComputing (63)
Personal (32)
Random (42)
SideShow (12)
Silverlight (17)
SoftwareProcess (3)
UAC (14)
UserInterfaceDesign (5)
Vista (84)
VisualStudio (112)
Whidbey (31)
Windows (90)
WindowsServer2008 (3)
Latest Posts
Parallel Computing Platform Developer Lab
Slides and code for MPI Cluster Debugger
DirectCompute
GPGPU
Code for Parallelism Features Tour
Managed code and the Shell – Do?
Dev Lead Job opening on my team
Best of "The Moth" 2009
Bug Triage
Parallel Computing Features Tour in VS2010
MPI Cluster Debugger launch integration in VS2010
Parallel Debugging
"Parallel Programming Talk" show
Message Passing Interface (MPI)
Windows HPC Server links
Extension Manager in Visual Studio 2010
Core debugger enhancements in VS2010
Dump debugging with Parallel Stacks
Slides for Parallel Debugging windows
MPI Project Template for VS2010
Archives
March, 2010 (2)
February, 2010 (3)
January, 2010 (3)
December, 2009 (1)
November, 2009 (11)
October, 2009 (12)
September, 2009 (1)
August, 2009 (6)
July, 2009 (5)
June, 2009 (3)
May, 2009 (7)
April, 2009 (5)
March, 2009 (3)
February, 2009 (4)
January, 2009 (6)
December, 2008 (3)
November, 2008 (12)
October, 2008 (6)
September, 2008 (9)
August, 2008 (5)
July, 2008 (5)
June, 2008 (8)
May, 2008 (18)
April, 2008 (11)
March, 2008 (13)
February, 2008 (17)
January, 2008 (15)
December, 2007 (20)
November, 2007 (25)
October, 2007 (19)
September, 2007 (11)
August, 2007 (31)
July, 2007 (24)
June, 2007 (19)
May, 2007 (24)
April, 2007 (18)
March, 2007 (35)
February, 2007 (34)
January, 2007 (17)
December, 2006 (18)
November, 2006 (17)
October, 2006 (23)
September, 2006 (22)
August, 2006 (15)
July, 2006 (15)
June, 2006 (13)
May, 2006 (10)
April, 2006 (5)
March, 2006 (1)
February, 2006 (1)
January, 2006 (2)
December, 2005 (5)
November, 2005 (4)
October, 2005 (3)
September, 2005 (8)
August, 2005 (17)
July, 2005 (11)
June, 2005 (7)
May, 2005 (24)
April, 2005 (15)
March, 2005 (15)
February, 2005 (18)
January, 2005 (23)
December, 2004 (24)
November, 2004 (25)
October, 2004 (10)
September, 2004 (23)
August, 2004 (12)
July, 2004 (1)