30 Eylül 2009 Çarşamba

Running C# on Command Prompt


If you have trouble setting up Microsoft Visual Studio, you can still compile and run C# code. You can download and install Microsoft Visual C++ Express Edition and run its command prompt to compile and run your .cs files.
To write your .cs files, you can use any text editor such as Notepad++ or PsPad. Let's examine an example: Open a text editor and paste the following code:

using System;
class Hello {
public static void Main () {
Console.WriteLine ("Hello World");
}
}


Save the file as hello.cs.

To use command prompt, go to Start -> All Programs -> Microsoft Visual C++ Express Edition -> Visual Studio Tools -> Visual Studio Command Prompt 

Go to the necessary directory and type csc hello.cs to compile. 

If compilation was successful, hello.exe is created in that directory. You can run it by typing hello to the command prompt. 

That's it.
Good programming!

Hiç yorum yok: