gpt4 book ai didi

MSBuild构建顺序

转载 作者:行者123 更新时间:2023-12-04 18:53:09 27 4
gpt4 key购买 nike

从MS来看这个article,我对SolutionToBuild部分有疑问。

<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>

它说构建的顺序是由上述顺序决定的。因此,例如,将在涂抹之前构建MySolution。

但是,如果涂抹依赖于MySolution,这是否安全?例如,MySolution输出一个或多个scribble使用的dll。如果同时更改MySolution和scribble,则在进入下一个项目之前,该版本会等待MySolution完全编译吗?

最佳答案

您可以尝试将其他元数据用于SolutionToBuild项目。一些与递归和贴膜有关的工作!

<?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>

关于MSBuild构建顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2991904/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com