Jasinski Technical Wiki


Home Page
All Pages

Quick Search
Advanced Search »

Contributor Links

Create a new Page
File Management
Your Profile

Other Wiki Sections



Web.Config Transformations with Web Setup Project - Visual Studio

Modified on Fri, Apr 27, 2012, 10:17 AM by Administrator Categorized as Visual Studio and Developer Tools


Web Setup Projects don't normally apply web.config transformations properly. Instead, it simply copies the web.config file(s) as content files. This article details a workaround.

This article was adapted from http://stackoverflow.com/questions/2992778/asp-net-web-config-transformation-wont-work-in-installer.


1. Create the needed web.config transformation files (e.g., web.Debug.config, web.Release.config, etc.).

2. Manually edit web application project file (.CSPROJ file), adding the following code near the end. (You should see comments near the end of the file regarding this.)

<Target Name="AfterBuild">
  <TransformXml Source="Web.config" Transform="$(ProjectConfigTransformFileName)" Destination="Web.Transformed.config" />

3. In the web setup project, select Content files > Exclude filter > add web.config and each web.*.config file.

4. In the web setup project, select File System > Web Application folder > Add file > select web.Transformed.config in the root of your web application project folder

5. In the same screen, rename web.transformed.config to web.config.

ScrewTurn Wiki version Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2023, Patrick Jasinski.