In order to debug and deploy .NET applications using the Mono Tools for Visual Studio, there are 2 components that need to be installed. Firstly there is the plugin for Visual Studio on Windows, and there is the monovs-server that needs to run on the target Linux system.
Installing the Visual Studio plugin is of course as easy as it gets, as the Mono guys have provided a Windows Installer file for our convenience. You can download it here from the official project page.
If you’re using openSUSE, installing the monovs-server part is quite easy too. Novell has provided a 1click RPM installer (or alternatively you can downloaded an openSUSE virtual image for VMWare or Virtual PC). If however you’re not using openSUSE (especially a non-RPM system like Ubuntu), things can get a little tricky.
I’ve managed to hack it so it works on Ubuntu, so what follows should get you up and running quite quickly.
Installing monovs-server on Ubuntu
The monovs-server is the Linux server application that allows the Visual Studio plugin to connect to the Linux box so that applications can be deployed and debugged remotely. Luckily for us, the monovs-server application is a Mono application itself, and thus should run on any system or distribution that has a working Mono runtime installed. If you don’t yet have a working Mono installation, have a look at my instructions here.
We’re going to be doing this from the shell, so login to your Ubuntu Server via SSH or open a terminal window from your desktop.
All these instructions assume that you have root privileges, so if you're not logged in as root, enter the following and enter you password when prompted.
$ sudo bash
Lets install some dependencies and 7zip that we’re going to need later on:
$ apt-get install libncurses-dev p7zip-full
If you’ve installed Mono using my instructions, you are also going to need to compile and install the Mono debugger module. ONLY DO THIS if your Mono was installed by compiling it. If you’re running on the Mono that came with Ubuntu, you can (and should) skip this step.
Lets create a folder, download the debugger package, extract it and compile it:
$ mkdir /src $ cd /src $ wget http://ftp.novell.com/pub/mono/sources/mono-debugger/mono-debugger-18.104.22.168.tar.bz2 $ tar –xvf mono-debugger-22.214.171.124.tar.bz2 $ cd mono-debugger-126.96.36.199 $ ./configure --prefix=/usr/local; make; make install
That should get installing the debugger out of the way.
Next we need to download and extract the monovs-server RPM and manually install the files, as Ubuntu doesn’t support RPM files. It took a lot of digging to find this RPM, as at the time of writing none of this has been documented anywhere.
Lets start by creating a temporary folder to extract the files into:
$ cd /tmp $ mkdir monovs $ cd monovs
Now we download the RPM:
$ wget http://ftp.novell.com/pub/mono/monovs/latest/openSUSE_11.0/noarch/monovs-server-1.0.4410-1.1.noarch.rpm
We now have to extract the files contained in the RPM. The RPM consists of a number of layers of wrappers, so we extract them all till we get to the good bits:
$ 7z x monovs-server-1.0.4410-1.1.noarch.rpm $ 7z x monovs-server-1.0.4410-1.1.noarch.cpio.lzma $ 7z x monovs-server-1.0.4410-1.1.noarch.cpio
Once that’s done, you’ll have a set of folders that contain the files in the RPM. They are:
We now need to move these files to the correct location on our system. The easiest way to do that is to issue a simple copy command:
$ cp -r usr/ /
Now that all the files are in the correct location, we start the monovs-server:
You should see something like the following displayed:
Using config file: /usr/lib/monovs-server/monovs-server.exe.config Listening at: 192.168.1.21:8805, manager port range 8806..8815, webserver port range 8816..8872, using ssdp, using tcp-pipe channel
And that’s it, the monovs-server is now listening for connections from Visual Studio. Now you can use the tutorials on the Mono Tools of VS website to deploy and debug your .NET applications on Ubuntu!