title: _CopyWebApplication with web.config transformations
body: <p>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:</p>
  
  <pre><code>  &lt;!-- Automatically Publish in Release build. --&gt;
    &lt;Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" /&gt;
    &lt;Target Name="AfterBuild"&gt;
      &lt;RemoveDir Directories="$(ProjectDir)..\Output\MyWeb" ContinueOnError="true" /&gt;
      &lt;MSBuild Projects="MyWeb.csproj" Properties="Configuration=Release;WebProjectOutputDir=$(ProjectDir)..\Output\MyWeb;OutDir=$(ProjectDir)bin\" Targets="ResolveReferences;_CopyWebApplication" /&gt;
    &lt;/Target&gt;
  </code></pre>
  
  <p>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.</p>
  
  <p>Any ideas are appreciated.</p>