这些 Mono/xbuild 警告是什么意思以及如何修复它们?

2024-01-05

我使用 Mono 的 xbuild 2.10.5.0 构建 VS2010 项目。这些项目使用“.NET Framework 3.5 Client Profile”作为目标框架(它们必须与 3.5 兼容,并且我只需要客户端配置文件部分)。

我收到以下警告:

Build succeeded.

Warnings:

c:\Project\MyProject.csproj (default targets) -> C:\PROGRA~2\Mono\lib\mono\4.0\Microsoft.Common.targets (GetReferenceAssemblyPaths target) ->
    C:\PROGRA~2\Mono\lib\mono\4.0\Microsoft.Common.targets:  warning : Unable to find framework corresponding to the target framework moniker '.NETFramework,Version=v3.5,Profile=Client'. Framework assembly references will be resolved from the GAC, which might not be the intended behavior.

c:\Project\MyProject.csproj (default targets) -> C:\PROGRA~2\Mono\lib\mono\4.0\Microsoft.Common.targets (ResolveAssemblyReferences target) ->
    C:\PROGRA~2\Mono\lib\mono\4.0\Microsoft.Common.targets:  warning : Reference 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' not resolved
    C:\PROGRA~2\Mono\lib\mono\4.0\Microsoft.Common.targets:  warning : Found a conflict between : 'System' and 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Using 'System' reference.
    C:\PROGRA~2\Mono\lib\mono\4.0\Microsoft.Common.targets:  warning : Found a conflict between : 'System.Core' and 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Using 'System.Core' reference.

恐怕我不明白这些和唯一的谷歌点击“无法找到与目标框架名称相对应的框架” https://encrypted.google.com/search?q=%22Unable%20to%20find%20framework%20corresponding%20to%20the%20target%20framework%20moniker%22是该错误消息的提交。

这些警告是什么意思以及如何解决它们? Mono 根本不支持“客户端配置文件”吗?如果是这样,我在 Mono 文档中找不到任何相关内容。是什么原因导致无法解决mscorlib参考以及这两个在哪里System它报告的引用之间存在冲突?


您猜对了 - Mono 不支持“客户端”配置文件(例如搜索3.5 Microsoft.Common.targets 的单声道版本 https://github.com/mono/mono/blob/master/mcs/tools/xbuild/xbuild/3.5/Microsoft.Common.targets对于任何提及“客户端”的情况),仅提供完整的 3.5 和 4.0 配置文件。要修复它们,您需要在项目文件中指定受支持的配置文件之一。配置文件选择仅限制构建期间可用的引用集,使用“客户端”配置文件编译的程序集将在“完整”配置文件上正常工作。

The mscorlib, Version=2.0.0.0发生未解析的引用是因为您正在使用 4.0 配置文件(这是默认的后备)进行编译。一旦您将配置文件设置为支持的值,它就会消失。如果您不想更改项目文件,可以使用xbuild /p:TargetFrameworkProfile="",它正确选择了 3.5 组组件。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

这些 Mono/xbuild 警告是什么意思以及如何修复它们? 的相关文章

随机推荐