Compiling a .NET program with Mono
June 27, 2006 11:02 AM   Subscribe

Is it possible to compile a .NET program in Linux using Mono?

Slug has always been my favorite blog posting client for Windows. Now that I have just about fully migrated to Ubuntu, I've been looking for a new client and failed to find any that I compare to Slug in terms of simplicity and functionality (editing of entries, multiple categories/tags selection, minimalism).

According to the Slug home page the program is written in C#. I remember I had to install .NET to get it to work on Windows. Running Slug under Wine doesn't work because (predictably) I can't successfully install .NET.

The Slug install comes with the source code, and there is .NET alternative for Linux, Mono which claims that it "provides the necessary software to develop and run .NET client and server applications on Linux." Does this mean I might be able to compile Slug from source using Mono, and then run Slug natively in Linux?

If so, how would I go about doing it? The install comes with a lot of what I assume are source files (AssemblyInfo.cs, Form1.cs, BlogRpc.cs, Slug.csproj, etc.) and I am not sure what to do with them. The only things I have compiled in the past are my own Java programs in an elementary programming class and tarballs that come with some kind of install script (usually ./configure, make, makeinstall).

Can anyone point me in the right direction, or should I give up now as someone with little-to-no programming knowledge (and none at all of .NET or C#)?
posted by puffin to Computers & Internet (8 answers total)
I've used ASP.NET and C# with Mono. Both work, but both are iffy. You'll never run anything in .NET natively, it always runs interpreted (although sometimes the native code is cached).

Since Mono is so hit or miss (in particular, the last time I used it, WinForms blew goats), I'd strongly, strongly suggest you get someone who is at least somewhat familiar with both Mono (at the least, unix systems) and C#, incase changes need to be made. You also might want that person to get the latest from SVN, since I know WinForms is under very active development.
posted by devilsbrigade at 11:17 AM on June 27, 2006

Yes, Mono will let you compile and run programs written in a .NET language (such as C# or VisualBasic.Net). However, Mono has comparatively little support for Windows.Forms, which is the (basically Windows-only) part of .NET that draws the windows, buttons, text boxes, and so forth. Instead, Mono programs typically use GTK#, a roughly equivalent 'toolkit.'

So what to do? .NET programs with a graphical interface that were written for Windows used to be run using a combination of Mono and WINE, which kinda sorta not really worked. Nowadays, the Mono folks are writing their own implementation of Windows.Forms, but it's very much in development. The good news is that it comes with Mono, so if it'll work, it'll work without having to install much extra (hopefully).

To try and compile it, make sure you have both the mono package and the mono development package installed. Basically to give it a whirl try running

mcs *.cs

If you get more than a couple of simple-looking errors, you'll probably need more help than can easily be given via AskMeFi.
posted by jedicus at 11:24 AM on June 27, 2006

All right, so it looks like it's going to be a long shot...

Jedicus, I'll try your suggestion tonight when I get home. If it doesn't work, oh well.
posted by puffin at 11:34 AM on June 27, 2006

Apparently, when I said "when I get home" I really meant right now. :P

As you guys predicted I get errors when I try to compile (": error CS0234: The type or namespace name `Windows' does not exist in the namespace `System'. Are you missing an assembly reference?") which I assume has to do with the Windows.Forms that you guys mentioned.

So I guess the answer to my question (for now, at least) is no. But thanks for the advice, I was really curious about whether it would work or not.
posted by puffin at 11:48 AM on June 27, 2006

Well...this makes me wonder. Your version of mono may not be up to date enough to include the new Forms stuff.

Alternatively, my compilation command may be all kinds of wrong, but it's what I remember.

Try running

gacutil -l

And see if you get anything about Windows.Forms. If you don't, then you haven't got it. If you do, then maybe you have. Also, try finding out what mono version you have. Something like 'mcs --version' may tell you.
posted by jedicus at 12:18 PM on June 27, 2006

Sounds like you'll spend more time trying to get Slug to work than if you used vmware and ran slug in windoze there, found a linux client you liked, wrote your own, etc etc.
posted by crypticgeek at 12:27 PM on June 27, 2006

Crypticgeek does make a good point. I'll point out BloGTK, a native linux client for MT blogs that looks like it's at least as powerful and about as easy to use as Slug.
posted by jedicus at 1:04 PM on June 27, 2006

I would just like to note that since Mono scrapped using Wine for their WinForms implementation they are now in the process of using native C# implementation and still have a lot to do. On that note, I have had some limited success in creating WinForm applications that run on both Windows.NET and Portable.NET. So Portable.NET might be something to give a go, especially seeing as the GUI for slug does not look that complex.

Just note though that no matter what you use, WinForms outside of Windows.NET is very iffy.
posted by chrisroberts at 1:28 PM on June 27, 2006

« Older Girls and gaming   |   Software for change management control? Newer »
This thread is closed to new comments.