繁体   English   中英

使用Mono 5编译包含ValueTuple的C#7代码

[英]Compiling C# 7 code containing ValueTuple with Mono 5

我试图使用Mono 5在Linux构建服务器上编译新的C#7代码。不幸的是,当我使用新的ValueTuple语法时,该项目失败:

MyClass.cs(100,38):错误CS1003:语法错误,'('预期[/path/to/My.csproj]

我的项目文件中包含以下软件包参考:

<PackageReference Include="System.ValueTuple" Version="4.3.0" />

并且我在快速构建脚本中使用了以下命令:

# msbuild My.sln /t:restore
# msbuild My.sln /p:Configuration=Release /p:Platform="Any CPU"

MSBuild日志指示语言版本为7,并显示对System.ValueTuple.dll的引用:

CoreCompile:

/usr/lib/mono/4.5/csc.exe / noconfig / unsafe- / checked- / nowarn:1701,1702,1705,1701,1702 / langversion:7 / nostdlib + / errorreport:提示/ warn:4 / doc:bin /发布/net461/My.xml /定义:TRACE; RELEASE; NET461 / highentropyva + ... /参考:/root/.nuget/packages/system.valuetuple/4.3.0/lib/netstandard1.0/System.ValueTuple 。 dll ... / debug- / debug:portable / filealign:512 / nologo / optimize + /out:obj/Release/net461/My.dll /subsystemversion:6.00 / target:library / warnaserror- / utf8output / deterministic + My.cs“ /tmp/.NETFramework,Version=v4.6.1.AssemblyAttributes.cs“ obj / Release / net461 / My.AssemblyInfo.cs

是否有人在使用Mono 5的Linux上使用新的ValueTuple语法成功编译了C#? 它只是起作用,还是您需要调整环境使其起作用?

我的构建服务器正在运行Ubuntu 16.04,并已安装了mono-devel 5.0.1.1-0xamarin5 + ubuntu1604b1。

我卸载了稳定的mono-devel 5.0.1.1-0xamarin5 + ubuntu1604b1,并将其替换为Beta mono-devel 5.2.0.196-0xamarin7 + ubuntu1604b1。 现在,该项目编译没有错误。

我将假定Mono中的错误已得到解决,可以解决此问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM