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)MicrosoftVisualStudiov10.0WebApplicationsMicrosoft.WebApplication.targets" />
<Target Name="AfterBuild">
<RemoveDir Directories="$(ProjectDir)..OutputMyWeb" ContinueOnError="true" />
<MSBuild Projects="MyWeb.csproj" Properties="Configuration=Release;WebProjectOutputDir=$(ProjectDir)..OutputMyWeb;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.