Regarding my former article now I’d like to give you a continued HowTo for tapping the Mono C# compiler with support for generics, nullable types and friend assemblies. Compared to the mcs tool (.NET 1.1 target runtime) you have to compile the gmcs fork (.NET 2.0 target runtime) of the mono compiler project.
As shown in my previous post first of all you must run the jay parser generator. But now please use the cs-parser.jay input file in the gmcs directory. Again jay will create the output file cs-parser.cs.
In the first step create a new Visual Studio solution and choose C# Class Library as project type. Afterwards add all *.cs files of the following directories to your project:
+ MONO-SRC\mcs\mcs + MONO-SRC\mcs\gmcs
Preferably you can put the whole mono stuff in a subdirectory of your solution and import the files listed above as links. Don’t forget to exclude the following two files because they are already present:
- MONO-SRC\mcs\mcs\AssemblyInfo.cs - MONO-SRC\mcs\mcs\generics.cs
Finally please also add all files of …
+ MONO-SRC\class\Mono.CompilerServices.SymbolWriter
… as soon as the CryptoConvert.cs file of:
+ MONO-SRC\class\Mono.Security.Cryptography
In the second step define the following three Conditional Compilation Symbols in your Project Properties via the Build pane:
GMCS_SOURCEMS_COMPATIBLENET_2_0
From now on you can compile gmcs. Well, there still exists a few warnings but I think you can ignore that till anytime gmcs becomes the default mono compiler







Sorry for my late answer
I was on vacation for a week
Unfortunately I’ve never tested compiling code with generics in
gmcs’cause I need only the C# parser of the Mono project. In my scenario I compiledgmcsas a Class Library which is in turn integrated in my application (a Static Source Code Analyzer) – this works without problems!Hmm. Does your
gmcsuse the proper references or assemblies e.g. for the typeList?When I follow these steps, the resulting gmcs doesn’t seem to know how to do generics. Are you getting results like the ones below?
I tried compiling this:
And I get this: