Suppose we want to create MSI installer package of Silverlight web application for server deployment using Microsoft Installer.
For this, we need to utilize Microsoft Visual Studio "Web Deployment" project template and "Web Setup" project template.
Web Deployment project template comes only when we install its plugin. We can download its plugin from here.
Now in our web project we will right click and Add Web Deployment Project
This will prompt me for what I want to name the project and where to store its project file:
The web deployment project will then show up as part of my solution. We can change some optional settings by double clicking it
We have choose the default option for output assemblies i.e to merge the entire web-site into a single assembly that we can name whatever we want. This merges the output of all page/control compilation, app_code, and web-services into a single assembly (leaving one file to deploy).
Now, its time to add another project which is "Web Setup" project. This project actually creates MSI package. To add Web Setup project, right click on the solution in Solution Explorer and click "Add" then "New Project". Then, select "Web Setup Project" from Visual Studio project templates list. "Web Setup Project" will be available under "Setup and Deployment", which in Visual studio 2010 is under "Other Project Types".
We can see our project is added
Now, lets define the "Project Output" for the Web Setup project we just added. Right click on Web Setup project and click Add>Project Output
Now we will see "Project Output" dialog box. Project Output defines what output we want to include in our MSI package. In our case, we want output of pre-compiled website generated by Web Deployment project. So, select Web deployment project from "Project:" dropdown as your output project name and and select "Precompiled Web Outputs" from the listbox and click "OK".
This will add "Precompiled Web Outputs" to the Web Setup project.
Now, lets configure "Project Dependencies". "Project Dependencies" will set dependency or order in which each of the projects will get compiled. This will set the priority on how you want to perform your build.
Since our main Silverlight project is not dependent on anything, it should build first. Then our website should be build as it is dependent on Silverlight project. Then it should build WebDeployment project as it depends on WebSite build. Finally WebSetup project should build, which depends on both WebSite build and WebDeployment build.
Noe we need to configure "Configuration Manager". "Configuration Manager" settings will tell Visual Studio which projects to include during "Release" build and "Debug" build.
To get "Configuration Manager" dialog, right click on the solution in "Solution Explorer" and click "Configuration Manager".
In "Configuration Manager" dialog, include all projects for "Release" build and just include WebSite for "Debug" build. We normally create MSI package for server deployment only from "Release" build.
And Finally, we can build the entire solution by clicking "Build Solution
If everything goes fine and the build is successful, we will be able to see the MSI package under "Release" folder in Web Setup setup project file path
Now we can install this MyUserControl.msi
Now our web project has been deployed. We can check it by opening IIS
also we can browse our application
(Note Directory Browsing should be enabled )
and after clicking MYucTestPage we will get our result
I have attached the sample application..
MyucMsi.rar (459.43 kb)
ASP.NET, IIS, msi, Silverlight
26. December 2011