You are here: Home / Blog / posts / Programming Magic / Convert VS 2008 deploy project to VS 2010

Convert VS 2008 deploy project to VS 2010

by admin published Jan 28, 2014 02:25 PM, last modified Jan 28, 2014 02:25 PM
Convert a Visual Studio 2008 deployment project to Visual Studio 2010 deployment project using new and enhanced features. Also a step by step explanation on how to actually deploy your project using the file system method.

Existing functionality that will be removed or changed:

We will be removing the project.Deploy "HelpRequest.Deploy":

Project To Remove

If we examine this project the two important sections for us are the Compilation and the Deployment. Compilation has the directory where the files to be deployed are written and Deployment has Web.config file section replacement:

Compilation Tab 

From the image above we see that the connection strings and appSettings get replaced. In our project we have Prod and Test versions of each of these:


These contain settings that will replace the sections in the Web.config

  <add name="MainDB" connectionString="Data Source=..." providerName="System.Data.SqlClient"/>
  <add name="CATBERT" connectionString="Data Source=..." providerName="System.Data.SqlClient"/>
  <add name="RATBERT" connectionString="Data Source=..." providerName="System.Data.SqlClient"/>

and this:

  <add key="RecaptchaPrivateKey" value="..."/>
  <add key="RecaptchaPublicKey" value="..."/>
  <add key="HelpDeskEmail" value=""/>
  <add key="AppHelpDeskEmail" value=""/>
  <add key="WebHelpDeskEmail" value=""/>
  <add key="LDAPUser" value="..." />
  <add key="LDAPPassword" value="..." />

We will not remove these extra config files yet because we will copy the information for the web config transformation files later on.

next steps:

1) Delete the Deploy project.

2) Right click on Web.config and choose  "Add Config Transforms"

Config Transforms Menu Choice


This will create transform files for each configuration under the Web.config

Transforms created


3) We don't need a transform for debug, so we will just delete that one.

4) For each deployment you will do, open of the related config file. My examples will all use the Test configurations.

5) For now, keep the comments to use as examples. Open the old ConnectionStringTest.config file and copy and paste them into the Web.Test.config file.

6) Keep the name value because this is what the locator will match against.

7) Keep the attributes you will change.

8) Copy the xtd:Transform and xtd:Locator from the commented example to the end of each connection string:

    <add name="MainDB" connectionString="Your Test Values"
         xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
    <add name="CATBERT" connectionString="Your Test Values"
         xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
    <add name="RATBERT" connectionString="Your Test Values"
         xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>

9) Delete the old ConnectionStringTest.config file because you don't need it anymore.

10) Do the same for the AppSettingsTest.Config file. There are good examples of different ways you can do that here:


In my example below, I've only changed the app settings that will change with the deployment between the development version, Test, and Production. This requires the web.config to have the values you will need for deployment.

    <add key="HelpDeskEmail" value="" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
    <add key="AppHelpDeskEmail" value="" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
    <add key="WebHelpDeskEmail" value="" xdt:Transform="Replace" xdt:Locator="Match(key)"/> 

11) Delete the AppSettingsTest.config file because it is no longer needed.

12) Do the same for other configurations you may have like Production, but of course using the related transform file under the Web.config

New deployment steps

1) For your main project,

double click on properties.



 2) For each configuration, make your changes. These will mostly be in the Package/Publish Web tab.

Package Publish Tab

 3) Choose your configuration



4) Build your solution

5) Right click on your main project and choose "Build Deployment Package"

Build Deployment Menu


6) Wait until it is done. By showing all files in your project, you can open the transformed Web.config to ensure it was created as you expect

Transformed Web Config

 7) In the same area, you can look in Package to see that the zip files was created.

8) Right click on you main project and choose publish

Publish menu

 9) Enter a profile name

Publish Profile

10) choose the Publish Method (File System for me and the target location). If you choose File System, you can specify a local path so validate that everything is created as you expect. You may or may not want to delete all existing files prior to publishing.

11) Click save.

12) Click Publish

13) repeat for other configurations

14)If you want the publish setting to be saved to source safe, "show all files" for the project, find "projectName".Publish.xml and include it in the project.