The guys at the Mono Project have released their Mono Tools for Visual Studio. This must be one of the most anticipated projects of the year for me yet!

According to the official project page:

Mono Tools for Visual Studio is a commercial add-in for Microsoft™ Visual Studio™ that enables developers to write .NET applications for non-Windows platforms within their preferred development environment. It allows developers to build, debug and deploy .NET applications on Linux, while continuing to leverage the extensive ecosystem of code, libraries, and tools available for .NET.

While there’s a fair bit of marketing speak in there (I tune out pretty much whenever I hear the words “leverage” and “ecosystem”), the benefits are actually quite simple.

You can now remotely deploy and debug .NET applications on Mono directly from within Visual Studio!

I can’t begin to tell you how much help this is going to be in working on BlogEngine.NET on Linux. Unfortunately this capability isn’t open-source or free, but as a Visual Studio developer you’re probably going to be used to paying for features. Starting at $99 I guess it’s not too hefty a price to pay if you’re serious about using C# on Mono and Linux.

Here’s some of the awesome things you can do with it right now:

  • Directly deploy a .NET application to a remote Linux machine.
  • Debug and step through your code in Visual Studio as you run on a Linux box.
  • Built in portability checker for existing .NET applications.
  • Package your application as an .rpm for installation on distributions that support RPM’s (not Ubuntu unfortunately).

For more information, I’d suggest you go visit Miguel de Icaza’s blog, and also the official product page at the Mono project.

I’ll be following up this post shortly with a guide to getting it all to work on Ubuntu.

I’ve finally put together a bash script to automatically download, compile and install Mono on Ubuntu. At the time of writing, it installs Mono 2.4.2.3. Should this be outdated by the time you read this, you can simply modify the install script to download the latest files.

More...

Synaptic and Nautilus running on VistaIf you're a Windows user and you've been meaning to mess around with Linux (particularly Ubuntu), you're now very much in luck.

Claudio César Sánchez Tejeda has put together a CoLinux package of Ubuntu 8.04 Hardy Heron called Portable Ubuntu.

CoLinux allows you to run a Linux operating system that cooperates with your existing Windows installation. This means that you don't have to dual-boot or fire up a Virtual Machine in order to experiment with Linux anymore. You can run Linux almost the same way you would run any other Windows application. And to sweeten the deal, any Linux app you run in this environment will integrate into your Windows desktop, thus allowing you to overlap Linux apps with Windows apps. It even incorporates seamless copy and paste.

CoLinux clearly beats the pants of virtualization and finally makes it extremely easy to test the waters with Linux as a Windows user.

This is all possible because of the modified CoLinux kernel which cooperatively schedules resources with the Windows NT kernel, rather than having the computer resources delegated by the host computer. The desktop integration is possible because of Xming, a Windows implementation of the Linux X Window server.

Installing Portable Ubuntu

Installation is straightforward. Simply download the Portable Ubuntu archive from SourceForge here, extract it to a folder and run the run_portable_ubuntu.bat file. Portable Ubuntu will even run from a Flash drive on any Windows machine you stick it in.

After a couple of seconds or so you'll get a splash screen while the Ubuntu operating system boots up in the background. Once that is done you'll have the Ubuntu taskbar at the top of your screen from which you can launch and install Ubuntu applications. It only works on 32bit systems though, if you're on a 64bit Vista or XP system you're out of luck. What is also awesome about this is that you don't even need to configure an internet connection, it will piggy back of your Windows machine's connection.

If you're planning on installing software and messing with your Ubuntu system you'll need the root password: 123456

Installing Mono

Mono will install successfully using my existing instructions here, but only if you increase the drive space!

When just installed your Ubuntu drive space will be limited to about 400 MB. This obviously isn't enough to install a lot of software in, so if you plan to install Mono you'll want to extend the drive image size. I've put together a little tutorial on how to do this here.

Once that's sorted and you've gotten Mono installed, have a look at getting BlogEngine.NET installed from the instructions here.

And who knows, when you see it all work painlessly for yourself you might be hosting your next blog on an inexpensive Linux VPS before you know it :)

 

We've just released the final version of BlogEngine.NET 1.5 to the public. You can read more about the changes and improvements at Mads Kristensen's blog.

With this release we've worked hard to ensure that the application works out of the box on Linux using Mono. There is no compilation to be done and no configuration settings to tweak. It just works.

For those wishing to try this out, I've created a little tutorial called Installing BlogEngine.NET on Mono/Linux. As you will see there is hardly anything to it, it's just that easy.

So go on, give it a try and let us know how it pans out for you!

