Novell Home

SUSE Linux Enterprise 10

For the last quarter of 2005, Linux servers generated US$1.6 billion in revenue, the 14th consecutive quarter of double-digit growth, with year-over-year revenue growth of 20.8 percent. For the full year, Linux moved into third place for the first time from an operating system perspective as customers continue to expand the role of Linux servers into an increasingly wider array of commercial and technical workloads. Similarly, Linux on the desktop is gaining momentum as organizations look for a more stable, secure and cost–effective alternative.

From a software development perspective, the penetration of Linux in the Data Center and on the desktop is causing enterprise developers and independent software vendors (ISVs) to look for efficient and cost-effective ways to port their critical applications to multiple platforms.

The Mono development framework included in SUSE Linux Enterprise Server 10 and SUSE Linux Enterprise Desktop 10 provides all the tools necessary for developers to build high performance cross-platform applications for both the server and desktop while preserving investments in expertise, code and existing hardware.

> The .NET Framework
The .NET Framework is a software development platform created by Microsoft in 2001 in response to the rising popularity of Java. The idea behind the .NET framework was to allow cross-language development and provide a set of technologies that offer interoperability through open standards. Key components of the .NET framework include:

  • A runtime environment that provides garbage collection, threading and virtual machine specification (CLR)
  • A comprehensive set of classes, interfaces and value types that provide access to the system's functionality and services (Class Library)
  • A new language, C#, that allows programmers to use all the features available on the .NET runtime
  • A common language specification (CLS) that compilers follow if they want to generate code that is interoperable with other programming languages
  • The key here is that any API that is written using a CLS provider language can be used by any language that is a CLS consumer. Compilers generate code in an intermediate format called Common Intermediate Language (CIL) which is then compiled to native code or compiled using Just-in-Time (JIT) engines.
  • Microsoft submitted the common language runtime and common language infrastructure to the ECMA International standards body, essentially opening up the design of the .NET core components to anyone who wanted to implement the .NET framework on other platforms.

> What is Mono?
The Mono Project is an open development initiative sponsored by Novell to develop an open source, UNIX version of the Microsoft .NET development platform, enabling developers to create crossplatform applications with unprecedented productivity. Mono provides the necessary software to develop and run .NET client and server applications on Linux, Solaris, MacOS X, Windows and UNIX. And it allows organizations to leverage existing investments in expertise, hardware, languages and tools for more cost-effective software development.

The core Mono environment required to create and host .NET applications includes the following key components:

  • Common Language Runtime (CLR)
  • C# Compiler
  • .NET Class Library Implementation
  • GNOME, Mono, UNIX Libraries
  • Development tools

> Mono Support for UNIX
As a development environment for UNIX platforms, Mono provides some very powerful features:

Mono.Posix A library to produce UNIX-specific applications like daemons or UNIX servers.
GTK# An API for creating Linux desktop applications that includes functionality to create graphical applications, printing, internationalization, configuration management, theming and drawing.
LDAP support LDAP access for .NET apps using Mono.Directory.LDAP or Novell.Directory.LDAP
Database support A very complete set of class libraries to support most databases (free and proprietary).
Security stack Mono has its own security stack written from scratch, from cryptographic algorithms to certificate management and higher level protocol implementations such as SSL and TLS.

> Mono Support for Microsoft APIs
In addition to the above extensions, the Mono Project also provides substantial support for Microsoft APIs which are used by developers and users that need to target UNIX, Solaris or MacOS X in addition to Linux from a single code base. These libraries are binary compatible with the Microsoft stack, so no recompilation is necessary:

  • An ASP.NET-compatible Web services and Web forms stack.
  • An ADO.NET for developing database-aware applications.
  • Windows.Forms for bringing Windows .NET GUI applications to any Mono supported system.

Both Windows developers and Linux developers will be able to leverage their existing knowledge of other platforms and languages to develop rich, cross-platform applications with tools that are familiar to them.

> Advantages of Developing with Mono
Mono significantly reduces the cost of supporting the Linux platform for software developers. Traditionally, the decision to support a new platform required an in-depth analysis of the cost of development versus the potential return. Mono makes that decision much easier by providing a cross-platform framework that incorporates key .NETcompliant components such as a C# compiler and a portable execution system, and brings together the benefits of many modern programming language features. Both Windows developers and Linux developers will be able to leverage their existing knowledge of other platforms and languages to develop rich, cross-platform applications with tools that are familiar to them. In addition, the Mono Project provides:

