Developing Silverlight Apps on Linux and MacOS with Moonlight

by Miguel de Icaza

Earlier this week I promised I would blog about how to build Silverlight apps in Linux. Michael beat me to this and did a couple of screencasts.

In Moonlight Development in Linux with MonoDevelop he walks us through the steps necessary to install the Moonlight SDK on top of Mono 2.4 and using MonoDevelop to create your app. Once you get these installed, here is how you get started with development:

To render this content, you need Silverlight or Moonlight Preview or Silverlight

MonoDevelop will provide auto-complete for the Silverlight APIs and also provide auto-complete in XAML files.

In addition to Linux, you can also use MonoDevelop on OSX to do the same thing. We shipped Moonlight's SDK as part of the MonoDevelop/OSX release, the result runs with Microsoft's Silverlight.

Michael again talks about it and produced a nice screencast:


Posted on 08 May 2009

I, for one, welcome our new SH4 embedded overlords.

by Miguel de Icaza

ST Microelectronics, the maintainers of GCC-CIL (the GCC code generator backend that produces ECMA CIL bytecodes for Mono/.NET) have announced their port of Mono to the SH4 platform.

The code is currently available from

In addition to the MIPS64 port that I mentioned last week from SiCortex/nIX is now being merged into Mono's repository.

MIPS apparently is not only used in super computers, but apparently is also powering $169 dollar netbooks.

Posted on 07 May 2009

Mono talk at the Beantown.NET Users Group

by Miguel de Icaza

Tomorrow, Joseph, Michael, Gonzalo and myself will be talking at the Beantown.NET Users Group about Mono, Moonlight and MonoDevelop at 6pm.

If you are in the Boston area, come join us for these open source festivities at Microsoft NERD center in Cambridge.

Posted on 06 May 2009


by Miguel de Icaza

Dana Blankenhorn comments on the the Moonlight 2.0 release and says:

It's the kind of open source success story Microsoft wants publicized. Microsoft innovates, open source copies.

It's not the kind of open source story open source needs, however.

What open source needs is real innovation, created by teams who may or may not represent Microsoft's fierce competitors. This can be hard to deliver, and Microsoft would like us all to know resistance in this case is futile.

A few points.

First: Moonlight's core is designed to ensure that Linux users get access to content that is produced for Silverlight on the web.

This is about making sure that Linux (and for that matter any other system where Moonlight can be compiled) does not become a second class citizen on the web.

Folks will argue all day whether the Silverlight model is the right one; whether it is gaining adoption; whether it is necessary; whether it is part of the open web.

But none of that matters when trying to access content on Linux: it is either possible to use it, or not. And having a working relationship with Microsoft allows us to bring it to Linux.

Second: Dana is looking in all the wrong places for innovation. If he wants to see my team's work that deviates from the set of APIs that Microsoft has created, he could look at our work on SIMD; our interactive C#; Static compilation technology to support things like the iPhone; our cross platform MonoDevelop (Linux, OSX, Windows); Our Gtk# API for building the above; He could look at all of our Mono.* classes, or all of the libraries and APIs produced by our community (Mono.Addins, Mono.Nat, Mono.ZeroConf, BitSharp, Cecil, CocoaSharp, MonoObjc, Crimson, and some forty others; I just got tired of going through the list here and here).

All of these created to solve a particular problem with the tools that we had on the platform we used.

Or for that matter, even reading the announcements on my blog.

Or he could look elsewhere in the vast universe of open source projects for ideas that match his definition of innovation. Not everything that is built in the open source world has to be about innovating in a completely new direction.

Third, and most important one: The definition of Innovation.


Most people that discuss innovation have not even bothered to actually think about what this means in the first place. And I am particularly bothered when people claim that open source does not innovate, but can only copy.

Google's define:innovation is a good starting point.

Are Ideas Innovations? Everyone has ideas, even great ideas. Every day you go to lunch, every day you are taking a shower, every day you are walking alone and thinking you are having new ideas.

You can have a million ideas, and these might be innovative, but if they do not reach the world, did they matter?

For an idea or an innovation to have a practical effect, they need to go beyond the discussion at the lunch table with your friends and become a reality.

Bringing an Idea to Life Once I sit down and turn my idea into an actual tangible result there are a number of hurdles in my path.

The idea must be good enough for people to try out, I must get it distributed, and I must get people to use it.

Being first versus being to market first: It does not matter that many great ideas originate in the open source world or at the lunch table with your friends. You must bring the ideas to the public and the public must be in a position to adopt it.

For instance, Compaq/Digital were showing portable MP3 players based on Linux years before the iPod took the world by storm. Yet, nobody remembers these devices anymore and Apple gets the credit for bringing digital audio to the masses.

Or tagging and searching your email. GMail uses it today, but few people remember that the idea had been implemented before in Digital's Pachyderm.

Many ideas might originate as personal prototypes or even open source prototypes, but without a distribution channel and an ecosystem that would sustain the innovation many of those ideas exist merely to be replaced by folks in a better position to market/distribute it.

Claiming "I had the idea first" or "we were the first ones" is of little consolation if someone out-executes and out-markets you.

Definitions of Innovation: Wikipedia (as of 10 seconds ago) defines Innovation as:

The term innovation means a new way of doing something. It may refer to incremental, radical, and revolutionary changes in thinking, products, processes, or organizations. A distinction is typically made between invention, an idea made manifest, and innovation, ideas applied successfully.

