I'm attempting to compile my new C# 7 code on a Linux build server using Mono 5. Unfortunately, the project fails 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 reference in my project file:
<PackageReference Include="System.ValueTuple" Version="4.3.0" />
and I'm using 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 a language version of 7 and shows a reference 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 adjust the environment to make it work?
My build server is running Ubuntu 16.04 and has mono-devel 5.0.1.1-0xamarin5+ubuntu1604b1 installed.
I uninstalled the stable mono-devel 5.0.1.1-0xamarin5+ubuntu1604b1 and replaced it with the beta mono-devel 5.2.0.196-0xamarin7+ubuntu1604b1. The project now compiles without error.
I will assume that a bug in mono has been fixed that resolves this issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With