Sunday, November 20, 2011

What is XAP File?

A XAP file (pronounced "zap") is basically a compressed output file for the Silverlight application containing Silverlight solution components such as the compiled XAML and code-behind, an application manifest and possibly one or more assemblies delivering Silverlight controls.
When a Silverlight project is built in Visual Studio all of the files, XAML and .NET code, are compiled into a single DLL.  This DLL file is then compressed into a zip file that gets named with a .XAP extension rather than the traditional .ZIP.  In addition to XAML and code files, graphics and media files are compiled by default into the DLL assembly as well.
".XAP" files use the standard .zip compression algorithm to minimize client download size. A "hello world" .NET Silverlight application (built using VB or C#) is about 5KB in size. The size of the file depends on the XAML files, assemblies used in Silverlight project.

To view the contents of a .XAP file you can rename the extension of the .XAP file to .ZIP. Then view the .ZIP file using any standard .ZIP utility.


A basic XAP file will have an assembly related to specific code for the application, an application manifest file and any additional assemblies need to run the application. At a minimum, two files are needed, the application manifest file and the application assembly.
For example:
  • AppManifest.xaml
  • Demo1.dll
Here Microsoft.Maps.MapControl.Common.dll and Microsoft.Maps.MapControl.dll are two external dlls used in the Silverlight application to show the Bing Map.External resources like images or other types of files can also be added to the .XAP file if you do embed them into your client DLL .

No comments:

Post a Comment