How to deploy your ASP.NET applications to live servers

asp.netdeployment

I am looking for different techniques/tools you use to deploy an ASP.NET web application project (NOT ASP.NET web site) to production?

I am particularly interested of the workflow happening between the time your Continuous Integration Build server drops the binaries at some location and the time the first user request hits these binaries.

  1. Are you using some specific tools or just XCOPY? How is the application packaged (ZIP, MSI, …)?

  2. When an application is deployed for the first time how do you setup the App Pool and Virtual Directory (do you create them manually or with some tool)?

  3. When a static resource changes (CSS, JS or image file) do you redeploy the whole application or only the modified resource? How about when an assembly/ASPX page changes?

  4. Do you keep track of all deployed versions for a given application and in case something goes wrong do you have procedures of restoring the application to a previous known working state?

Feel free to complete the previous list.


And here's what we use to deploy our ASP.NET applications:

  1. We add a Web Deployment Project to the solution and set it up to build the ASP.NET web application
  2. We add a Setup Project (NOT Web Setup Project) to the solution and set it to take the output of the Web Deployment Project
  3. We add a custom install action and in the OnInstall event we run a custom build .NET assembly that creates an App Pool and a Virtual Directory in IIS using System.DirectoryServices.DirectoryEntry (This task is performed only the first time an application is deployed). We support multiple Web Sites in IIS, Authentication for Virtual Directories and setting identities for App Pools.
  4. We add a custom task in TFS to build the Setup Project (TFS does not support Setup Projects so we had to use devenv.exe to build the MSI)
  5. The MSI is installed on the live server (if there's a previous version of the MSI it is first uninstalled)

Best Answer

We have all of our code deployed in MSIs using Setup Factory. If something has to change we redeploy the entire solution. This sounds like overkill for a css file, but it absolutely keeps all environments in sync, and we know exactly what is in production (we deploy to all test and uat environments the same way).