Controlled Environment Managed code provides many advantages such as error isolation, garbage collection, runtime checking and increased security.
Choice of Languages and Reuse of Existing Code Supports a multitude of programming languages such as C#, Java, VB.NET, Python, PHP, Nemerle and Boo.
Fast to Write, Fast to Run Strongly and statically typed C# language provides more efficient development, and CIL improvements maximize JIT performance.
Cross-platform Code Support for Linux, Sun Solaris, Apple MacOS X, Microsoft Windows and various other UNIX systems on a variety of architectures.
Easy Migration Paths ASP.NET, ADO.NET and Windows.Forms support.
Comprehensive APIs for delivering rich client, Web services and server-side applications.
Familiar Tools Several build systems are available such as MonoDevelop, Nant and Autotools, and integration with VisualStudio.
Abundant Community Resources Active and responsive community provides help and ideas.

> Getting Mono
The Mono development framework is included as an integral piece of SUSE Linux Enterprise Server 10 and SUSE Linux Enterprise Desktop 10. Mono is also available for many other platforms, including SLES9, Windows, Mac, Solaris and other Linux distros. You can download it from the Mono project site at

> Desktop Programming
Mono has enabled a large set of applications that are contributing to the rise in popularity of the Linux desktop. Familiar applications such as F-Spot photo management, the Beagle search engine, Tomboy note taker, the Banshee music player and many more take advantage of the rich set of APIs available in the Mono/GTK# framework to deliver powerful functionality.

> For Linux
GTK# is a set of .NET bindings for the GTK+ toolkit and assorted GNOME libraries. GTK# is an event-driven system like any other modern windowing library and allows you to build fully native graphical GNOME applications using Mono. GTK# includes functionality to create graphical applications, printing, internationalization, configuration management, theming and drawing.

As the native toolkit for the Linux desktop running GNOME, applications developed using GTK# will look and function best on Linux, but will also run on many other platforms including Windows and MacOS X. In addition, developers can use the Glade user interface builder along with the Glade# bindings to easily design GUI applications.

> System.Windows.Forms
Windows Forms is the name given to the GUI portion of the Microsoft .NET development framework, providing access to the native Windows widgets by wrapping the existing Win32 API in managed code. Mono has comprehensive support for Windows.Forms 1.1 in this release and is working toward support of version 2.0 by the end of 2006.

> Creating Your First Mono Application
Developing Mono applications is not hard, particularly if you have some high-level programming experience. Here's a quick and easy sample that uses the Gtk# toolkit. Fire up your favorite text editor and compose the following:

using System;
using Gtk;

