I have been experimenting and have found some points of interest (at least to me):
Point 1 MonoDevelop uses the Microsoft .NET compiler when used on Windows from the framework associated with the target platform.
When target is “Mono / .NET 3.5” it uses “C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe”
When target is “Mono / .NET 4” it uses “C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe”
Point 2 Visual Studio always uses the compiler “C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe” regardless of the target framework.
Point 3 Despite using the latest C# compiler, Visual Studio links to the targeted framework libraries (as expected). This means that new language features of C# can be used in conjunction with older versions of the .NET framework.
To me it seems that MonoDevelop should be following suite by always using the newer compiler, whilst using the specified target framework.
I have been comparing the build command line used by Visual Studio and MonoDevelop and am confused as to why one causes me issues with Unity, whilst the other doesn’t (when targeting .NET 4 from both IDEs). For some reason the MonoDevelop version works and the Visual Studio one causes issues with prefabs.
Note: I have re-ordered command arguments and placed onto separate lines 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
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
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
Point 4 According to the MonoDevelop settings, Unity will use MonoDevelop to build project when debugging. See “Tools → Options → Unity → Debugger”
These are more notes than anything, but perhaps there is something hidden in here somewhere 