Saturday, March 15, 2008

What is the purpose of .xap file in Silverlight 2.0?

Normally when you start with Silverlight 2.0, you may notice the .xap file which is present in the ClientBin folder.(Eg if you create a project called TextSL,it will create a .xap file named testSL.xap).Since this is new to us ,we will wonder ,what that file contains..

Also this prevent us from getting the reflected code.(Currently the reflector accepts only dlls & exes I think).

Actually what is .xap files?or what is the format of .xap files?
Answer is simple
.xap files are zip files.ie just a zipped and renamed as .xap .Served as application/octet-stream or application/x-silverlight.

Why they (MSFT) introduced this new format..Here are my assumptions.

  1. Now the silverlight application starts only after downloading all the assets(Images videos etc in the project) and dlls.So downloading would be faster ,if these required files are in a zip file since zip employe a good compression.
  2. Just to get rid of reflection.(May this come from my reflecting mind.MSFT may have some other thoughts.They might not think of this reflection:-) )
  3. .......(MSFT can only fill,if there are any other reasons)

How to reflect

  1. Just rename .xap file as .zip file
  2. Decompress the .zip file
  3. Now you got the dlls and images.Enjoy reflecting.

2 comments:

Sameer C. Thiruthikad said...

That's cool to know. Thanks.
By the way, your new blog template looks great!

Joymon said...

Thanks...