_CopyWebApplication with web.config transformations
Posted
by Jeremy
on Stack Overflow
See other posts from Stack Overflow
or by Jeremy
Published on 2009-12-31T01:53:30Z
Indexed on
2010/06/01
21:13 UTC
Read the original article
Hit count: 568
msbuild
I am trying to have my web application automatically Publish when a Release build is performed. I'm doing this using the _CopyWebApplication target. I added the following to my .csproj file:
<!-- Automatically Publish in Release build. -->
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<Target Name="AfterBuild">
<RemoveDir Directories="$(ProjectDir)..\Output\MyWeb" ContinueOnError="true" />
<MSBuild Projects="MyWeb.csproj" Properties="Configuration=Release;WebProjectOutputDir=$(ProjectDir)..\Output\MyWeb;OutDir=$(ProjectDir)bin\" Targets="ResolveReferences;_CopyWebApplication" />
</Target>
This works but with one issue. The difference between this output, and the output generated when using the Publish menu item in Visual Studio, is that the Web.Release.config transformation is not applied to the Web.config file when using the MSBuild method. Instead, Web.config, Web.Release.config, and Web.Debug.config are all copied.
Any ideas are appreciated.
© Stack Overflow or respective owner