我在用:
- 单声道开发 7.1
- .NET 框架 4.6.2
- Mono 5.0.1.1 (2017-02/5077205 Thu May 25 09:16:53 UTC 2017)(64 位)
- 没有 PCL 或配置文件(据我所知)
- msbuild 15.2.0.0(2017 年 5 月 11 日星期四 17:28:41 UTC)
<NoStdLib>
未指定;也就是说,它保留为默认值。
<TargetFrameworkVersion>
设置为 v4.6.2。
当我在 IDE 中构建时,我看不到任何警告或错误。但是,当我构建解决方案时
msbuild /v:detailed my.sln
我看到其中一些消息:
Dependency "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea77
98e, Retargetable=Yes".
Could not resolve this reference. Could not locate the assembly "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
浏览 Mono 文件,以下所有程序集都与上述版本和密钥匹配:
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile102/mscorlib.dll
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile19/mscorlib.dll
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile225/mscorlib.dll
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile5/mscorlib.dll
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile92/mscorlib.dll
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile47/mscorlib.dll
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile14/mscorlib.dll
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile24/mscorlib.dll
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile328/mscorlib.dll
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile6/mscorlib.dll
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile158/mscorlib.dll
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile255/mscorlib.dll
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile37/mscorlib.dll
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile240/mscorlib.dll
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile136/mscorlib.dll
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile147/mscorlib.dll
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile42/mscorlib.dll
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile344/mscorlib.dll
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/Profile/Profile336/mscorlib.dll
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.0/mscorlib.dll
其他mscorlib
程序集要么具有错误的版本,要么具有密钥令牌b77a5c561934e089
而不是7cec85d7bea7798e
.
我的问题是:
- 为什么我的解决方案试图引用可移植的 .NET?
- 是否有一个程序集引用树工具可以用来找出引用的罪魁祸首是什么?
- 为什么这是一个非致命错误,甚至根本没有出现在 IDE 构建输出中?
- 我应该手动引用这些程序集之一吗?如果是这样,哪个配置文件?
- 如果我不参考这些程序集之一,会有什么后果?
- 我的所有程序集都是强名称签名的这一事实是否会影响解决此错误的重要性?
提前致谢。
编辑:
使用monodis --assemblyref
,我发现问题是Common.Logging
:
Common.Logging.dll
AssemblyRef Table
...
4: Version=2.0.5.0
Name=mscorlib
Flags=0x00000100
Public Key:
0x00000000: 7C EC 85 D7 BE A7 79 8E
./Common.Logging.Core.dll
AssemblyRef Table
...
1: Version=2.0.5.0
Name=mscorlib
Flags=0x00000100
Public Key:
0x00000000: 7C EC 85 D7 BE A7 79 8E
./Common.Logging.NLog41.dll
AssemblyRef Table
...
6: Version=2.0.5.0
Name=mscorlib
Flags=0x00000100
Public Key:
0x00000000: 7C EC 85 D7 BE A7 79 8E
尽管我packages.config
特别要求 .NET 4.62:
<package id="Common.Logging" version="3.3.1" targetFramework="net462" />
<package id="Common.Logging.Core" version="3.3.1" targetFramework="net462" />
<package id="Common.Logging.NLog41" version="3.3.1" targetFramework="net462" />
所以我想这是一个错误Common.Logging
?