Journal for May 2009

Moonlight Development on Linux with MonoDevelop

Yesterday I made a screencast demonstrating Moonlight Development on Mac using MonoDevelop. Today, I bring you the same thing on Linux:

Downloadable OGV version

Unfortunately, getting this running isn't quite as simple as the Mac installer. However, if you're on openSUSE/SLED, it's almost as easy, using my trunk MonoDevelop packages from the openSUSE build service (1-click install for openSUSE 11.1).

You just have to download and extract my Moonlight SDK, extract it somewhere, then tell MonoDevelop where it using the MOONLIGHT_2_SDK_PATH environment variable:

export MOONLIGHT_2_SDK_PATH=/full/path/to/MoonSDK
monodevelop

If you don't have openSUSE/SLED, you'll have to use the Mono 2.4 VMWare image or build MonoDevelop from trunk. If you build MonoDevelop from trunk, I suggest not installing it, and instead using "make run". If you don't even have Mono 2.4, you'll need to build that too, and please use a parallel environment if you don't want to risk messing your system up with hard-to-diagnose problems.

Moonlight Development on Mac using MonoDevelop

Yesterday I announced much-improved MonoDevelop preview builds for Mac, which include ASP.NET MVC support out-of-the-box. However, there was a little surprise in that build that I didn't mention — full support for building and running Silverlight projects using a bundled copy of the Moonlight SDK.

I created a screencast to show off how easy this makes it to develop Silverlight apps on the Mac:

Screencast

Note that, as I said before, this is an alpha preview release of MonoDevelop, but I feel that it's already very usable. After seeing the screencast, I'm sure you'll agree. Download it from the Mac Preview page on the MonoDevelop website.

The Moonlight support in MonoDevelop trunk is entirely functional on Linux too, but it's not so easy to get it running since you need to build and install the Moonlight stack from source, and I would strongly advise against doing this unless you're comfortable with setting up a Parallel Mono Environment. However, it's easy if you use a binary Moonlight SDK like the Mac package does, and tomorrow I'll blog about how to do this with my MonoDevelop trunk packages for openSUSE.

I wrote much of the Silverlight/Moonlight project support code in the lead-up to the 2008 PDC, but the Moonlight 2.0 toolchain and runtime wasn't complete enough to make it worthwhile for me to finish the build/run support, so I focussed on other things, and we quietly dropped the addin from the MonoDevelop 2.0 release. On Friday, with the first Moonlight 2.0 preview and Mac MonoDevelop preview looming, I decided to finish it off, and did so over that afternoon and the weekend. I spent Monday and Tuesday polishing it and making it possible to bundle the Moonlight SDK in the MonoDevelop app.

It still needs work — the XAML completion in particular is a quick hack I put together one evening during PDC — but I believe that it's already a great way to build your Silverlight apps quickly and easily!

MonoDevelop Mac Preview Builds

The past few weeks I've been working on improving the MonoDevelop experience on the Mac, making it integrate better with the Mac experience. Along with ASP.NET MVC support and other soon-to be-announced excitement, I think this makes MonoDevelop much more interesting for Mac users.

MonoDevelop with Mac main menu support

Among other things, I have:

  • Abstracted out the main menu and reimplemented it as a native Mac global menu.
  • Added handlers for Mac events, such as Quit, Dock Click, Open Files, etc.
  • Added Mac-specific command accelerators.
  • Made it possible to capture the Mac Command and Option keyboard modifiers for accelerators.
  • Made accelerators display everywhere using Mac-style glyphs.
  • Tweaked the text editor's caret and selection navigation to behave more like a Mac IDE, including Alt/Control word/subword splitting.

This has been made difficult by the native GTK+ Mac. Although the basics work very well, there are substantial problems with some of the more advanced things we do, such as key capturing for accelerators, and custom widgets. In the future we will be fixing issues upstream and shipping patched GTK+ builds with Mono, but for now I've been focussing on making everything work with the released Mono 2.4.

To do much of this, I had to build a large set of Carbon P/Invoke signatures and wrappers, and getting these right took some time. It seems to me that this could be the basis of a "Mac Bridge" in the style of the Vista Bridge. Having such managed wrappers would make it easier for developers to make their apps integrate more closely with the unique aspects of various platforms.

This work will be released in MonoDevelop 2.2. Right now it's not finished, and is very much an alpha. However, since it's already a substantial improvement for Mac users, I am making available a Mac preview build. This is a trunk build that has undergone no QA testing. I simply update it whenever I feel that trunk is usable and bugfixes or improvements have been made since the previous build. Use at your own risk. I have already listed a number of known issues.

Download it from the Mac Preview page on the MonoDevelop website.

If you do run into problems that aren't on the known issues list, please file bug reports. And, as ever, contributions are more than welcome.