我已经进行了两次并行测试构建项目解决方案的测试,看看会发生什么。原来一个MSBuild节点在尝试构建我的解决方案之前等待另一个节点完成,然后说它是最新的。例:
<!-- ProjectA.proj -->
<Project>
<ItemGroup>
<Project Include="MyProject.sln" />
</ItemGroup>
<Target Name="Build">
<MSBuild Projects="@(Project)" Targets="Build" BuildInParallel="true" />
</Target>
</Project>
<!-- Test.proj -->
<Project>
<ItemGroup>
<Project Include="ProjectA.proj" />
<Project Include="ProjectA.proj" />
</ItemGroup>
<Target Name="Build">
<MSBuild Projects="@(Project)" Targets="Build" BuildInParallel="true" />
</Target>
</Project>
<!-- When I check the build log it says
1> Project is building MyProject.sln (2) ...
1> Project is building MyProject.sln (2:2) ...
2> Building with tools...
2> ...
2:2> Building with tools...
2> ...
2> ...
2> ...
2> Done building
2:2> Target ... skipped because it was previously built successfully
2:2> Done building
-->
这是一种理想的行为,但是当我尝试依赖它来构建构建服务器时,我的项目会同时构建两次,给我带来很多错误。
我不明白其中的区别,也不知道如何找出问题。