Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Hey guys 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?

share|improve this question

closed as off topic by Bobby, soandos, Siim K, ChrisF, Tog Oct 18 '12 at 12:06

Questions on Super User are expected to relate to computer software or computer hardware within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 1 down vote accepted

Command mono is to run compiled programs. You need to compile your 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

share|improve this answer
    
yes it now works. Thanks –  roykasa Oct 18 '12 at 9:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.