Looking at this article from MS, I have a question about the SolutionToBuild section.
<ItemGroup>
<SolutionToBuild Include="$(SolutionRoot)\path\MySolution.sln />
<SolutionToBuild Include="$(SolutionRoot)\Scribble\scribble.sln" />
<SolutionToBuild Include="$(SolutionRoot)\HelloWorld\HelloWorld.sln" />
<SolutionToBuild Include="$(SolutionRoot)\TestProject1\TestProject1.sln" />
</ItemGroup>
It says that the sequence of the build is determined by the order above. So, for example, MySolution would be built before scribble.
However, is this safe if scribble is dependant on MySolution? For example, MySolution outputs one or more dlls that are used by scribble. If MySolution and scribble are changed simultaneously, will the build wait for MySolution to be completely compiled before moving to the next project?
You can try to use additional metadata for item SolutionToBuild. Some work with recursion and voilà!
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<SolutionToBuild Include="$(SolutionRoot)\Scribble\levelone.sln">
<DependsOnSolutions>$(SolutionRoot)\Scribble\leveltwo.sln</DependsOnSolutions>
</SolutionToBuild>
<SolutionToBuild Include="$(SolutionRoot)\Scribble\leveltwo.sln">
<DependsOnSolutions>$(SolutionRoot)\Scribble\levelthree.sln;$(SolutionRoot)\TestProject1\TestProject1.sln</DependsOnSolutions>
</SolutionToBuild>
<SolutionToBuild Include="$(SolutionRoot)\Scribble\levelthree.sln" />
<SolutionToBuild Include="$(SolutionRoot)\TestProject1\TestProject1.sln" />
</ItemGroup>
<Target Name="Build">
<MSBuild Projects="$(MSBuildProjectFile)"
Targets="BuildSolution"
Properties="SolutionFullPath=%(SolutionToBuild.Identity)"/>
</Target>
<Target Name="BuildSolution">
<CreateItem Condition="'%(SolutionToBuild.Identity)'=='$(SolutionFullPath)'"
Include="%(SolutionToBuild.DependsOnSolutions)">
<Output TaskParameter="Include"
ItemName="DependentSolutions" />
</CreateItem>
<Message Text="Building solution $(SolutionFullPath)..." />
<Message Text="Solution $(SolutionFullPath) depends on %(DependentSolutions.Identity)..."
Condition="'@(DependentSolutions)'!=''"/>
<Message Text="Building dependent solutions..."
Condition="'@(DependentSolutions)'!=''"/>
<MSBuild Projects="$(MSBuildProjectFile)"
Targets="BuildSolution"
Properties="SolutionFullPath=%(DependentSolutions.Identity)"
Condition="'@(DependentSolutions)'!=''"/>
<!-- <MSBuild Projects="$(SolutionFullPath)" /> -->
<Message Text="Building solution $(SolutionFullPath)... OK" />
</Target>
</Project>
How do you manage solution dependency? Aren't you referencing projects instead? I'm also puzzled about the 'simultaneous' changes on some of your solutions. Please clarify the nature of these changes.
So far, the answers to your questions are:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With