リリース ビルドの実行時に Web アプリケーションを自動的に公開しようとしています。_CopyWebApplication ターゲットを使用してこれを行っています。.csproj ファイルに以下を追加しました。
<!-- 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>
これは機能しますが、1 つの問題があります。この出力と、Visual Studio で [発行] メニュー項目を使用したときに生成される出力の違いは、MSBuild メソッドを使用する場合、Web.Release.config 変換が Web.config ファイルに適用されないことです。代わりに、Web.config、Web.Release.config、および Web.Debug.config がすべてコピーされます。
どんなアイデアでも大歓迎です。