MonoDevelop无法导入VS2013 / 2015解决方案

时间:2015-06-27 20:29:20

标签: c# visual-studio visual-studio-2013 mono monodevelop

我正在打开一个.sln文件,我从VS2013转移到MonoDevelop。但是,当我尝试这个时,它会给我以下错误:

1. Project 'foo' has a different ToolsVersion than the containing solution.
2. Error while trying to load the project '/path/to/foo.csproj': Unknown ToolsVersion '12.0'
3. [repeat 2 for every project in the solution]

当我尝试为VS2015文件执行此操作时,它会向我发送相同的错误,但此时ToolsVersion14.0

我的MonoDevelop版本是v4.0.12;有解决方法吗?

2 个答案:

答案 0 :(得分:10)

我知道MonoDevelop 5.x + / Mono 4.x有xbuild / MSBuild支持Toolsversion 12.所以请检查你的安装。

检查Mono安装:

mono --version

Mono JIT compiler version 4.0.2 ((detached/c99aa0c Thu Jun 11 18:53:01 EDT 2015)

xbuild --version

XBuild Engine Version 12.0
Mono, Version 4.0.2.0**

检查您的GAC安装:

gacutil -l | grep Microsoft.Build

Microsoft.Build, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Microsoft.Build.Engine, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Microsoft.Build.Engine, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Microsoft.Build.Engine, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Microsoft.Build.Framework, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Microsoft.Build.Framework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Microsoft.Build.Tasks.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Microsoft.Build.Utilities.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

检查您是否拥有MSBuild dll(路径也取决于平台,根据需要进行更改):

cat `which xbuild`

#!/bin/sh
exec /Library/Frameworks/Mono.framework/Versions/4.0.2/bin/mono $MONO_OPTIONS /Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/xbuild.exe "$@"

从上面的输出中获取Mono安装路径并更改下面的路径以匹配:

查找/Library/Frameworks/Mono.framework/Versions/4.0.2 -name" * MSBuild"

/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/4.5/MSBuild
/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/gac/Mono.Addins.MSBuild
/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/gac/policy.0.2.Mono.Addins.MSBuild
/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/gac/policy.0.3.Mono.Addins.MSBuild
/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/gac/policy.0.4.Mono.Addins.MSBuild
/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/gac/policy.0.5.Mono.Addins.MSBuild
/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/gac/policy.0.6.Mono.Addins.MSBuild
/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/MSBuild
/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/14.0/bin/MSBuild

因此,您可以看到我有工具版本12.根据需要更新安装/重新安装; - )

答案 1 :(得分:1)

解决方法是:

  1. 升级到支持使用工具版本12.0的项目的MonoDevelop 5
  2. 编辑.csproj文件并将工具版本更改为4.0

    < Project ToolsVersion =“4.0”

  3. 如果您选择2.那么您必须在此更改后查看项目是否仍然构建。