What is a .xap file? Explain with an example.
A .xap file is an application package based on Silverlight which will be generated when the Silverlight project is built. This file helpful in creating heavily client based Silverlight applications. A managed code can be used such as C# or VB and benefited by utilizing the tools.
A .xap file has an application manifest file (AppManifest.xaml) and the necessary DLL’s needed by the application. A manifest file looks like:
<Deployment xmlns="http:// "….”xmlns:x="http://......"EntryPointAssembly="SilverlightApplication1" EntryPointType="SilverlightApplication1.App" RuntimeVersion="2.0.30226.2">
<Deployment.Parts>
<AssemblyPart x:Name="SilverlightApplication1" Source="SilverlightApplication1.dll" />
</Deployment.Parts>
</Deployment>
The <Deployment> node describes the application and it contains child AssemblyPart nodes. The DLLs are contained in .xap file. The EntryPointAssembly attribute describes the selected assembly defined below is the main assembly for the application. And EntryPointType attribute describes the class that contains within the assembly that is defined in the EntryPointAssembly attribute. This is the class which is instantiated to commence the application.