Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Dinesh's Blog
Browse by Tags · View All
brh 20
#SILVERLIGHT 19
#DOTNET 18
silverlight 18
#ASP.NET 15
Silverlight 4.0 9
bing 7
bing maps 6
wcf services 5
map 5

Archive · View All
August 2010 10
September 2010 3
July 2010 3
June 2010 3
October 2010 1

SILVERLIGHT Tutorial - What is XAP File?

Aug 18 2010 7:09AM by Dinesh Sodani   

In the previous article I attempted to explain What Silverlight is and how it is being used more and more to develop business applications. When web page with a Silverlight application runs on the browser it requests for XAP file. In this article I will try to explain what XAP file is and what it contains. Web pages like .aspx files and .html files use the Silverlight components by loading the .XAP files using the <object> tag in the HTML or by using <asp:Silverlight> tag in the ASP.NET pages.

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.

How it is generated

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.

How big it is

".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.

How to view the content of .XAP file

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.

What is XAP File

What it contains

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 .

What is contained in AppManifest.xaml file?

The AppManifest.xml file defines the assemblies that get deployed in the client application. This file is automatically updated when compiling your application. Basic example:

<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
EntryPointAssembly="MySimpleSilverlight" 
EntryPointType="MySimpleSilverlight.App" RuntimeVersion="3.0.40624.0">
  <Deployment.Parts>
    <AssemblyPart x:Name="MySimpleSilverlight" Source=" MySimpleSilverlight.dll" />
    <AssemblyPart x:Name="Microsoft.Maps.MapControl.Common" Source="Microsoft.Maps.MapControl.Common.dll" />
    <AssemblyPart x:Name="Microsoft.Maps.MapControl" Source="Microsoft.Maps.MapControl.dll" />
  </Deployment.Parts>
</Deployment>

Based on the settings of a referenced assembly it is added to the Application manifest. For example, if you have an assembly that you are referencing in your application but do not wish to have it included into the. XAP file you can choose to set “Copy Local” to false. See the image below:

Visual Studio Silverlight Copy Assembly

In this example I’m referencing the Microsoft.Maps.MapControl.Common assembly and chose not to have a local copied deployed with the .XAP. I’ll then need to add “on demand download of the assembly” when accessing it in my code.

This can be useful to have only your base assembly deployed and have an on demand download of subsequent assemblies on the fly so that your initial download time is minimal. When only a part of your application uses a specific assembly you may want to use this mechanism.

What is Application Library Caching

Most of the time including this extra assembly in your XAP file would be fine.  There is an alternative though.  You can separated the Microsoft.Maps.MapControl assembly out and have the client’s browser cache it locally.  This is called “Application Library Caching”.  If the client already has a cached copy of the assembly it does not need to be downloaded again.  This would obviously decrease the amount of content that needs to be downloaded for the application to run.

To configure the Silverlight project to use library caching you right-click on the project in Solution Explorer and choose the “Properties” option.  This will open the properties tab for the project and then you check the box labeled “Reduce XAP size by using application library caching”, as shown in the following screen capture:

Application Library Caching

Where XAP FILE placed in web server

ClientBin folder is used to place the .XAP file of Silverlight application. You can keep this anywhere in your web application but this is the default that is used by the Silverlight.

What is mime type of XAP FILE

The .XAP mime type is: application/x-silverlight

Tags: silverlight, brh, #DOTNET, #SILVERLIGHT, #ASP.NET, Silverlight 4.0, AppManiFest.xaml, Mime Type for XAP, XAP, View XAP file,


Dinesh Sodani
30 · 6% · 1807
0
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]