This is easily possible using Visual Studio, though I need to achieve this using MonoDevelop because Visual Studio compiled DLL’s are not playing nice with Unity. MonoDevelop DLL’s are working fine but I want to use default function parameters (a C# 4.0 feature) whilst targeting the .NET 2.0 runtime.
Is this possible with MonoDevelop? How can I set this up?
ADDED: Build Command Lines for Visual Studio and MonoDevelop
I have sorted arguments for easier comparison:
MonoDevelop : Target = Mono / .NET 4
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe
/noconfig
/warn:4
"/define:TRACE"
/optimize+
"/out:C:\TestLibraries\TestEditor\bin\Release\TestEditor.dll"
/t:library
/nologo
"/r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll"
"/r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll"
"/r:C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEditor.dll"
"/r:C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll"
/fullpaths
/utf8output
MonoDevelop : Target = Mono / .NET 3.5 (1st interesting one)
C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe
/warn:4
"/define:TRACE"
/optimize+
"/out:C:\TestLibraries\TestEditor\bin\Release\TestEditor.dll"
/t:library
/nologo
-nostdlib
"/r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll"
"/r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll"
"/r:C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEditor.dll"
"/r:C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll"
/fullpaths
/utf8output
Visual Studio : Target = .NET 4
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe
/noconfig
/nowarn:1701,1702
/warn:4
/define:TRACE
/optimize+
/out:obj\Release\TestEditor.dll
/target:library
/nostdlib+ /errorreport:prompt
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll"
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll"
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll"
/reference:"C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll"
/debug:pdbonly
/filealign:512
Visual Studio : Target = .NET 3.5 (2nd interesting one)
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe
/noconfig
/nowarn:1701,1702
/warn:4
/define:TRACE
/optimize+
/out:obj\Release\TestEditor.dll
/target:library
/nostdlib+ /errorreport:prompt
/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll"
/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll
/reference:"C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll"
/debug:pdbonly
/filealign:512
The 2.0 C# compilers (mcs/gmcs) that comes with the latest stable Mono version (2.10.9) support default function parameters. I just created a new console project, changed the target framework to 2.0 and compiled default function parameters successfully.