public class GtkHelloWorld {

public static void Main() {

//Create the Window
Window myWin = new Window("My first GTK#Application! "); myWin.Resize(200,200);

//Create a label and put some text in it.
Label myLabel = new Label();
myLabel.Text = "Hello World!!!!";

//Add the label to the form

//Show Everything


Save the program as helloworld.cs, and then issue the following command from the console to compile your application using the gtk package:

mcs -pkg:gtk-sharp-2.0 helloworld.cs

Now, run the program by typing:

mono helloworld.exe

and voila! In five minutes you've become a mono and gtk expert! (See Figure 1.)

> Web Programming ASP.NET is a set of Web development packages to build dynamic Web sites, Web applications and XML Web services, and is based on the Common Language Runtime (CLR) shared by all .NET applications. Programmers can write ASP.NET code using any of the different programming languages supported by the .NET framework, that is, C#, VB.NET, JScript .NET, Perl and Python.

ASP.NET attempts to simplify developers' transitions from Windows application development to Web development by allowing them to build pages composed of controls similar to a Windows user interface. A Web control, such as a button or label, functions in very much the same way as its Windows counterpart: code can assign its properties and respond to its events. Controls know how to render themselves—Windows controls draw themselves to the screen, Web controls produce segments of HTML which form part of the resulting page sent to the end-user's browser.

Using Mono, developers can build ASP Web applications using Linux or Windows without losing the flexibility and power of Apache. Mono's ASP.NET implementation has two major components:

XSP is a simple, standalone Web server written in C# that hosts ASP.NET's System.Web classes.
mod_mono is an Apache 1.3/2.0/2.2 module that integrates Mono's ASP.NET support with the Apache HTTP server.

These tools allow you to build an infrastructure for Web applications (code for which the primary interface is pointing and clicking on a Web page) and for Web services (SOAP-based RPC systems). They work with many publicly-available .NET applications, and the underlying Web services stack is used in several commercial applications.

Mono also supports ADO.NET, the primary relational database access model for .NET-based applications. Mono has many ADO.NET data providers for open source and commercial databases to get you connected.

> MonoDevelop
MonoDevelop is a free GNOME IDE included with SUSE Linux and primarily designed for C# and other .NET languages. (See Figure 2.) The main features of MonoDevelop are:

Code Completion MonoDevelop's intelligent code completion attempts to complete type, method and field names as you're typing. The IDE will automatically get the class information from your source code files and from the libraries referenced in your project.
Class Management MonoDevelop has a class viewer which allows you to list the classes in your project and their methods and properties. It also tracks your namespaces to keep the classes separate.
Built-in Help The .NET documentation and the Gtk# documentation are built into MonoDevelop for easy access.
Project Support MonoDevelop comes with built in projects that help get you started with your console, Gnome# or Gtk# application.
Add-ins MonoDevelop has a powerful add-in engine, which together with a modular API and a complete set of extension points, provides a seamless platform upon which to build your own development tools. MonoDevelop also provides an Add-in Manager you can use to install add-ins from online repositories.

> Mono Debugger
A debugger is an important tool for development. The Mono Debugger (MDB) can be used to debug both managed and unmanaged applications, and it provides a reusable library that you can use to add debugger functionality to different front ends. The debugger package includes a console debugger named "mdb", and MonoDevelop will provide a GUI interface for it soon. To use the debugging facilities in Mono, you should compile your program with debugging information. Do this by passing the -debug option to the command line compiler.
$ mcs -debug hello.cs
Then, to run the debugger on your program, simply type:
$ mdb hello.exe

The ability to write your application once and have it supported across multiple operating systems is a key benefit of the Mono framework. As a cross-platform technology, Mono runs on various operating systems including Windows.

Configuring Mod_Mono

When you installed XSP, a bunch of sample ASP.NET pages and Web services were installed too. If the prefix used to configure XSP was /usr, the sample files are located in /usr/share/doc/xsp/test. Let's say you want those files to be available under the virtual path /test. Edit your httpd.conf file (hint:/etc/httpd, /etc/apache2) and append the following lines:
LoadModule mono_module modules/
Alias /test
AddMonoApplications default
< Location /test>
SetHandler mono

In line 1, you might need to use the full path to Now start/restart Apache and browse http://hostname/test/index.aspx (where hostname is the name of the server, or if you're running Apache locally) and welcome to ASP.NET! Okay, it worked. But, what happened? When you started apache, mod_mono launched mod-mono-server. Later, when you requested any page under /test, mod_mono connected to mod-mono-server, forwarded the request data and retrieved the response that is sent to your browser. Finally, if you stop apache, mod_mono will tell modmono-server to die. For more information on mod_mono, go to

> Installing Mono on Windows
To install Mono on Windows, download the latest Windows installer from the downloads section of the Mono Web site ( and run the downloaded executable. The default installation will create a new "Mono for Windows" program group under the Start menu with links to all of the common tools you will need to get started with Mono. The combined installer creates a "Mono Command Prompt" shortcut under the main Mono program group which starts a command shell with mono-relevant path information already configured.

To test the mcs compiler and the mono runtime, launch the command prompt and create a simple C# file as follows:
C:\> echo class X { static void Main () { System.Console.Write("OK");} } > x.cs
Now you can compile the resulting "x.cs" file into an executable with the Mono C# compiler:
C:\> mcs x.cs
The resulting "x.exe" executable will work with both Mono and the Microsoft runtime. Type the following to try running it with Mono:
C:\> mono x.exe

Now, to try it with Windows, type the following:
C:\> x.exe

If you get this far, you have a working Mono installation!

> Mono integration with Visual Studio
Visual Studio is a comprehensive development tool and one of the most popular development environments among .NET developers. To facilitate the migration of .NET applications to Mono, the Visual Studio Prj2Make# add-in complements the Mono Combined Win32 Installer and simplifies the use of Visual Studio 2003 as a development platform for Mono applications. Prj2Make# can read a solution file (*.sln) produced by Visual Studio.NET and generate a makefile suitable for compilation with mcs.exe or csc.exe. The resulting makefiles can be tuned for Windows (nmake.exe) and *NIX (gmake). In addition, this add-in for Visual Studio 2003 allows developers to:

  • Test Windows.Forms applications with the Mono runtime using Visual Studio
  • Test ASP.NET applications with Mono from Visual Studio
  • Switch between Mono runtime versions for testing applications
  • The Prj2Make# files can be found by searching for the prj2make# project on Novell's forge website.

> Developing Applications to Run on Linux and Windows
In general, keep a couple of things in mind during the development phase to get an application to run on both Windows and Mono:

  • path name separators: backslash vs. slash
  • file name case sensitivity (Windows is not case sensitive, but UNIX is)
  • test your application on Mono

As long as you stick to published .NET APIs, you should be fine.

Today, with the exception of enterprise services and transactional services, the complete .NET 1.1 specification is implemented in Mono including support for Windows.Forms. In addition, Mono also includes C#2.0, generic support, and many of the APIs from the .NET 2.0 specification..

As the Novell team delivers the 2.0 functionality in stages, the goal is to deliver mscorlib, System and System.XML in the first half of 2006 and follow up on the second part of the year with the rest of the libraries. red N

© 2015 Micro Focus