Developing in C# from OS X using MonoDevelop

Screen Shot 2013-04-11 at 8.06.44 AM

 

IMPORTANT NOTE – The .NET client libraries have had significant updates since this post was written. Please read this POST for the updated information.

Before we begin, you can get MonoDevelop from here: MonoDevelop

I have been playing a little bit with MonoDevelop as an alternative to running a VM from OS X for C# development. After spending a little time with it, MonoDevelop really isn’t that bad…

(I can hear the *hissing* from naysayers)

… Really!  It’s not Visual Studio, mind you, but it’s still a great IDE.  For OS X, the latest versions have pretty awesome coverage of the .NET 4.0 specification and C# 4. Even a good portion of the .NET 4.5 specification is supported and C# 5 is on the way!

I’ll go over a few things that I really like and don’t like about the experience so far.

The Good

Code completion is extremely boss in MonoDevelop.  Here you can see the type-ahead completion and extracted documentation rendering in the IDE while I code:

Screen Shot 2013-04-10 at 4.54.11 PM

I love this type of code completion.  Even the most tepid command-line programmers can’t poo-poo this kind of functionality.

 

The Solution View – navigating your files

Next, the IDE does this wonderful thing where only one project is open at a time and provides a clear “solution” view as well as other useful perspectives for viewing, editing, and debugging projects.

Screen Shot 2013-04-10 at 5.16.19 PM

Just like Visual Studio, you can see all of the projects and resources associated with your solution and can easily manage them. Projects unrelated to what you are doing are not cluttering your workspace and sucking up valuable space in your IDE.

Debugging

Here you can see code with a breakpoint and interactive debugging being performed from MonoDevelop, it’s very slick!

Screen Shot 2013-04-10 at 5.23.08 PM

Here you can see the watch and immediate windows, you might exclaim, “I can’t believe it’s not Visual Studio! Same great taste!”

Screen Shot 2013-04-10 at 5.27.20 PM

Overall, the MonoDevelop team has the basics covered and much more, even approaching into addressing all the “nice to have” things as well.

The Bad

Some core library and developer functionality just plain isn’t there.  I’m not sure if it’s Mono, MonoDevelop, OS X, or gremlins, but there are certain times that you will see things like this:

Screen Shot 2013-04-10 at 5.31.15 PM

 

Most of the time, this doesn’t affect you, the coverage that you get on the Mono platform is surprisingly good.

The Ugly

If you are trying to run newer versions of MonoDevelop on a Ubuntu distribution, you’re gonna have a bad time. The latest official version of Mono that ships in Ubuntu is 2.08 and I don’t know how long it will be until official support will be available for newer versions – I’m looking at you versions 2.11+, which include native support for Entity Framework.

Regardless of your Mono version, you will sometimes have to do weird things to get your code working. This could be due to programmer laziness because Visual Studio is basically cruise control + autopilot for programmers or it could be due to the very heterogeneous environments in which Mono(Develop) runs in. Regardless of the cause, you have to do some magic bone waving in order to get your project running if you created it on Windows with Visual Studio.

Using MonoDevelop in practice

Speaking of magic bone waving, I got the Google+ C#/.NET Quickstart working from MonoDevelop on OS X! I only had to do one little trick to get DotNetOpenAuth to stop complaining… the following steps should be enough to get you going:

Follow the same instructions as the quickstart except:

When you run the sample, the server will not by default go to the http://localhost:4567/signin.aspx page. Instead, it will load on the default development port, 8080, and will navigate to index.html the template file used for the project. The easiest way to get around these two things:

  • Add http://localhost:8080 to your project in the Google APIs console
  • Manually enter the URL http://localhost:8080 into your browser when the code runs

That’s it!

Feel free to let me know what you think of MonoDevelop and whether you have any tips for using it, my first foray into using it has shown this to be a very promising, intuitive, and clean IDE. If only I could develop and manage Java projects with such a nice UI and the wonderful code completion and documentation integration…