Compiling C # 7 code containing ValueTuple with Mono 5

I am trying to compile my new C # 7 code on a Linux build server using Mono 5. Unfortunately, the project does not work when I use the new ValueTuple syntax:

MyClass.cs (100,38): error CS1003: Syntax error, '(' expected [/path/to/My.csproj]

I have the following package link in the project file:

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

and I use the following commands in my quick build script:

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

and the MSBuild log indicates language version 7 and shows a link to System.ValueTuple.dll:

CoreCompile:

/usr/lib/mono/4.5/csc.exe/noconfig/unsafe-/checked-/nowarn: 1701,1702,1705,1701,1702 / langversion: 7 / nostdlib + / errorreport: prompt / warn: 4 / doc: bin / Release / net461 / My.xml / define: TRACE; RELEASE; NET461 / highentropyva + ... /reference:/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

Has anyone successfully compiled C # using the new ValueTuple syntax on Linux using Mono 5? Did it just work, or did you need to set up the environment for it to work?

My build server works with Ubuntu 16.04 and has mono-devel 5.0.1.1-0xamarin5 + ubuntu1604b1 installed.

+5
source share
1 answer

I removed the stable mono-devel 5.0.1.1-0xamarin5 + ubuntu1604b1 and replaced it with the beta mono-devel 5.2.0.196-0xamarin7 + ubuntu1604b1. Now the project compiles without errors.

I assume that a bug in mono has been fixed, which fixes this problem.

+5
source

Source: https://habr.com/ru/post/1269673/


All Articles