MSBuildSdks
MSBuildSdks copied to clipboard
Build some projects in parallel with Microsoft.Build.Traversal
I am building quite a few projects, some of them are dependent on other projects. Because it is a mix of managed and native projects, i cannot always use project references to express dependencies. Is there a way to express this with Microsoft.Build.Traversal, making sure that dependent projects are built in order, while independent are built in parallel?
Microsoft.Build.Traversal
does not have any other way to express dependencies at the moment. You should be able to native projects reference managed projects and visa versa. Perhaps we can find a way to get that to work for you?
Here's a related problem. I have this in my dirs.proj:
<ProjectReference Condition="'$(NugetPackagingOnly)' != 'true'" Include="PackageUI\src\LanguagePackage.vcxproj" SetPlatform="Platform=AnyCPU" />
<ProjectReference Condition="'$(NugetPackagingOnly)' != 'true'" Include="PackageUI\src\LanguagePackage.vcxproj" SetPlatform="Platform=x64" />
Unfortunately there's a build target that lives in a shared package that I don't own which creates a temp file in $(MSBuildProjectDirectory) which is not a happy way to do things.
How can I build the same project twice and guarantee it happens serially?
@shueybubbles you should be able to set BuildInParallel=false
on the <ProjectReference />
:
<Project Sdk="Microsoft.Build.Traversal">
<ItemGroup>
<ProjectReference Condition="'$(NugetPackagingOnly)' != 'true'" Include="PackageUI\src\LanguagePackage.vcxproj" SetPlatform="Platform=AnyCPU" BuildInParallel="false" />
<ProjectReference Condition="'$(NugetPackagingOnly)' != 'true'" Include="PackageUI\src\LanguagePackage.vcxproj" SetPlatform="Platform=x64" BuildInParallel="false" />
</ItemGroup>
</Project>