C# – Using Mono on Windows


I know it sounds stupid but:

I've found this application written on Mono and it is open source.

While peeking at the source code I've found this two "using" directive that stoped me:

using Gdk;

using Mono.Unix;

I guess they're Mono specific libraries.

So, it is possible to run Mono under Windows? ( perhaps Visual Studio express edition ? )

I'm trying to learn C#

I see there is a Windows branch of the app, but it is empty.

BTW: Is it Mono thought for cross platform in first place?


I've downloaded/installed and run the sample code

using Mono.Unix;

class X { static void Main () { System.Console.Write("OK");} } 

And the answer to my own question is:

x.cs(1,12): error CS0234: The type or namespace name `Unix' does not exist 
in the namespace `Mono'. Are you missing an assembly reference?
Compilation failed: 1 error(s), 0 warnings

No, it doesn't work 🙁

Best Solution

Mono on windows guide

I am not sure you will be able to use code using the Mono.Unix namespace, but generally if you are creating cross platform code, you shouldn't have to.

Gnome Do linux port. For a learning project however, I might suggest starting with code that is actually cross platform, or develop on Linux for now. Tackling cross platform issues and possibly an incomplete port will just complicate the learning process.

So, I suppose in summary to your initial question. Yes, you can run Mono on Windows, but it is possible to write platform specific code, which the example application you have chosen has indeed done. The link I provided above is a port to make that code work on Windows. Without porting ( changing the platform specific code ), that program will not compile on windows.