Cross Platform Functionality for .NET

Microsoft has recently announced that it will port the .NET Framework to the Mac and Linux platforms. This is welcome news because more and more of my readers have expressed an interest in developing applications that run on multiple platforms. It’s the reason that I cover Windows, Linux, and Mac requirements in books such as Beginning Programming with Python For Dummies. Until now, I usually had to include some mention of alternative solutions, such Mono, to help my readers achieve cross-platform functionality. (For readers with older versions of my books, Mono is actually delivered by Xamarin now, see my announcement in the An Update About Mono post.) Even though Mono makes a valiant effort to make cross-platform a reality, it does have limits, so the Microsoft announcement is welcome. Now we have to see whether Microsoft actually delivers on its promises.

There has been a lot of analysis about the announcement. You can find some general information about the product on eWeek. The information is pretty much a reworded version of the Microsoft announcement, but I found it clear and succinct. The InfoWorld writeup provides additional information and takes Microsoft to task for not completely opening the .NET Framework. There are still some licensing issues to consider. For my part, I wonder when Microsoft will make it possible to fully use C# on any platform. At some point, Microsoft must make it possible to develop applications on a platform other than Windows or developers will continue to lose interest.

One of the biggest questions I’ll need to answer for you is whether any of my book examples will run on other platforms. Given how Microsoft has done things in the past, it seems unlikely that you’ll be able to use any of my existing book examples on other platforms. The code might possibly work, but the downloadable source would have to be redone to make it possible to compile the examples with the new tools. So, for now, I’m saying outright that you need to continue to use my books with the version of Visual Studio for which they are written and not assume that the examples will work on other platforms.

I do find the news exciting because there is finally a chance that I’ll be able to address your needs better when it comes to working with languages such as C#. Yes, working with solutions such as Mono did allow you to perform certain tasks across platforms, but there is not a potential for writing complete applications of nearly any type and having them work anywhere, which is where the world as a whole has been headed for a long time. I applaud Microsoft’s efforts to move forward.

Please do contact me with your questions regarding cross-platform functionality in .NET and how it affects by books at John@JohnMuellerBooks.com. No, I can’t answer your question about how Microsoft will implement cross-platform functionality in the new versions of .NET, but yes, I do want to hear about your ideas for book updates based on this technology. What I want to do is help you use this new functionality as soon as is possible.

 

An End of Support for Moonlight, the Silverlight Alternative

I’ve promoted using the Mono, open source alternative to the .NET Framework, for more than a little while now. Mono makes it possible to use .NET applications in environments where you might not otherwise be able to run them. I commonly use Mono with my Linux setup. However, it may interest you to know that I’ve also used it with Windows 2008 Server Core. In fact, I wrote one of several articles on the topic for DevSource. Some of my books, such as Administering Windows Server 2008 Server Core, rely on Mono as a means for accomplishing tasks that would be difficult otherwise. Moonlight, is the Silverlight equivalent of Mono. It lets you run .NET Web applications on other platforms. Unfortunately, Xamarin, the folks who support Mono, have chosen not to continue supporting Moonlight.

Actually, there is some confusion about precisely who does provide support Moonlight. It seems that even though you download Moonlight from the Mono site, Xamarin never took official possession of the product. Until now, Novell has been providing the updates for Moonlight and the last update was quite some time ago. I just checked and you can still download Moonlight. I would imagine that the Moonlight download will remain accessible for the foreseeable future, so any ASP.NET applications you’ve created will continue to run on your Linux system. The major problems seem to be in the updates that Microsoft has added to Silverlight and that Silverlight has never gained the sort of traction that Xamarin hoped it would as a desktop application platform.

Mono is actually a versatile framework. It runs on openSUSE, Max OS X, Windows, Solaris, and other (including Debian and Ubuntu) platforms. All you need to do is download the version needed for your system. I’ve tested a number of my applications on Mono for both C# Design and Development and Start Here! Learn Microsoft Visual C# 2010 Programming. Command line applications almost always work, while some graphics applications will have problems (but even they run a majority of the time). The key is whether the application adheres strictly to the conventions for working with the .NET Framework, doesn’t use any special libraries, and doesn’t rely on P/Invoke. In short, your well-behaved application will generally work on Mono.

Moonlight provides similar functionality for Linux systems. I had always hoped that it would enjoy the same level of support as Mono does at some point, but it just never gained the required level of usage. Even if you can’t use Moonlight in it’s current form for your applications, it would be a good idea to consider at least trying Mono. You may find that the .NET application you thought would only run on Windows systems, runs just fine on all of the other platforms that I just mentioned. If you have any questions about Moonlight or Mono, let me know at John@JohnMuellerBooks.com. I’ll do my best to answer them or find a source of information for you.

I’d also love to hear about your Mono and Moonlight usage experiences. It would be especially interesting to know whether you’ve used either product in a production environment and about any issues you encountered using them. The ability to expand your .NET applications beyond Windows is a reality despite what you may have heard to the contrary.

 

An Update About Mono

I’m not one to get stuck on a particular form of a technologyit’s best to use the solution that works, rather than make a favored solution try to fit. Many .NET developers miss opportunities to move their solutions to other platforms or use them in places that normally don’t work well with the .NET Framework by leaving out Mono, the .NET Framework alternative. Most people associate Mono with the Macintosh or Linux, but there is also a Windows form of Mono. When Windows Server 2008 Server Core came out without the .NET Framework, I immediately wrote an article about it entitled, “Mixing Server Core with .NET Applications.” In fact, I’ve promoted Mono to frustrated administrators in my book, “Administering Windows Server 2008 Server Core.” Before Microsoft finally came out with a .NET Framework solution, you could use Mono to do things like run ASP.NET applications on Windows Server 2008 Server Core and my book told you how to do it in Chapter 24.

So, I was more than a little disturbed when I heard that the Mono crew had been laid off by Novell. Fortunately, I discovered later that the layoffs are just a prelude to having Mono supported by a new company named Xamarin. To read more about this company, check out Miguel de Icaza’s blog entry, “Announcing Xamarin.” Not only will the new company continue supporting the open source versions of both Mono and Moonlight (the Silverlight alternative), but it’ll create new commercial products for both Android and iOS. In short, this development is actually good because the new company will focus on this incredibly useful technology.

My main concern for the new company is that they won’t have the funding to do everything they envision doing, but that remains to be seen. Reading Mary Jo Foley’s article gives me hope that they’ll succeed. What are your thoughts about Mono? Is it a technology that you’ve used or at least are willing to try? Let me know at John@JohnMuellerBooks.com.