Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running .NET 4 application with Mono

I'm trying to run a .NET exe on a Ubuntu machine (I installed the package mono-complete), so far with no luck. The application is compiled with Visual C# Express 2010 under .NET 4 (Client Profile).

I try executing the program with the following command:

mono application.exe

However, I get the following error:

WARNING: The runtime version supported by this application is unavailable. Using default runtime: v1.1.4322

** (application.exe:5586): WARNING **: Missing method System.Windows.Forms.Application::SetCompatibleTextRenderingDefault(bool) in assembly /usr/lib/mono/gac/System.Windows.Forms/1.0.5000.0__b77a5c561934e089/System.Windows.Forms.dll, referenced in assembly /media/disk/application.exe

Unhandled Exception: System.MissingMethodException: Method not found: 'System.Windows.Forms.Application.SetCompatibleTextRenderingDefault'.

It's suppose to be using .NET 4, not 1, but I don't know how to set it. I tried

mono --runtime=4.0.30319.1 application.exe

But that didn't work either.

Any help would be appreciated.

like image 582
Tim Cooper Avatar asked Mar 16 '11 15:03

Tim Cooper


1 Answers

Sounds like you're experiencing this bug:

My Doc's Got No Nodes: .net 4 Client Profile on Mono 2.8

That is assuming you installed > Mono 2.8 (which was the first release to support .NET 4.0). If not, you should install a more recent Mono package.

The other thing to keep in mind is that Mono doesn't support the entirety of WinForms. Unless you developed your application with Mono in mind, there's a good chance you'll find that something you used isn't supported.

like image 60
Justin Niessner Avatar answered Oct 17 '22 23:10

Justin Niessner