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.

Comments

I use moonlight 1.9 preview in 64 bits as an xpi in my firefox 3.5... but I always see the MS logo which ask me to install Silverlight...
It seems to sadly only works with firefox 3.0...

sorry to complain me, and thanks for the tips

It sounds like Moonlight is not compatible with Firefox 3.5. Maybe you should file a bug against Moonlight?

I had similar problems with 1.9 and FF 3.5 on 64bit but everything seems fine with 1.9.0.1. Firefox didn't offer the upgrade automatically, I had to go back to the preview page and grab it myself.

Awesome! Can't wait MonoDevelop 2.2 release :)

Any word on the next MonoDevelop Mac snapshot? :D

Hi:

I followed the instructions but still get the error: could not find respack. Which I assume from looking through the src is in tools/respack.cs ?

And also even with the Moonlight SDK path exported monodevelop also has errors in References -> System.Windows (Assembly not found) and System.Windows.Browser (Assembly not found). I saw someone else commented on this problem on the Mac video for Moonlight.

Anyone help?

Oh, btw, this is in Open Suse 11.1

Are you using the trunk MonoDevelop packages? It won't work with MD 2.0.

Hi:

I used the link for the one click install -- got monodevelop 2.1.0
DL and extracted MoonSDK
Exported MOONLIGHT_2_SDK_PATH

Did I miss a step?

That looks correct. Are you sure you did the export in MonoDevlop's environment?

Cool, thanks!

You could change your spec to need the dependent packages also to be pulled. I had a older version installed along with its dependencies and this version could not work with it. I kept getting, "Invalid URI: The format of the URI could not be determined".

Thanks for the tip! I'll have to investigate that. I'm not terribly familiar with package specs; I just set it up a couple of years ago, with a script for pushing new snapshots :-)

Is it possible to use Boo language code to build a Moonlight app?

You'd have to ask the Boo compiler developers to add support for targetting the "2.1" runtime version, then we'd have to update the MonoDevelop Boo binding to use whatever new compiler flags were needed.

Will MonoDevelop 2.2 have built-in Moonlight 2 support?

It'll have the build/run and basic code completion I demoed here. I'm hoping to get more advanced capabilities in 2.4, by which time the Moonlight SDK should be officially available.

Michael,
Thank you for posting this. Following your instructions, I have successfully set up MonoDevelop with the Moonlight SDK (openSUSE 11.1).

I'd very much like to create a desktop application with a Moonlight UI, but I can't figure out how to make use of the Gtk# bindings for Moonlight. I believe the problem is that I'm missing Moonlight.Gtk.dll. Is there an SDK release that includes this file? Forgive me if I am being dense, but could you please post a quick tutorial on how to use these bindings?

Thanks again!
-Alex

Unfortunately a desktop SDK hasnt been released. You'd need a desktop version of the runtime too.

I'm hoping the Moonlight team will sort this out after they make their 2.0 release.

With many thanks to Michael, here's what's required to get the latest version of MonoDevelop (2.2.1) ready for Moonlight 2 development on Linux.

My installation was done on OpenSUSE 11.2. YMMV.

First, ensure that you're running the latest version of Mono (2.6.1) and MonoDevelop (2.2.1). Mono can be downloaded from http://www.go-mono.com/mono-downloads/download.html and MonoDevelop can be downloaded from http://monodevelop.com/Download.

With both of these installed, if you try and compile a Moonlight project from within MonoDevelop, you'll get an error stating that the Silverlight framework is not installed. Both the environment variable and the MoonSDK have changed since Michael's May 8 post, so don't install the MoonDSK as advised above. Instead, you'll have to grab the new SDK from out of the MacOSX MonoDevelop package.

If you've got a Mac nearby (as I was lucky enough to), you can grab the entire /Applications/MonoDevelop.app/Contents/MacOS/lib/moonlight
directory and place it in /usr/lib/moonlight. If you're not lucky enough to have a Mac nearby, then you'll need to use dmg2img and mount the image file to be able to extract the files. According to Michael , the moonlight team may have the necessary official Linux packages ready shortly.

Finally, I had to set the environment variable MOONLIGHT_SDK_PATH to point to /usr/lib/moonlight. I achieved this by adding the following line to my ~/.bashrc:

export MOONLIGHT_SDK_PATH=/usr/lib/moonlight

You then should be able to develop, run and debug Moonlight projects through MonoDevelop on Linux.

Happy developing!

Thanks for posting this update to my rather out-of-date instructions - hopefully this will help other people get up and running.

One note - you don't need to set MOONLIGHT_SDK_PATH if, as in your example, the SDK assemblies are in $prefix/lib/moonlight relative to the current target runtime.

Michael - I went back and double checked the requirement for having MOONLIGHT_SDK_PATH set.

Once I removed it, MonoDevelop ran as expected, so I can only put it down to my error and I stand corrected. :)

Hi, I followed the instructions on this page but when I try to build the hello moon solution I get the following error:
"Corlib too old for this runtime.
Loaded from: /usr/lib/moonlight/2.0/mscorlib.dll"
I am using monodevelop 2.4 on Arch linux x64, and extracted the moonlight folder from the mac version of
MonoDevelop-2.4.dmg
Do you have any advice as to how i can get this to work?
Thanks.

Unfortunately the Moonlight C# compiler (smcs) currently only works with a matching version of Mono (for Moonlight 2.0, likely Mono 2.6.x). You will probably have to obtain an older mono binary and patch the smcs script to use it.

Hi, I followed the instructions on this page but when I try to build the hello moon solution I get the following error:
Error: Framework 'Moonlight / Silverlight 4.0' not installed.

I used monoDevelop 2.8.1 on Mac and have moved moonlight to /usr/lib/monlight.
Do you have any advice as to how i can get this to work?

Thanks a ton for posting this update. I, too, had problems getting it all to run from a recent compile on my Ubuntu box. However, pulling the SDK out of the Mac package and moving it directly to /usr/lib/moonlight did the trick. Cheers--

For Ubuntu you need to install it.

$ sudo apt-get install monodevelop-moonlight