使用mono / xbuild编译VS2015应用程序时出错

我是编程新手,但并不是Linux新手。 我最近在C#中开始了一个编程类,我们使用Visual Studio 2015编写应用程序,因此使用MSbuild编译它们。 然而,在家里,我想用mono来编译所有的东西,但是当我尝试的时候,我得到了一些错误,并拒绝编译。 这是我运行的程序:

$ xbuild Dice_Game.sln 

这是stderr:

 Errors: /home/dj/programs/c#_programs/Dice_Game/Dice_Game.sln (default targets) -> (Build target) -> /home/dj/programs/c#_programs/Dice_Game/Dice_Game.csproj (default targets) -> /usr/local/lib/mono/xbuild/12.0/bin/Microsoft.CSharp.targets (CoreCompile target) -> CSC: error CS0518: The predefined type `System.Object' is not defined or imported CSC: error CS0518: The predefined type `System.ValueType' is not defined or imported CSC: error CS0518: The predefined type `System.Attribute' is not defined or imported CSC: error CS0518: The predefined type `System.Int32' is not defined or imported CSC: error CS0518: The predefined type `System.UInt32' is not defined or imported CSC: error CS0518: The predefined type `System.Int64' is not defined or imported CSC: error CS0518: The predefined type `System.UInt64' is not defined or imported CSC: error CS0518: The predefined type `System.Single' is not defined or imported CSC: error CS0518: The predefined type `System.Double' is not defined or imported CSC: error CS0518: The predefined type `System.Char' is not defined or imported CSC: error CS0518: The predefined type `System.Int16' is not defined or imported CSC: error CS0518: The predefined type `System.Decimal' is not defined or imported CSC: error CS0518: The predefined type `System.Boolean' is not defined or imported CSC: error CS0518: The predefined type `System.SByte' is not defined or imported CSC: error CS0518: The predefined type `System.Byte' is not defined or imported CSC: error CS0518: The predefined type `System.UInt16' is not defined or imported CSC: error CS0518: The predefined type `System.String' is not defined or imported CSC: error CS0518: The predefined type `System.Enum' is not defined or imported CSC: error CS0518: The predefined type `System.Delegate' is not defined or imported CSC: error CS0518: The predefined type `System.MulticastDelegate' is not defined or imported CSC: error CS0518: The predefined type `System.Void' is not defined or imported CSC: error CS0518: The predefined type `System.Array' is not defined or imported CSC: error CS0518: The predefined type `System.Type' is not defined or imported CSC: error CS0518: The predefined type `System.Collections.IEnumerator' is not defined or imported CSC: error CS0518: The predefined type `System.Collections.IEnumerable' is not defined or imported CSC: error CS0518: The predefined type `System.IDisposable' is not defined or imported CSC: error CS0518: The predefined type `System.IntPtr' is not defined or imported CSC: error CS0518: The predefined type `System.UIntPtr' is not defined or imported CSC: error CS0518: The predefined type `System.RuntimeFieldHandle' is not defined or imported CSC: error CS0518: The predefined type `System.RuntimeTypeHandle' is not defined or imported CSC: error CS0518: The predefined type `System.Exception' is not defined or imported 4 Warning(s) 31 Error(s) Time Elapsed 00:00:01.2374970 

看来我可以做这个工作…我只是没有足够的经验,使单声道工作。 任何帮助,将不胜感激。

请将您的项目的目标框架更改为.NET 4.5。

目前Mono不支持.NET 4.5.1及以上版本。

我的头发在这拉了一半。 有很多方法来安装单声道,有些会安装一个过时的版本。 我记得以下一些关于VS Code和Omnisharp的说明。

因此,要获得最新的安装,请按照单声道的下载页面上的说明设置apt源,然后执行以下操作:

 sudo apt install --reinstall mono-complete sudo apt upgrade 

xbuild开始工作,但表示它已被弃用,所以使用msbuild