How to use Unity's mono to compile in MonoDevelop

I want to create a .dll to use in Unity, by using MonoDevelop. Since my code makes use of the default arguments feature I am forced to use .NET 4.0 for compiling. If I compile that way however, then Unity throws an error when accessing classes in the .dll. (Error : “Could not load type … from assembly…”).

Now I did some research and I think the reason is that Unity simply doesn’t support .NET 4.0 assemblies. However if there is a different solution to my problem, please let me know!

OK since I believe 4.0 is the problem, and 3.5 throws errors at the default arguments, I wanted to know if it’s possible to use the compiler that Unity uses. So basically what I want to achieve is, when I click build in Monodevelop, that not microsoft’s compiler is run to create my .dll, but Unity’s fork of Mono. I believe this might solve my problem, but again I’m not sure.

I’m not really sure as how you proceed to create these DLLs, as I didn’t have any real trouble creating mine DLLs.

These two links might be helpful:

http://forum.unity3d.com/threads/publishing-content-to-the-asset-store-using-dll-files.104517/#post-689272

I followed them myself, and it worked. But then again, I am not really sure what’s causing your problem.

Edit:
Oh I see, it is a version problem. I didn’t try to compile with higher .Net versions.

Unity so far supports just .NET 2.0. The development team said that they are working on a solution to the issue to support a higher version, but that is to come with Unity 5.x