如何调试 MSBuild 依赖问题?
how to debug MSBuild dependency issues?
我们有混合的 C# 和 C++/CLI 解决方案。使用 devenv 进行构建,通过
进行构建
msbuild /nr:false /t:Rebuild /p:Configuration=Release /p:Platform=x64 Solution.sln
有效,但在添加 /m 时失败。例如,cl 或 link 失败导致 .pch 或 .obj 已在使用中。
通过诊断输出,我发现有些项目出于某种原因被多次构建:
1>Project "Solution.sln" (1)
is building "a.vcxproj" (34) on node 2 (default targets).
34>Project "a.vcxproj" (34)
is building "b.vcxproj" (43:2) on node 5 (default targets).
33>Project "c.csproj" (33)
is building "c.csproj" (33:2) on node 6 (ResolveReferences;_CopyFilesMarkedCopyLocal target(s)).
33:2>Project "c.csproj" (33:2)
is building "d.csproj" (41) on node 2 (default targets).
41>Project "d.csproj" (41)
is building "d.csproj" (41:2) on node 2 (ResolveReferences;_CopyFilesMarkedCopyLocal target(s)).
41:2>Project "d.csproj" (41:2)
is building "b.vcxproj" (43) on node 2 (default targets).
.
1>Project "Solution.sln" (1)
is building "e.vcxproj" (60) on node 5 (default targets).
1>Project "Solution.sln" (1)
is building "f.csproj" (69) on node 6 (default targets).
69>Project "f.csproj" (69)
is building "f.csproj" (69:2) on node 6 (ResolveReferences;_CopyFilesMarkedCopyLocal target(s)).
69:2>Project "f.csproj" (69:2)
is building "e.vcxproj" (60:2) on node 6 (default targets).
但我不知道为什么当 devenv 能够正确处理 deps 时它会表现得像那样。
是否有人知道其他 switches/tools/whatever 或在日志中寻找什么来确定如何解决这个问题?
用建模 SDK 替换 https://www.nuget.org/packages/Clarius.TransformOnBuild-unofficial/ 后,问题消失了。
关于 MSBuild "debugging" 总的来说,似乎没有比挖掘详细日志更好的方法了 /fl /flp:MSBuild.log;verbosity=diagnostic /detailedsummary
我们有混合的 C# 和 C++/CLI 解决方案。使用 devenv 进行构建,通过
进行构建msbuild /nr:false /t:Rebuild /p:Configuration=Release /p:Platform=x64 Solution.sln
有效,但在添加 /m 时失败。例如,cl 或 link 失败导致 .pch 或 .obj 已在使用中。
通过诊断输出,我发现有些项目出于某种原因被多次构建:
1>Project "Solution.sln" (1)
is building "a.vcxproj" (34) on node 2 (default targets).
34>Project "a.vcxproj" (34)
is building "b.vcxproj" (43:2) on node 5 (default targets).
33>Project "c.csproj" (33)
is building "c.csproj" (33:2) on node 6 (ResolveReferences;_CopyFilesMarkedCopyLocal target(s)).
33:2>Project "c.csproj" (33:2)
is building "d.csproj" (41) on node 2 (default targets).
41>Project "d.csproj" (41)
is building "d.csproj" (41:2) on node 2 (ResolveReferences;_CopyFilesMarkedCopyLocal target(s)).
41:2>Project "d.csproj" (41:2)
is building "b.vcxproj" (43) on node 2 (default targets).
.
1>Project "Solution.sln" (1)
is building "e.vcxproj" (60) on node 5 (default targets).
1>Project "Solution.sln" (1)
is building "f.csproj" (69) on node 6 (default targets).
69>Project "f.csproj" (69)
is building "f.csproj" (69:2) on node 6 (ResolveReferences;_CopyFilesMarkedCopyLocal target(s)).
69:2>Project "f.csproj" (69:2)
is building "e.vcxproj" (60:2) on node 6 (default targets).
但我不知道为什么当 devenv 能够正确处理 deps 时它会表现得像那样。
是否有人知道其他 switches/tools/whatever 或在日志中寻找什么来确定如何解决这个问题?
用建模 SDK 替换 https://www.nuget.org/packages/Clarius.TransformOnBuild-unofficial/ 后,问题消失了。
关于 MSBuild "debugging" 总的来说,似乎没有比挖掘详细日志更好的方法了 /fl /flp:MSBuild.log;verbosity=diagnostic /detailedsummary