13

I installed mono on my Suse 12.1. When I create a file, say hello.cs, and run mono hello.cs on the terminal, I get this error:

Cannot open assembly 'hello.cs': File does not contain a valid CIL image.

The contents of the file (hello.cs) are as below

class hello {
    static void main () {
        System.Console.WriteLine("Hello World");
    }
}

What could be the problem, and how do I solve it?

Pablo A
  • 1,733
roykasa
  • 359

1 Answers1

13

The mono command is used to run compiled C# programs. You need to compile hello.cs first with:

mcs hello.cs

Then you can execute it with:

mono hello.exe

For more information on writing C# programs with Mono see: http://www.codeproject.com/Articles/9407/Introduction-to-Mono-Your-first-Mono-app

jaume
  • 5,657