How to compile with mono targetting C # /. Net 4

I have a mono 2.10.4 installation on linux and am trying to compile the dependent .NET C # 4 code base. I was able to compile in MonoDevelop, but should be able to do this from a command line / build tool.

performance:

gmcs -langversion:4 -target:library -out:foo.dll ... <sources> 

produces the following error:

 error CS1617: Invalid -langversion option `4'. It must be `ISO-1', `ISO-2', `3' or `Default' 

gmcs --version compiler gmcs --version :

Mono C# compiler version 2.10.4.0

Further notes:

  • ubuntu 11.04
  • install in / opt / mono -2.10
  • mono install first on the way
+4
source share
1 answer

I think you want to run dmcs instead of gmcs . On the CSharp Compiler page :

Starting with Mono 2.6, the new dmcs compiler is available as a C # 4.0 preview (preview from Mono 2.6 until C # 4.0 is completed).

(This is a bit dated as I am now executing 2.10.5.0, but it doesn't matter).

EDIT: Alternatively, use mcs as indicated here , since you are using 2.10.

It does not support the specific -langversion of 4, but also the Microsoft compiler:

 /langversion:<string> Specify language version mode: ISO-1, ISO-2, 3, or Default 
+7
source

All Articles