This post is a continuation of my previous Beginning Silverlight 3 (Visual Studio) and Beginning Silverlight 3 (Blend) posts and will deal with how to deploy a Silverlight 3 web application.
I am only going to go over deploying a Silverlight 3 application in its simplest form. The simplest form being an application hosted in a HTML web page.
1. Building the application.
Before you deploy your Silverlight application, you should build it to make sure that you are deploying a version of your application that has all the revisions you may have added since the last build.
To build the application in Visual Studio select Build from the main menu then click Build <Project Name>. Since I am using the project that was created in the Visual Stuido Beginning Silverlight 3 post I click on Build BeginningSilverlight from the menu. (Before you build your application for deployment don’t forget to set the solution configuration to Release.)

If you use Expression Blend to create your application, you would select Project from the main menu then click on Build Project.

2. A post build look.
After you have built you application for the first time, you will notice in the Solution Explorer window, that there has been a file created in the ClientBin directory of the web site.
This file, with the .xap (pronounced zap) extension contains all the data for your Silverlight application.

3. What is a .xap file?
I am going to take a small detour here from the subject of this post to talk about the .xap (pronounced zap) file.
While you don’t necessarily need to know what a .xap file is to deploy your application a little background on the main file required for your application does not hurt.
In reality the xap file is just a compressed file that holds all the files required for your Silverlight application to run. The benefit of the xap file being compressed is that, since the contents are not decompressed until the application is run on the client machine, the download time for users of the is faster.
If you were to change the extension from .xap to .zip you would be able to open the compressed file to see the contents.

For the Hello World application that we created you can see that there are only two files required for the application. The first file is the AppManifest which is a XAML file that defines the assemblies that get deployed in the client application. The second file is the compiled version of the application and will always have the same name as your application does. If your application had any other dependencies then the extra dlls of those assemblies would be included in the xap file. For instance, if your application had a reference to System.Windows.Controls then the system.windows.controls.dll would be included in the xap file.
4. Deploying your application.
Like any web pages or sites you need to make sure that any resources that are linked to, but are not contained in the .xap file, are also uploaded or are at least available to your application.
With the project that has been used in this example there are just two files that need to be uploaded to the server. The two files would be the host HTML page for the application and the xap file. The files must put onto the web server in the same relation that they are in your project so since the xap file resides in the ClientBin directory on your project it must be in a ClientBin sub-directory to the directory that the HTML file is in.

You don’t have to keep the default name of the HTML file either. If it is going to be the only page in the directory or site then you may want to change it to index.html as an example. The choice is yours.
5. Setting the MIME type.
Depending on your web server you may need to set the MIME type for your application to run. (Detailing how to set the MIME type is outside the bounds of this post as setting the type depends on your web server and if you host the site on your own server or user a hosting service.)
The MIME type that you need to have included on your web server is:
MIME type - application/x-silverlight-app
Extension - .xap
6. The application goes live.
Once you have uploaded all the files and set the MIME type then you should be able to navigate to the URL of the HTML page which hosts your Silverlight application and run it.
The deployed example featured in this post can be seen, and run, here and as you can see from the screen shot below works just like it should.
