views:

195

answers:

2

I've run the following command in the Ubuntu terminal -

sudo apt-get install mono-develop

Now how can I run *.vb and *.cs programs using the terminal - What is the command that need to be given?

Does the syntax vary when we write code in Windows & Linux environment?

+3  A: 

Compile like this:

gmcs Foo.cs Bar.cs

Run like this:

mono Foo.exe

I'm not sure about the VB compiler though.

The command line options for gmcs are similar to csc, but run gmcs -help for details. The most obvious difference is that you use -flagName instead of /flagName :)

On Windows you can just run the .exe output files directly, of course. I think there's some way of associating them with mono on Linux, but I've never tried it myself.

Of course, there are bits of .NET which aren't present in Mono (and vice versa) - but if you're writing simple console apps (e.g. just to try LINQ to Objects queries etc) then it should be fine.

Jon Skeet
Simple Windows Forms apps are usually also portable, in case you happen to be GUI dude.
Fredrik Mörk
I may be wrong, but most mono tools do not care about -foo, --foo or /foo.
Dykam
+1  A: 

Compile:

gmcs Test.cs

Run:

mono Test.exe

Note:

gmcs is the C# compiler

MAS1
Does gmcs come along with the mono-develop package? Or do I need to install some separate packages?
Arjun Vasudevan