Thursday, July 30, 2009

Mono for .Net on Mac

I am a .Net developer and with the new Mac, Mono has been inviting me for a long time now. With my baby's (long!) nap for an hour provided me with the opportunity to try out Mono and blog about it!

Why Mono?
1. A .Net developer since I learn to code - you know how addicted you can get to VS :)
2. A new Mac enthusiast


Steps to start trying out Mono
1. Get the installable from the go-mono site.
2. Run the installer. Mono installs under /Library/Frameworks/Mono.Framework
3. Here comes the famous 'Hello World'!!

using System;
public class Hello
{
static public void Main()
{
Console.WriteLine("Hello World, Here I come");
}
}
Note: For those of us .Net developers that hadn't worked in a shell terminal for a long time now, here are some of the notes to freshen up your memory!
  1. 1. vi filename - opens the vi editor with the filename
  2. 2. to save the file - :w
  3. 3. to quit the editor - :q
  4. 4. obviously, to save and quit - :wq (although, you would have figured it by now!)
4. Compile the code with - 'gmacs hello.cs'
5. Execute the code with - 'mono hello.exe'

There you go! Your first C# program on a Mac! Though simple, doesn't it thrill you?

Bang! Bang!! - The first time I compile the program - I got the error,
"`System.Console' does not contain a definition for `Writeline'". It took a full thirty seconds to spot the reason for the error - It should have been WriteLine!! Darn, VS has us fully spoiled!


0 comments: