VS 2012 Publishing Changes

If your ASP.NET web development team does not have an automated deployment process in-place, the Visual Studio publish feature can be a great way to quickly deploy or update a web project.    In addition, the web.config transform functionality provides a mechanism for automatically replacing web.config settings (such as database connection strings, permissions, etc.) for different environments, like production and test servers.  Recently at a client site, we upgraded to VS 2012 and discovered an important change in the publish process.   In VS 2010, a web.config transform is selected based on the active solution configuration, as selected in the configuration drop-down before starting the publish process.

In VS 2012, the publish mechanism no longer utilizes the web.config transform for the active solution configuration.   Instead a transform is mapped to the publish profile.   This is great once the mappings are setup because it prevents problems if you forget to change the configuration before starting the publish process.  However, if you are unaware of this change, it can be quite easy to deploy the incorrect web.config settings.   One can only imagine the “fun” that can occur when a test database connection string is pushed to a production server!   So, the lesson learned is to double-check the configuration to be deployed in the dialog before deploying.

vs-publish-dialog