devxlogo

Moonlight Feels Right for Mono 2.6

Moonlight Feels Right for Mono 2.6

The latest version of Mono 2.6 and the Mono Graphical editor MonoDevelop 2.2 was released in December, and with this version Mono is now more compatible with regards to Microsoft .NET 3.5 API’s.

This version also includes open sourced ASP.NET MVC, ASP.NET AJAX, and Microsoft’s Dynamic Language Runtime. The latest version of Mono 2.6 and MonoDevelop installers can be downloaded at http://www.go-mono.com/mono-downloads/download.html. Source code can be downloaded here.

Recent changes in the Mono 2.6 framework include the following.

      * LINQ to SQL (in System.Data.Linq.dll) development and testing is finished in this edition, so developers can now use this now.
      * Released new Mono Soft Debugger. This soft debugger is a component of the Mono runtime environment. The physical component Debugger.Soft.dll API with different IDEs can be used to communicate with the target source.
      * Mono Framework 2.6 will now partially support C# 4.0.
      * New functionality has been added to the System.Core. Dynamic language runtime (DLR) can now be distributed separately as part of .NET 4.0 profiler.
      * Bug fixes for the Winforms completed and tested. Mono implementation of MSBuild is now added with the latest release: XBuild.
      * Support of Generics has been improved. The documentation tool for mono that is Monodoc has been updated and several bugs have been fixed.
      * System.IO.Packaging was not part of the Mono Core Framework. In the old version it was part of Olive (add-on libraries for the Mono core) Library, but with this version its part of Core Mono framework.
      * In the previous versions of Mono, Windows Communication Foundation (WCF) was not part of the core framework. It was part of experimental development more specifically under the .NET Compatibility Stack. From this version of Mono, it’s now part of Core Mono Framework.
    * The Microsoft Silverlight 2.0 components have been exposed by Mono as Moonlight 2.0. As of now, Moonlight 2.0 is supported for 32 and 64 bit Linux operating systems only. In this article we will be discussing Moonlight 2.0 and its features.

If you don’t know what Silverlight is, Microsoft describes it like so: “Silverlight is a cross-browser, cross-platform, and cross-device browser plug-in that helps developers design, develop, and deliver applications and experiences on the Web.”

Moonlight History

Moonlight version 1.0 was released in February 2009, and it was compatible with Microsoft Silverlight 1.0. It was fully based on C and C++ language no .NET language was supported, but developers can do client side scripting using Java Script.

Moonlight 2.0 is a Silverlight 2.0 compatible framework that supports Zoom, Control Framework and Layout Framework. Its C# and other DLR (Dynamic Library Runtime) based. Moonlight 2.0 can also play Audio and Video files. Upcoming versions of Moonlight will support 3D graphics, webcams, microphone etc.

Moonlight 2.0 Components and Dependencies

As of now, Moonlight is supported for Linux and other Unix/X11 operating systems — no implementation for the Windows platform has been released. The Moonlight 2.0 Package can be downloaded at http://www.go-mono.com/moonlight/download.aspx, and the latest source code can be downloaded at http://ftp.novell.com/pub/mono/sources/moon/2.0/.

Moonlight 2.0 has some external dependencies.

1. Gtk+ 2.0 development package will be required for Moonlight developers.

2. ffmpeg from SVN. The source code can be downloaded at http://ffmpeg.org/download.html. This package is required if you want to play media files only.

3. XULRunner development package. This is required for the client environment browser. The Mozilla package is required if developers want to develop browser-based plug-ins.

4. Alsa and/or PulseAudio development packages. See below for the component architecture for Moonlight 2.0 Framework.

Moonlight Version 2.0 Development

Moonlight Framework is used for:

      * As part of the Moonlight Web Plugin, to render online Silverlight content for Mozilla.
    * As a standalone library to create desktop applications for Linux that can use the Silverlight API.

The Web version of Moonlight 2.0 uses the same assembly versions, APIs, and signatures that Microsoft Sliverlight uses. When developers develop a desktop-based application with Moonlight, they then can get access to all the standard Microsoft .NET 3.5 API’s, libraries, and assemblies. Presently, Moonlight for Desktop-based applications are limited to the Gtk+ toolkit only, but there are plans to create more bridges between the cross platform in the near future. Moonlight is basically an extending of the standard .NET developer APIs with few new assemblies required for Windows-based development. System.Windows.dll

