this looks like a job for... tomorrow!

Mono in Visual Studio 2010

One cool new feature in Visual Studio 2010 is enhanced Multi Targeting. Presumably, its all about allowing developers to target both the 2.0 and 4.0 runtimes from VS2010, but what it really means is you can easily target Mono from within Visual Studio 2010.

Like this:



To enable this, you need to unzip this file to:
C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile



Once you do that, you can take your .NET project:



Go to project properties and switch it to the Mono 2.4 Profile:



Now it will compile using Mono's assemblies, and will flag methods that Mono does not contain, like thus:



This also works for Intellisense:



And Object Browser:



We are very excited about this feature, which should make it easy for people to ensure they are staying compatible with the Mono subset of the .NET framework without leaving Visual Studio. Once VS2010 is released, we will hopefully release the profile packs as we release each Mono version!

27 comments:

Anonymous said...

Very cool, congrats.

Anonymous said...

Surely in the final product this won't require putting files under the 3.5 folder?

jpobst said...

That's actually by design. Mono is a pure subset of the .Net 3.5 framework, hence we consider it a profile of .Net 3.5. (Like the "Client Profile" is a subset of the full framework.)

You can also make a completely new framework that is not a subset of 3.5, but it is a bit more involved for no gain.

Dillie-O said...

WOW!!! I've been trying to get my feet wet with Mono for a little while now and having things THIS easy leaves me without excuse. I'm dropping this on my laptop tonight.

Keep up the great work guys. You rock!!!

Alexey Diyan said...

Thank you. This is really useful feature for all .NET developers who wants to work with Mono.

Our team is thinking about using Mono for ASP.NET Web Service which will work on Amazon EC2 instance.

EC2 now supports both Windows and Linux images, but I think that deploy/update procedure will be easier for Linux. Moreover, EC2 service has a little bit cheaper prices for Linux instances ;)

Anonymous said...

We have mutitargeting in VS2008 already.

Michael Cummings said...

If your on a 64bit OS you need to use "Program Files (x86)"

jpobst said...

@Anonymous

Yes, *Microsoft* has multitargeting in VS2008. However, it is not extensible by third parties. The new part in VS2010 is opening this up to third parties to extend.

FoxiBoy said...

Can't open form designer when targeting mono.

Error : The method or operation is not implemented.

Vgta said...

i have this error Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkType.get_RuntimeType()

how i can solved ?.

i must have mono installed ?

Vgta said...

i have this error
Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkType.get_RuntimeType()

How i cant solved?

Some special configuration on the installation of mono ?

Indebi said...

I have installed this but now it is giving me a call stack error. Here is the list it gives me

http://pastebin.com/f38829df8

Melnik Balogh said...

I can't seem to get it to work on Debian Linux 5 (lenny), any tips on how are welcome

Melnik Balogh said...

UPDATE

this is what i got in linux...

http://www.verwijs-pc.nl/shares/opensim-error_linux.txt

Trukhin Yuri said...

For 2.6.1 Mono http://cid-839f2c6bc0482ba3.skydrive.live.com/embedicon.aspx/2.6.1%20Profile

Brian Surowiec said...

Is there a working version of this for the final release of vs2010 and mono v2.6.4? I'm not having any luck when I use this profile or try to create an updated profile. If it helps I'm also not seeing the client profile options in my drop down either.

Joey said...

This is really cool stuff. I find myself in a situation where I may require mono, but really like using the visual studio tool. I haven't found any tutorials on how to make a 2.6 version of the target profile or any tutorials on target profiles for that matter. Perhaps I'm asking the wrong questions... If you have any additional references you can point me to, I'd be very greatful. Thanks.

Chris Cyvas said...

Hi Jon,

I am wondering if it is possible to do this with an ASP.NET MVC2 project? I have created a 2.6.4 profile and it works fine with Class Libraries, but on an MVC2 project, I do not get the Mono 2.6.4 Profile in the drop down selector. Any ideas or help?

Anonymous said...

I guess you aren't much on supporting your offerings. Visual Studio 2010 has been RTM for quite some time and the current version of Mono used by Mono-Tools is 2.6.6. Hmmm.. perhaps you could point me to someone who can follow up on this?

Anonymous said...

this is awesome!!!!!!!!! thanks a lot

Rob said...

Been a C# developer since 1.0 so I'm not interested in using MonoDevelop and GTK#, but a way to develop in C# and being able to deploy to Linux and Mac definitely interest me. Looks like the latest version of Mono is 2.8. Any news on when a new version will be out, or can I just pop in the new dll's, rename the folder, or ? also, does this or will it support Framework 4.0?

Greg Hurlman said...

Rob & Anon:

You can find a profile for Mono 2.8 here:

http://greghurlman.com/2010/10/23/visual-studio-2010-client-profile-for-mono-2-8/

Jason said...

Hi Greg, I installed your 2.8 profile as you directed. My VS2010 project builds fine however when I try to run it I get a .NET Framework Initialization Error, saying that I need to install this version (v4.0,Profile=Mono) of the framework. I am running on Windows7 64-bit. Any help would be appreciated!

Thanks, Jason

Phengus said...

@Jason, have you installed the MONO runtime libraries?

Rodney said...

Love the 2.4 and 2.8 profiles.

Has anyone created a 2.10.1 profile yet?

Paul said...

Does this not work for Web projects? I note that any web project I have doesn't expose the Mono option on the target drop-down, but all the class libraries work as advertised.

Markus said...

@Jason I had the same problem, the error dialog telling me I should download “.NETFramework,Version=v4.0,Profile=Mono” in order to run my application.

Creating an additional registry key did the trick for me. Since I'm running Windows 7 x64, it was:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0,Profile=Mono

I suppose for x86 it’s
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0,Profile=Mono

(Where v4.0.30319 would be the version of the current 4.0 framework installed.)

Hope that helps!