WebConfigTransform

February 16, 2011
Trying to troubleshoot a transformed web.config file? Want to see what the transformed .config file looks like? This MSDN article includes one way to do it:
MSBuild [.csproj file] /t:TransformWebConfig /p:Configuration=[ConfigName]

MSBuild builds the application and transforms the web.config file according to the Staging transform rules. The output files placed in the obj\[Config]\TransformWebConfig folder.

Oh, and if you want to keep something out of the Web.config and only in the Web.[Config].config files, presuming VS2010 will do you transform for you ... um, no (the post is in the context of Azure, but I'm finding the same issue in just a plain-jane web app).

So, you still need a valid Web.config, but can only use Web.[Config].config transformations for building -> publishing to another site. When running local out of VS2010, no transformation is done, apparently.

tags: ComputersAndTechnology