Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get Mono to use the right 'ToolsVersion'?

Tags:

c#

mono

ubuntu

XBuild Engine Version 12.0
Mono, Version 3.2.8.0

I'm trying to build my C# solution in XBuild. It builds absolutely fine in Windows, but not on Ubuntu. I get the following errors:

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?

and similar. I have added RedditSharp.dll to the GAC, so I don't know why it can't find it, and I certainly don't know why it can't find IReadOnlyCollection. I have a suspicion that it's all because I can't use ToolsVersion 14.0.

Does anybody know anything about building C# on Linux? What am I doing wrong?

like image 610
James Wright Avatar asked Aug 30 '15 11:08

James Wright


1 Answers

14 means MSBuild 14, which is part of Visual Studio 2015. Usually Mono xbuild only supports the latest Visual Studio release after a while. So you either wait till it is updated, or hack xbuild if you like.

Another workaround is to convert your projects to MSBuild version 12

like image 111
Lex Li Avatar answered Nov 06 '22 01:11

Lex Li