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.
<PackageReference />
element in my csproj file. I'll edit the question to include that information. MSBuild is correctly referencing System.ValueTuple.dll from the NuGet package cache in the call to csc.exe. – seniorquico