How to Run .NET Applications in Linux
The .NET Framework is a foundation for Windows systems on which to build and run modern applications. Microsoft unveiled the first release of the .NET Framework in 2002 and has been releasing enhancements for its Windows platform ever since. Because Microsoft's .NET is available only on computers running Windows, users of other operating systems like MacOS X and Linux must run their .NET applications on an alternative implementation of Microsoft's system. The Mono Project by Novell is a free, open-source solution for Linux users to run .NET applications.
Instructions
-
-
1
Install the Mono Project's utilities on your Linux system. The procedure for installing new software varies among Linux distributions. On Ubuntu Linux, type the command "sudo apt-get install mono-gmcs mono-runtime"; on Fedora Linux, use "yum-install mono-devel mono-core." Whatever your packages are named, you need the C# compiler "gmcs" and the .NET interpreter "mono."
-
2
Download the source code for your .NET application. Most .NET software is written in a language called C# (pronounced "C Sharp"). C# source code files have the ".cs" file extension.
Test your Linux system using this example C# code from a file called "test.cs":
using System;
public class CSTest {
static public void Main() {
Console.WriteLine("Testing C#");
}
}
-
-
3
Compile your C# source code. Run the "gmcs" C# compiler to produce a .NET compiled file. If your file is named "test.cs," then type the command "gmcs test.cs."
-
4
Type the command "mono test.exe" to run your .NET application. Replace "test.exe" with the name of your application.
-
1
Tips & Warnings
Just as you can install the Mono Project to run .NET applications on your Linux system, you can use the Apache mod_mono module to run ASP.NET applications on the Internet.
Microsoft's implementation of the .NET Framework is the only official implementation. Although you can run your .NET applications using the Mono Project's tools, you must test thoroughly to make sure your programs work correctly.