I also like this one (from Google's define: too):

Innovation is the process that translates knowledge into economic growth and social well-being. It encompasses a series of scientific, technological, organizational, financial and commercial activities.

I think that Moonlight fits this definition perfectly well in that case.

Moonlight and Innovation

Sure, we do follow the APIs that Microsoft set for Silverlight.

But we have innovated in a number of ways:

  • We innovate in the development process: we are an open source project, taking contributions and consuming other open source components.

    We dogfood other FOSS components, and we iterate to improve them.

    In 1999, the MIT Technology Review magazine named me the innovator of the year. In the award ceremony, Bob Metcalfe said that I was receiving the award for the work on Gnome, not because Gnome was a ground-breaking system, but because the goals and processes of Gnome were.

  • We innovate in our cross-platform stance: Moonlight runs on more platforms (although admittedly, with a smaller market share than Windows and MacOS).
  • We had out-of-browser support before Silverlight did: Sure it was trivial, but we had it before (see above note on futility of claiming "we were here first").
  • Working with Microsoft: Ok, this is a bit of a stretch to claim as innovation, but here it goes: I am very proud that we are finding ways of working with a company that for many years resisted Linux and open source as well as helping Microsoft with all of its inertia become more open source friendly.
  • Update: Mats on the comments points out something that I wish I had thought of when I wrote this: "Innovation is also, and I'd say mostly if history teaches us anything, about building and improving upon ideas - not just making new ones from scratch."

We (the Mono/Moonlight team) are not Dana's beacon of revolutionary change. But it is no secret that we are fans of the CLI virtual machine, and we believe that giving developers this platform will help them turn their ideas into innovations by giving them the best technologies available.

Users of Mono and Moonlight have already demonstrated that they have way better ideas than I have ever had. And they already have used Mono in brilliant ways. Dana might want to check my blog more periodically to take note of those innovations.

Posted on 06 May 2009

MonoDevelop on MacOS X

by Miguel de Icaza

Good news for all OSX users, a build of MonoDevelop that integrates with OSX is now available:

MonoDevelop OSX-ified.

For the impatient among you, click and run

It requires Mono 2.4 for OSX, on the upside, you can use this to develop ASP.NET MVC apps on the Mac.

Some Background

Back in February I showed a screenshot of MonoDevelop 2.0 for the Mac, it looked like this:

Super-Alpha-Preview of MonoDevelop on OSX.

It was basically the Gtk# based MonoDevelop IDE binary executing on the Mac. There was no porting involved, just the same executable running under Mono/OSX. The code works, but it did not feel like a Mac app:

  • The Menu bar was embedded in the window.
  • The keyboard accelerators were the Linux ones. They felt unnatural for OSX users, and also did not take advantage of the spare key (Command) to liberate the control key for other uses.
  • The editor behaved like a Linux editor.

There is a vibrant Mono on OSX community out there, and it will only grow larger. We wanted to make sure that all of the work that is going into creating a great IDE is available for folks on the Mac in a way that is actually comfortable to use.

So working with folks in the Mac Community and with folks at Unity Michael has been working on tuning up MonoDevelop on the Mac to become an editor that does not get in the way of Mac users and developers and integrates better from the "feel" perspective with other tools in the OS.

For instance, not only does the new MonoDevelop for MacOS use the Mac menu bar, and the Mac accelerators (a combination of XCode and Textmate accelerators), but even the text editor has been altered to support the way selection and navigation works on the Mac.

I figured that for every 100 users of MonoDevelop one of them will contribute patches back to the effort. If you happen to be that 1% hacker that will contribute back, you might want to look at a list of ideas to improve MonoDevelop on the Mac.

MonoDevelop on Windows.

MonoDevelop on Windows is on a similar boat: the 2.0 release works "out of the box" on Windows, but again, it is a GNOME IDE in a Windows land.

Stay tuned for news from the MonoDevelop community as to what will happen there.

Update: Lluis posted an update on the progress of MonoDevelop on Windows.

Posted on 05 May 2009

Smooth Streaming with Moonlight

by Miguel de Icaza

I never tested Smooth Streaming before, just the more basic media tests, but the Smooth Streaming stack is running with our Moonlight preview:

You can see a few rendering glitches for the controls on the screen. But this is really good news for our new media pipeline.

Posted on 05 May 2009

First Moonlight 2.0 Preview is Out

by Miguel de Icaza

After a loving incubation period, the Moonlight 2.0 preview, an open source implementation of Microsoft's Silverlight for Linux has been released:

This is really the release I have been looking for since Microsoft first introduced Silverlight 1.1 and ever since our 21-day hack-a-thon to bring Silverlight to Linux.

This is the ECMA VM running inside the browser and powering C# and any other CIL-compatible languages like Ruby, Python and Boo. You can use Moonlight/Silverlight as a GUI (this is what most folks do) or you can use it as the engine to power your Python/Ruby scripting in the browser.

Installing Moonlight 1.9

Go to our preview page, select the platform and hit the download icon.

That will download and install the plugin in your Firefox installation. You can then restart the browser, and you should see this:

Then you can try out some of the test web sites we have been working on. This is CNN's The Moment that uses Silverlight/Photosynth:

If instead of binaries you want to build Moonlight in the comfort of your own living room while sipping margaritas, fetch the source code for mono, mcs, mono-basic and moon from the branch and build them in this order: mono, mono-basic and moon.

While one hand holds your margarita, use the other one to follow the instructions on how to compile Mono from SVN.

Some Notes on this Release

Now some qualifications to this release:

This is a preview release. By this we mean that we are not yet feature complete with Silverlight 2.0 feature-to-feature but we are relatively close. For example, we do not yet pass the entire Silverlight GUI 2.0 test suite that was provided to us by Microsoft and you can spot glitches in various web sites.

Security Sandbox: One of the reasons we delayed the first preview of Moonlight for public consumption was that we did not want to release Moonlight without the security sandbox. In the pre-Moonlight days there was no reason for Mono to implement a security sandbox, so we never had it. With Moonlight a security sandbox is mandatory so we implemented it.

Moonlight 2.0 ships with the new CoreCLR Sandbox that was introduced in Silverlight 2.0. This security system is very easy to understand, it is pretty straightforward and is a lot easier to secure and audit than something like CAS. I will blog about the security stack in another post.

But even if we now have a security sandbox , we have not completed the security audit.

Weekly Releases: Our current plan is to update the plugin once a week during this preview/alpha period hoping that we can get good bug reports and to ensure that we work in as many Linux distributions as possible.

Debug Builds: During the preview/alpha cycle we are shipping our code with debugging symbols hoping that this will improve the quality of the bug reports that we receive. This means that the plugin size instead of being 3.9 megs is 8.8 megs on average. This will change when we do the final release.

The Cool Toys

There are a number of cool toys on this release, the foundation for many things to come. Here are some:

Silverlight Unix SDK: If you install Mono 2.4 and Moonlight SDK (not the browser plugin, but the -devel package) you can now develop Silverlight applications entirely in Unix.

In fact when you install Eclipse4SL (a Microsoft sponsored project) you need Mono 2.4 to build Silverlight apps. With the Moonlight SDK you can skip an entire step by having the SDK assemblies present at installation time.

I will do another blog on how to build Silverlight apps from the ground up on Unix using the Moonlight SDK.

Microsoft MS-PL Controls: Instead of reimplementing the high-level controls (buttons, Checkboxes, listboxes, containers, calendars, datepickers, sliders) or the very advanced controls (like a full database bound datagrid) Moonlight reuses Microsoft's open sourced Silverlight controls.

Iron* Languages: In addition to C# you can run code written in a variety of programming languages that target the ECMA CLI. In particular dynamic languages.

IronRuby and IronPython are open source implementations of Ruby and Python done by Microsoft that can be used in Silverlight but you can also use a variety of other languages in the browser like Visual Basic or PHP (Phalanger).

Visual Basic Runtime: This is just a plug for the work that Mainsoft did a few years ago. One of the things that Silverlight ships with is a Visual Basic class library for all the VB helper functions.

Mainsoft contributed a few years ago a VB runtime written entirely in VB

We ship a "tuned" version of their assemblies as part of the Moonlight release.

Adaptive Streaming: This also deserves a blog entry of its own. In addition to the support for HTTP-Streaming (to support seeking and stream quality selection) Silverlight allows developers to create their own transports to fetch media and not be limited by HTTP.

For instance, a developer could write a transport that fetches different bits of the media from different servers. Or use bittorrent to fetch the media instead of depending on a single server. More in an upcoming blog entry.

DeepZoom: with all of the bells and whistles that you expect.

Hard Rock Memorabilia on Moonlight/Linux.

Silverlight 3.0 APIs: As we were implementing the 2.0 APIs a handful of features from 3.0 fit naturally into our design. So instead of going the extra mile to limit things in 2.0, we just expose the 3.0 APIs in a forward-compatible fashion.

This Moonlight preview includes a few 3.0 features:

  • Out-of-browser support (although this is currently a manual process, not yet automated, and without a GUI).
  • WritableBitmap class.
  • 3.0 pluggable media pipeline.
  • SaveDialog support.

There are more details see Chris Toshok's blog entry.

The pluggable media framework is very exciting to us, because it means that developers can author their own codecs without waiting for Silverlight or Moonlight to add support for it.

We have developed a handful of open source codecs for Dirac, Vorbis and ADPCM that can be used with Silverlight 3/Moonlight Preview based on existing C# and Java implementations. Hopefully someone will help us fill in the blanks with more codecs (like Theora).

For up-to-date news check out our README file.

In the words of Paris Jobs, this release is nothing short of hawt.

Moonlight Twitteristas

If you want to follow the progress of various Moonlight activities on Twitter, you can follow these folks:

  • moonproject: the twitter account for project news.
  • kumpera: in charge of the Mono metadata and IL verifier and creator of Mono.SIMD.
  • spouliot: Mono's security and cryptography Czar and graphics hacker.
  • lewing: Moonlight core hacker, in charge of Moonlight's layout and performance and also the creator of the Linux logo and co-developer of F-Spot.
  • toshok: Moonlight team leader and maintainer of the core of Moonlight. ex-Winforms team lead.
  • jbevain: In charge of the Silverlight 2.1 API, Mono's Linker and Cecil.
  • kangamono: Codec hacker, hard-problem solver, iPhone support, Mono on Mac.
  • atsushi_eno: XML, LINQ to XML, WCF and pluggable codec author.
  • sh4na: Recovering winformista, in charge of the new toggle ref implementation and the Moonlight/Javascript bridge.
  • rolfkvinge: media pipeline, visual basic runtime, vbnc compiler (Mono's VB compiler written in VB).
  • jstedfast: text layout engine, and ex-Evolution hacker.
  • jacksonh: All things XAML, a recovering Winformista/Ilasm-ista. A must-follow twitterista, considering that even Aimee_b_loved follows him.
  • rustyhowell: release engineering.

Some of the team members are not twitteristas yet.

Alternatively, if you are not really into twitter, you can always check our aggregated blogs at monologue.

Posted on 04 May 2009

Interactive C# Code Completion

by Miguel de Icaza

Last month I introduced code completion in Mono's Interactive C# shell. You can use the TAB key to auto-complete at the current cursor position. Pressing the TAB key twice will list all possible completions.

This should make the csharp more pleasurable to use and for bash junkies like me a more natural fit.

This is particularly useful to explore an API like Gtk#:

	csharp> LoadPackage ("gtk-sharp-2.0");
	csharp> using Gtk;
	csharp> Application.Init ();
	csharp> var w = new Window ("Hello");
	csharp> w.SetF[tab]
	SetFlag SetFocus SetFrameDimensions
	csharp> w.SetFo[tab]
	csharp> w.SetFocus ();

This comes in quite handy for completing namespaces, types and valid methods. It works with the C# 3.0 initializer syntax as well, that one is useful in Silverlight for those of us that can not stand to type XAML instead of C#:

	csharp> new TextBlock () { Bac[tab]

Does the nice:

	csharp> new TextBlock () { Background

Bonus points: another tab at that point inserts the equal sign to assign the value.

This was done by extending the Mono.CSharp.Evaluator API to provide code completion.

The API is fairly simple:

public static string [] GetCompletions (string input, out string prefix)

This will provide possible completions (methods, properties, fields) that are valid at that point in the string.

A discussion that details the implementation of how the compiler supports code completion is in the mailing list and our compiler documentation has been updated to include a tutorial on expanding code completion.

The next step is to implement this for the interactive GUI shell.

Posted on 28 Apr 2009

Gtk# 2.12.8 Installer for Windows

by Miguel de Icaza

Mike Kestner yesterday announced the availability of the new Gtk# installer for Windows.

A few good news: the entire stack (Gtk+, Cairo and Gtk#) comes in a nice 8 meg download, it is packaged as an MSI and it is now signed by Novell's certificate, so you no longer get a scary "Unknown Publisher" dingus on the screen.

This is the equivalent of the greek god Prometheus giving fire to humans.

We are giving Windows developers a nice cross-platform toolkit that is nicely integrated into Visual Studio. To try a sample application using it, you can download Tomboy, load the Tomboy.sln solution, hit F5 and enjoy.

Posted on 22 Apr 2009

PseudoTerminal class

by Miguel de Icaza

As a follow up to yesterday's post I did the "hard work" of cut-and-pasting the VTE pseudo-terminal support+gnome-pty-helper into an independent module and wrote a managed binding for the code, autoconf-ified it and put it on SVN.

Code lives in the pty-sharp module, or you can get a tarball.

Now someone needs to do the trivial hack of writing the Mono terminal emulator.

Posted on 21 Apr 2009

« Newer entries | Older entries »