Compile for Windows on Linux Using Monodevelop

Compile for windows on linux using MonoDevelop

You have to have the exact version of Mono installed on the target machine or a matching version of .NET Framework (i.e. if you compiled against Mono 2.10.x, you'll most probably need .NET 4.0). Otherwise you'll get that exact error message.

Monodevelop extra g++ compiler options on linux

In monodevelop 4 and up, you can add custom compiler options such as -std=c++11 and so forth. To do this, you'll need the latest MonoDevelop installed, you can compile it manually from github or install it from the Ubuntu PPA http://ppa.launchpad.net/v-kukol/mono-testing/ubuntu .

After you have it installed, all you have to do is go to Project > 'Project Name' Options and go to Build > Code Generation and add the compiler options where it says Extra Compiler Options.

How to build x64 with monodevelop?

Use the any cpu configuration

You'll get x64 on a 64-bit operating system, x86 on a 32-bit operating system. Automagic provided by the just-in-time compiler.

BUT On windows x86 with anycpu there is no problem. Using windows x64 will crash becaus gtk-sharp has no x64 build. So on windows x64 you have to build x86.

How to run Mono application on Windows properly?

Like Symon said, you have to build your project on the operating system you're intending it to be be compiled for because of the resources (API's etc.) that specific operating system is loaded with.

When I have a problem like this, I simply use a virtual machine software like VirtualBox or VMware to run Windows and then install and run MonoDevelop inside of Windows. Don't worry about the expensive cost of Windows, for you can just get Windows from Microsoft's website here. There will be a little watermark in the corner of the screen because you didn't pay for the copy, but everything is still totally legal and fit for software development.

UPDATE:
A better method to do this is to install the GTK# dependencies and then recompile the program.

MonoDevelop for .NET application on Linux

Any C# code you compile from MonoDevelop or anywhere else can be run on any platform with either Mono or the .NET Framework. As long as the linux system has Mono installed, it can run any compiled C# application, including .exe's copied from a Windows machine.

The reason for this is that when you compile a C# application, it's not being compiled to native system code, it's being compiled to CIL. When you run the program, it automatically JIT compiles your code for the system it's running on, leaving the original executable intact. Both the .NET Framework on Windows and Mono on everything else can read and compile the CIL bytecode.

And one thing to keep in mind, Mono doesn't have the entire .NET Framework stack available. Almost all of the BCL is intact, but libraries like WPF are not available on Mono. Mono recommends you use GTK# for your GUIs.



Related Topics



Leave a reply



Submit