ソリューションをビルドし、コンパイル済みのすべてのバイナリと依存関係を特定の出力フォルダーにコピーする msbuild スクリプトを作成しようとしています。私たちが持っているビルドスクリプトはバイナリをビルドして共通フォルダーにコピーしますが、依存関係はコピーされません。これはおそらく、msbuild タスクを使用してソリューションをビルドした方法に関係しており、タスクのターゲット出力をアイテム グループに受け入れ、アイテム グループを反復処理して、コンパイルされたすべての dll と exe を共通フォルダーにコピーしています。ただし、これには、各プロジェクトの個々の bin フォルダーに配置される依存関係 dll は含まれません。
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ParentSolutionFile />
</PropertyGroup>
<ItemGroup>
<Assemblies Include="*.dll, *.exe" />
</ItemGroup>
<Target Name="BuildAll">
<CombinePath BasePath="$(MSBuildProjectDirectory)" Paths="Source\Solutions\xxx.sln">
<Output TaskParameter="CombinedPaths" PropertyName="ParentSolutionFile" />
</CombinePath>
<Message Text="$(ParentSolutionFile)" />
<MSBuild Projects="$(ParentSolutionFile)">
<Output TaskParameter="TargetOutputs" ItemName="Assemblies" />
</MSBuild>
<Message Text="%(Assemblies.Identity)" />
<Copy SourceFiles="%(Assemblies.Identity)" DestinationFolder="$(MSBuildProjectDirectory)\Binary" OverwriteReadOnlyFiles="True" SkipUnchangedFiles="True" />
</Target>
すべてのバイナリと必要な依存関係を共通の出力フォルダーにコピーするには、どのような方法が望ましいでしょうか?