Monthly Archives: June 2010

Web Deployment Configurations in Visual Studio 2010

Some quick notes on the basics. I’ll try to follow this up with another post soon on some of the particulars.

Creating a new configuration:

  1. Build -> Configuration Manager
  2. In the drop down of current configurations, go all the way to the bottom and select “Add new…”
  3. You can choose to copy settings from an existing configuration (such as debug or release)
  4. If you are on the solution configuration drop down, there is a box to create a matching configuration for ALL of your projects
  5. If you are on a project configuration drop down, there is a box to create a matching configuration for the solution

Creating a new web.config transform file for the new configuration

Once you have created a new configuration you can set up specific web config rules for it.

  1. Right click the web config file in the project
  2. Select “Add Config Transforms”
  3. This will add a new config transform named web.[my-configuration-name-here].config that is grouped underneath web.config in the solution explorer.
  4. You can now use this to add some “transforms” to the web config for that specific build configuration, such as turning off debug params or changing the db connection string

Setting package/publish options

  1. Right click the web application project
  2. Select “Package/Publish Settings”
  3. Alternatively, you can get to it by selecting project properties and then the “Package/Publish Web” tab
  4. Change settings as appropriate
  5. Note: there is also a tab for package/publish SQL options if you want it to handle DB stuff as well

Building a deployment package

  1. Right click the project
  2. Select Build Deployment package
  3. The default location for this to build to is /[my-project-name]/obj/[my-configuration-name/Package