_CopyWebApplication with web.config transformations

I’ve been hitting my head against the wall for this. After hiking through the MSBuild targets I’ve come across something very “opaque”.

Long story short: Try using the new _WPPCopyWebApplication. It works on my machine. The old _CopyWebApplication does not support transformations for legacy reasons. This is what I do:

msbuild /t:Rebuild /p:OutDir=..\publish\;Configuration=Release;UseWPP_CopyWebApplication=True;PipelineDependsOnBuild=False MvcApplication1\MvcApplication1.csproj

# UseWPP_CopyWebApplication = true requires PipelineDependsOnBuild = false

Long story:

Have a look at VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets. It’s so wrong. Find _CopyWebApplication in line 70. The comment is:

The original _CopyWebApplication is now a Legacy, you can still use it by setting $(UseWPP_CopyWebApplication) to true.
By default, it now change to use _WPPCopyWebApplication target in Microsoft.Web.Publish.targets. It allow to leverage the web.config trsnaformation. [all sic]

Uh oh. UseWPP_CopyWebApplication defaults to false (line 27) which makes sense if you don’t want to break the existing _CopyWebApplication. So setting it to true will actually use the new WPP stuff introduced to VS 2010. I prefer this over calling a “hidden” target.

Leave a Comment