我正在使用Ubuntu上的mono附带的msbuild v.15。我已将我的汇编引用从gtk-sharp 3.0降级为2.12,以适应与monodevelop的Stetic Designer不兼容的问题。不幸的是,由于某些原因,msbuild仍然想使用较新的版本。构建的详细输出显示(仅摘录):
Task "GetDependsOnNETStandard" skipped, due to false condition;
('$(DependsOnNETStandard)' == '' AND '$(NETStandardInbox)' != 'true' AND
'@(_CandidateNETStandardReferences)' != '')
was evaluated as ('' == '' AND 'true' != 'true' AND
'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;
gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f;
gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f;
glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f;
atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f;
Mono.Cairo, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756;
...' != '').
Task "ResolveAssemblyReference"
TargetFrameworkMoniker:
.NETFramework,Version=v4.7.1
TargetFrameworkMonikerDisplayName:
.NET Framework 4.7.1
TargetedRuntimeVersion:
v4.0.30319
Assemblies:
System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f
gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f
glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f
atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f
Mono.Cairo, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756
...
Primary reference "gtk-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f".
Resolved file path is "/usr/lib/mono/gac/gtk-sharp/3.0.0.0__35e10195dab3c99f/gtk-sharp.dll".
Reference found at search path location "{GAC}".
For SearchPath "{TargetFrameworkDirectory}".
Considered "/usr/lib/mono/xbuild-frameworks/.NETFramework/v4.7.1/gtk-sharp.winmd", but it didn't exist.
Considered "/usr/lib/mono/xbuild-frameworks/.NETFramework/v4.7.1/gtk-sharp.dll", but it didn't exist.
Considered "/usr/lib/mono/xbuild-frameworks/.NETFramework/v4.7.1/gtk-sharp.exe", but it didn't exist.
Considered "/usr/lib/mono/4.7.1-api/gtk-sharp.winmd", but it didn't exist.
Considered "/usr/lib/mono/4.7.1-api/gtk-sharp.dll", but it didn't exist.
Considered "/usr/lib/mono/4.7.1-api/gtk-sharp.exe", but it didn't exist.
Considered "/usr/lib/mono/4.7.1-api/Facades/gtk-sharp.winmd", but it didn't exist.
Considered "/usr/lib/mono/4.7.1-api/Facades/gtk-sharp.dll", but it didn't exist.
Considered "/usr/lib/mono/4.7.1-api/Facades/gtk-sharp.exe", but it didn't exist.
Considered "/usr/lib/mono/4.7.1-api/Facades/gtk-sharp.winmd", but it didn't exist.
Considered "/usr/lib/mono/4.7.1-api/Facades/gtk-sharp.dll", but it didn't exist.
Considered "/usr/lib/mono/4.7.1-api/Facades/gtk-sharp.exe", but it didn't exist.
Found related file "/usr/lib/mono/gac/gtk-sharp/3.0.0.0__35e10195dab3c99f/gtk-sharp.dll.config".
This reference is not "CopyLocal" because it's registered in the GAC.
The ImageRuntimeVersion for this reference is "".
我不清楚为什么它在构建过程中途从2.12切换到3.0。
答案 0 :(得分:1)
很难根据您提供的信息来诊断为什么统一引用最终以比预期更高的程序集版本出现,但这是我发现在解决类似问题方面非常重要的两个指针。
MSBuild binlog viewer工具(source)。将-bl:somename.binlog
添加到MSBuild调用中,然后使用该工具检查日志。日志文件是自包含的(包括压缩脚本和所有内容),可以在另一台计算机上查看。除了在Windows上,我从未使用过它,因此无法确定它是否可以在Mono下运行。
The most detailed explanation of the assembly unification process来自MSBuild的一位顶级设计师Rainer Sigwald。 ResolveAssemblyReference
可能是构建过程中逻辑上最复杂的步骤之一,此参考文献涵盖了所有内容。
答案 1 :(得分:0)
删除lib{atk,gdk,glib,gtk}3.0-cil
软件包可以修复我的构建。这没有任何意义,但确实有效。