If you've installed an FTP daemon on your Ubuntu server, you'll have probably set it up so that users are rooted to their own FTP directory on the server. But what if you'd like an FTP user to have access to other directories on the server? A symbolic link sounds like it would work, but I'm afraid it won't. You'll have to mount the folder you're interested in to the user's FTP folder.

Assume that we've got a user called "russell" and you've set up your FTP so that he has his own FTP folder at /var/ftp/russell/. Also assume that you want to give him access to the /var/www/ folder so that he can update the web sites on your server.

We're going to mount a folder into a subdirectory in his FTP directory, so create a suitable directory for that:


$ cd /var/ftp/russell$ mkdir www

Now we mount the /var/www directory into /var/ftp/russell/www/:


$ mount --bind /var/www /var/ftp/russell/www

More...

More for my own reference than anything else, but if you need to change the file permissions on a folder and all its files and subdirectories, simply do the following at the command prompt:

$ chmod -R 0777 /folder

When using Mono and developing web applications in Visual Studio, it often becomes a pain to keep copying modified files over to your Linux box for testing.

Luckily for us Linux is compatible with Windows file shares via Samba. Samba allows us to mount Windows file shares as if they were folders on your local Linux drive.

Install Samba

You'll fist need to make sure that you have all the Samba files installed on your Linux box. These instructions are for Ubuntu, but should work for most distributions.

On the command line, log in as root using the sudo command:




$ sudo bash


Enter your password when prompted.

Then download and install the required Samba files.




$ apt-get install smbfs


Once that is installed, we can create the file mapping.

Map the Windows Share

First thing to do obviously is share a folder on your Windows computer. For the purposes of this tutorial, I'm going to be making the following assumptions:

  • Your Windows and Linux PC's are on the same network. Use the "ping" command to confirm!
  • The windows computer is called "MYPC" with an IP address of 192.168.0.1
  • The folder I'm sharing is called "Projects"
  • The Windows computer has a user account called "Russell" with a password of "mypassword". This user account must have access to the shared folder!

On our Linux box we're going to create a folder which will become our mount point. A mount point is basically a normal folder that will magically map to the shared folder.

So let's create a mount point folder for our projects share:




$ mkdir /mnt/projects


Now let's mount the windows share into our new mount point:




$ mount -t smbfs //MYPC/projects mnt/projects -o username=russell,password=mypassword


If you get an error on the above command, chances are that you're unable to resolve the computer name of your Windows PC. Try using "ping MYPC" to confirm that you can reach the PC. If you get an unknown host error, you can simply fix the problem by providing the IP address in the mount command used above.

Lets confirm that we can see our files:




$ cd /mnt/projects
$ ls


You should a directory listing of the files on your Windows share.

And that's it, now you can access your windows PC files as if they were part of your Linux file system!

Something that will come in handy while porting applications to Mono is the ability to detect whether an application is running under Mono or .NET, and also whether it's running on Unix or Windows. While one would hope that .NET applications would be completely binary portable, there are still some situations where Mono's infancy becomes a stumbling block.

From the Mono Project Technical FAQ:

Having code that depends on the underlying runtime is considered to be bad coding style, but sometimes such code is necessary to work around runtime bugs.

The following methods are documented in the FAQ, but to save everyone time, I'll document them here.

Detecting Mono:

 1: using System;
 2:  
 3: class Program {
 4:  static void Main ()
 5:  {
 6:  Type t = Type.GetType ("Mono.Runtime");
 7:  if (t != null)
 8:  Console.WriteLine ("You are running with the Mono VM");
 9:  else
 10:  Console.WriteLine ("You are running something else");
 11:  }
 12: }

Detecting Linux/Unix:

 1: using System;
 2:  
 3: class Program {
 4:  
 5:  static void Main ()
 6:  {
 7:  int p = (int) Environment.OSVersion.Platform;
 8:  if ((p == 4) || (p == 128)) {
 9:  Console.WriteLine ("Running on Unix");
 10:  } else {
 11:  Console.WriteLine ("NOT running on Unix");
 12:  }
 13:  }
 14: }

I apologize for the bad code formatting above, but I'm still fighting to get proper syntax highlighting working with Live Writer and BlogEngine.NET.


I am a software developer / architect currently interested in combining .NET technologies with open-source operating systems. 

I am a member of the open-source BlogEngine.NET development team and focus mainly on ensuring Mono compatibility for the project.

twitter

BlogEngine.NET


At StayUnlimited Cape Town accommodation we help you choose from and book guest houses, self catering apartments, bed & breakfasts, luxury villas and hotel accommodation.