MSBuild to copy output of a dependency project into another folder
I have a project that have a couple project dependencies, I want to throw the output (dll) of the two dependent project into another folder, but it doesn't seem to work. The following is something what I have, is there anything wrong?
<ItemGroup>
<ProjectReference Include="..\..\a\a.csproj">
<Project>{xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}<开发者_StackOverflow;/Project>
<Name>Client</Name>
</ProjectReference>
<ProjectReference Include="..\..\b\b.csproj">
<Project>{yyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy}</Project>
<Name>Server</Name>
</ProjectReference>
</ItemGroup>
<Target Name="BuildOtherProjects">
<MSBuild Projects="@(ProjectReference)" Targets="Build">
<Output TaskParameter="TargetOutputs" ItemName="DependentAssemblies" />
</MSBuild>
<Copy SourceFiles="@(DependentAssemblies)" DestinationFolder="$(OtherBuildLocation)\Build\Output" SkipUnchangedFiles="true" />
</Target>
Firstly, at what point is it failing? Try debugging what you've got with a few message tasks set to importance="high" (to ensure their visibility in the output). The first check that springs to mind, is what's actually in the DependentAssemblies ItemGroup after the MSBuild task?
If you're doing what I think you're trying to do though, that is, get all dependencies into a single directory, perhaps for deployment, then have you considered instead having all projects output to the same directory? OutDir and OutputPath are two properties you can make use of.
精彩评论