Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MonoDevelop for .NET application on Linux

Tags:

c#

.net

linux

mono

I need to develop C# applications, but i use Linux (ubuntu), I found MonoDevelop, but I don't understand if i can write .NET applications from Linux to use on Windows, so the development on linux and the execution on Windows. are them compatible?

On the Mono website I found:

Mono is a software platform designed to allow developers to easily create cross platform applications.

What does it means? Can I write on Linux c# applications that can run wherever the .NET framework is installed?

Thank you for the clarification

like image 403
Dail Avatar asked Feb 26 '12 22:02

Dail


3 Answers

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.

like image 75
Robert Rouhani Avatar answered Sep 30 '22 16:09

Robert Rouhani


Yes, you can use mono to create .NET applications that will run on Linux, Windows and Macs.

Mono is:

It is an open source implementation of Microsoft's .Net Framework based on the ECMA standards for C# and the Common Language Runtime.

This means that so long as you don't write code that is platform specific, you can run it on all platforms that .NET can run on. (So, instead of concatenating paths using \ or / you use Path.Combine, and instead of hardcoding linebreaks as \n you use Environment.NewLine and such).

like image 28
Oded Avatar answered Sep 30 '22 15:09

Oded


Another advantage is that the mono development tools are free. (see: http://www.mono-project.com/Main_Page)

like image 29
real_yggdrasil Avatar answered Sep 30 '22 15:09

real_yggdrasil