Getting started with Mono in Linux

Some instructions on how to get started with using Mono in Linux environments: from installation to running your first "Hello World!" example. Open up your terminal and issue the following commands: [code language="text"] sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF [/code] Mono1 [code language="text"] echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list [/code] Mono2 [code language="text"] sudo apt-get update [/code] Mono3 [code language="text"] sudo apt-get install Mono-Complete [/code] Mono4 Check that your Mono has installed by using the 'version' command: [code language="text"] mono --version [/code] Mono5 We can now test our installation of Mono by writing some code, in this case the proverbial "Hello World!" example. Open a text editor of your choice and enter the following C# code: [code language="csharp"] using System; namespace MonoExample { public class HelloWorld { public static void Main(string[] args) { Console.WriteLine("Hello World"); } } } [/code] After saving your code sample eg as 'main.cs', using the terminal once more, compile the code by navigating to its location and running the command [code language="text"] mcs main.cs [/code] Mono6 Finally, to run the 'main.exe' that gets generated use the 'mono' command: [code language="text"] mono main.exe [/code] Mono7

Comments

Popular posts from this blog

Using the Supervisor Controller Pattern to access View controls in MVVM

Getting started with Tesseract optical character recognition (OCR) library in Visual Studio

How to send an e-mail via Google SMTP using C#