Buidling a Silverlight Project and getting the XAP file in your website project


When creating a new Silverlight application in Visual Studio, you will automatically be prompted to also create a website or web application. This is of course very useful, because the website can host your compiled Silverlight project, the XAP file.
By default, the XAP file is placed inside the ClientBin folder.

But where and when does this magic happen? How are the Silverlight project and the website coupled? And what if you want to configure it yourself?
You will probably start looking inside the properties of the Silverlight project. Are there some post build events that cause the project to zip itself inside a XAP file and place it in some directory?
Nope, nothing to see in the Silverlight project.

The configuration of this is in the website / web application project. When you open the Properties of your website project, you'll see a Silverlight section. A list view is presented with all the configured Silverlight applications for this website.
You can add, change and delete Silverlight application projects that exist in the same Visual Studio Solution.

This can be very useful when you want to have the output of an existing Silverlight project inside another website project.
You can also add the output of 1 Silverlight project multiple times to the same website. The compiled XAP file can be deployed to different directories.

So whenever you want to configure the deployment of a Silverlight project to your website project, just go to the properties of your website inside Visual Studio.


No comments yet.

New Comment

E-mail (not published)
Enter the code shown: