Click here to Skip to main content
15,881,248 members
Articles / Desktop Programming / XAML

What is AppManifest.xaml in Silverlight?

Rate me:
Please Sign up or sign in to vote.
4.90/5 (11 votes)
7 May 2011CPOL3 min read 28.6K   5   3
AppManifest.xaml in Silverlight

Introduction

Many of you are not aware of it in depth, mainly the freshers who just started getting their hands dirty with the light of Silver. In this post, I am going to describe the AppManifest.xaml file and its uses in depth. Read the complete post to know more about it.

Don't forget to leave your feedback and/or any queries at the end of this post. I appreciate your reading this post.

The AppManifest.xaml file contains the deployment details needed to run the Silverlight application. The first element of it starts with a Deployment node which defines the Assembly information, Runtime version, Application Entry point and the assembly, extension parts.

You can find the complete AppManifest.xaml file inside the .XAP file. It is also available in the Silverlight project's Properties folder (named as AppManifest.xml), but you will find it almost empty there. Once you build your project, it gets generated by the IDE and placed inside your XAP file.

To find out, build your solution and go to your Client Bin folder. Open your .XAP with a Zip utility. If you are unable to open that file, rename it to .Zip extension. You will be able to open now.

image

Once you open the AppManifest.xaml file, you will see the following code there:

XML
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" 
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
            EntryPointAssembly="AppManifestDemo1" 
            EntryPointType="AppManifestDemo1.App"
            RuntimeVersion="4.0.50826.0">
  <Deployment.Parts>
    <AssemblyPart x:Name="AppManifestDemo1" Source="AppManifestDemo1.dll" />
  </Deployment.Parts>
</Deployment>

The root element is the Deployment node. It defines the Entry Point Assembly, Entry Point Type (basically the main application class name with full namespace) and the Silverlight Runtime Version.

This node contains the Deployment.Parts and/or Deployment.ExternalParts as the child. The Deployment.Parts defines the Assembly Parts that are referenced in the project and present in the .XAP file. It also defines the main output DLL as the Assembly part. As shown in the above figure, we have only one assembly in our XAP (the main project output) and hence only one entry in the AppManifest.xaml file.

Let's add some more external dependencies to our project. Build it and open the XAP once again. Now you will see that in our latest xap, we have the external assemblies too (as highlighted below):

Image 2

If you open the AppManifest.xaml file now, you will notice that it contains those DLLs as Assembly Parts in the Deployment.Parts section.

XML
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" 
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
            EntryPointAssembly="AppManifestDemo1" 
            EntryPointType="AppManifestDemo1.App" 
            RuntimeVersion="4.0.50826.0">
  <Deployment.Parts>
    <AssemblyPart x:Name="AppManifestDemo1" Source="AppManifestDemo1.dll" />
    <AssemblyPart x:Name="SilverlightClassLibrary1" 
	Source="SilverlightClassLibrary1.dll" />
    <AssemblyPart x:Name="System.Json" Source="System.Json.dll" />
  </Deployment.Parts>
</Deployment>

Now let's discuss the Deployment.ExternalParts section. You will find this section if you have enabled the Application Library Caching. Enable the Application Library Caching in your project as shown in this post. Now build your solution once again. You will not see those external assemblies in your XAP now. They will be part of separate .Zip files placed inside your Client Bin directory.

Open your AppManifest.xaml file and you will see these changes:

XML
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" 
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
            EntryPointAssembly="AppManifestDemo1" 
            EntryPointType="AppManifestDemo1.App" 
            RuntimeVersion="4.0.50826.0">
  <Deployment.Parts>
    <AssemblyPart x:Name="AppManifestDemo1" Source="AppManifestDemo1.dll" />
    <AssemblyPart x:Name="SilverlightClassLibrary1" 
	Source="SilverlightClassLibrary1.dll" />
  </Deployment.Parts>
  <Deployment.ExternalParts>
    <ExtensionPart Source="System.Json.zip" />
  </Deployment.ExternalParts>
</Deployment>

You will notice that it removed the external dependencies from the deployment part section, and added them inside the deployment external part section. Also notice that it's not referencing the DLL, instead it is pointing to the zip file that has been created by the IDE in the Client Bin directory.

I hope this helped you to understand the AppManifest file of your Silverlight application. Let me know if you have any queries. Also, don't forget to share your thoughts and/or feedback at the end of the post.

This article was originally posted at http://www.kunal-chowdhury.com/feeds/posts/default

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
India India

Kunal Chowdhury is a former Microsoft "Windows Platform Development" MVP (Most Valuable Professional, 2010 - 2018), a Codeproject Mentor, Speaker in various Microsoft events, Author, passionate Blogger and a Senior Technical Lead by profession.

He is currently working in an MNC located in India. He has a very good skill over XAML, C#, Silverlight, Windows Phone, WPF and Windows app development. He posts his findings, articles, tutorials in his technical blog (www.kunal-chowdhury.com) and CodeProject.


Books authored:


Connect with Kunal on:





Comments and Discussions

 
GeneralMy vote of 5 Pin
Brij7-May-11 21:58
mentorBrij7-May-11 21:58 
GeneralMy vote of 5 Pin
Abhishek Sur7-May-11 20:55
professionalAbhishek Sur7-May-11 20:55 
GeneralRe: My vote of 5 Pin
Kunal Chowdhury «IN»7-May-11 21:48
professionalKunal Chowdhury «IN»7-May-11 21:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.