XBuild Engine Version 12.0
Mono, Version 3.2.8.0
我正在尝试在XBuild中构建我的C#解决方案.它在Windows中构建得非常好,但在Ubuntu上却没有.我收到以下错误:
warning : Project has unknown ToolsVersion '14.0'. Using the default tools version '4.0' instead.
Target GetFrameworkPaths:
/usr/lib/mono/4.5/Microsoft.Common.targets:  warning : TargetFrameworkVersion 'v4.5.2' not supported by this toolset (ToolsVersion: 4.0).
error CS0246: The type or namespace name 'RedditSharp' could not be found. Are you missing an assembly reference?
error CS0246: The type or namespace name `IReadOnlyCollection' could not be found. Are you missing an assembly reference?
和类似的.我已经将RedditSharp.dll添加到GAC,所以我不知道它为什么找不到它,我当然不知道它为什么找不到IReadOnlyCollection.我怀疑这一切都是因为我无法使用ToolsVersion 14.0.
有没有人知道在Linux上构建C#的事情?我究竟做错了什么?
14表示MSBuild 14,它是Visual Studio 2015的一部分.通常,Mono xbuild仅在一段时间后才支持最新的Visual Studio版本.所以你要么等到它被更新,要么就像你喜欢的那样破解xbuild.
另一种解决方法是将项目转换为MSBuild版本12
您面临着两个不同的问题.
首先是关于ToolsVersion 14.0的警告和第二个错误抱怨4.5.2不受支持.
只需将目标框架更改为4.5,您的项目即可编译.ToolsVersion警告仍然存在,但编译将成功完成.
我遇到了同样的问题.更改目标框架后一切正常.