System.Windows.Browser.dll

System.Windows.Controls.dll

System.Windows.Controls.Data.dll

Also For GTK Moonlight.Gtk.dll assembly is used.

Moonlight 2.0 Setup for Development Environment

If you have downloaded the Moonlight and other dependent components correctly and installed them in your development box, there should not be any issue. But if the installer is not available or you faced an issue during installation, you have to build Mono and Moonlight from the source code. See the following sections that explain how to get this ready.

Write the following command in the command prompt to verify Moonlight libraries are properly installed.

$ pkg-config --modversion silverdesktop1.9.0.99Output?Package foo was not found in the pkg-config search path.Perhaps you should add the directory containing `silverdesktop.pc'to the PKG_CONFIG_PATH environment variableNo package 'silverdesktop' found 

If you got the above output that means Moonlight is not installed. Before you use Moonlight 2.0 you must install Mono 2.6. To build Moonlight on the Desktop, you need the source code for Mono 2.6 available, so that you build Mono as part of the process. The steps below are for building Mono in a separate prefix to avoid interferring with a system-installed Mono setup.

Step 1

Download the following using Subversion.

svn co http://anonsvn.mono-project.com/source/branches/mono-2-6/mcs svn co http://anonsvn.mono-project.com/source/branches/mono-2-6/mono svn co http://anonsvn.mono-project.com/source/branches/moon/moon-2-0

Step 2

Build Mono.

$ mkdir $HOME/build$ cd mono$ ./autogen.sh --prefix=$HOME/build --with-moonlight=yes$ make && make install

Step 3

To enable desktop support use the following command …

$ cd ../moon$ ./autogen.sh --prefix=$HOME/build --enable-desktop-support$ make && make installFor system installation ?.$ cd ../moon$ ./autogen.sh --enable-desktop-support$ make $ suPassword: # make install 

The output after configuration is as follows. Moonlight configuration:

=======================[...] ?Silverlight Support:	Silverlight 1.0: yes	Silverlight 2.0: yes ?????????Browser plugin assemblies: yes  ???????????Path to mcs tree: ./../mcs ???????????Path to mono-basic tree: ./../mono-basic ?????????Desktop application assemblies: yesBefore start development you need to set up environment variables?	export MONO_GAC_PREFIX=/usr:$HOME/build	export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$HOME/build/lib/pkgconfig 	export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/build/lib

Moonlight Sample Application

To create desktop-based Moonlight applications, first you need to create a Gtk# project in MonoDevelop 2.2. After that, add the following assemblies to the project.

System.Windows.dll

Moonlight.Gtk.dll

The first assembly contains the Silverlight API and the second will help to host the Silverlight content inside a Gtk# application. Following is the code of a Moonlight sample application for creating canvas.

//Default Namespace for any Moonlight Projectusing System;using System.Windows;using System.Windows.Media;using System.Windows.Controls;using Moonlight.Gtk; namespace MoonlightDesktopApp{ ???class MyMoonlightApp ???{ ???????public static void Main (string[] args) ???????{ ???????????Gtk.Application.Init ();  ???????????MoonlightRuntime.Init (); //Initialized Moonlight ??????????? ???????????MainWindow winApp = new MainWindow ();  ???????????var hostApp = new MoonlightHost (); //Gtk.Widget that will host  ????????????????????????????????????????????//your Silverlight control. ???????????var canvasApp = new Canvas () { ???????????????Width = 300, Height = 300, ???????????????Background = new SolidColorBrush (Colors.DarkGray) ???????????}; ???????????hostApp.Application.RootVisual = canvasApp; ??????????? ???????????winApp.Add (hostApp); ???????????winApp.ShowAll (); //To add that to any Gtk.Container, in this  ??????????????????????????????//case, we will add it to the window: ??????????? ???????????Gtk.Application.Run (); ???????} ???}}

Conclusion

Mono 2.6 and Moonlight 2.0 are not a stable versions yet. Issues are already been reported for plugging now working in Mozilla. All open source Mono developers are encouraged and requested to log any issue related with Mono. For all existing bug lists and to report new bugs please see the following URL. https://bugzilla.novell.com/buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&classification=Mono&product=Moonlight&bug_status=NEW&bug_status=ASSIGNED&bug_status=NEEDINFO&bug_status=REOPENED&cmdtype=doit&version=2.0.0&version=1.9p1&version=SVN&version=unspecified

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist