Tuesday, 28 August 2012

To compile and run from a command prompt



With The Help of these steps you can run your program through command prompt.
  1. Paste the code from the preceding procedure into any text editor, and then save the file as a text file. Name the file Hello.cs. C# source code files use the extension.cs.
  2. On the Start menu, expand Visual Studio Tools, and then choose the shortcut to open a Visual Studio Command Prompt window.
    As an alternative, you can follow the instructions in How to: Set Environment Variables to enable command-line builds from a standard Command Prompt window.
  3. In the Visual Studio Command Prompt window, navigate to the folder that contains your Hello.cs file.
  4. Enter the following command to compile Hello.cs.
    csc Hello.cs
    If your program has no compilation errors, an executable file that is named Hello.exe is created.
  5. In the Visual Studio Command Prompt window, enter the following command to run the program:
    Hello


    Note: This information is taken from Microsoft site so if you want to know more then follow the link which is given below...





No comments:

Post a Comment