- You can compile the program by using the command line with out using the Visual Studio Integrated Development Environment (IDE).
- To compile and run from a command prompt
- Type the code with the help of any text editor, and then save the file as a text file with .cs extension. Now save the file as Welcome.cs. Every C# source code file uses the extension .cs.
- Perform the following steps to open a command-prompt window:
- Open the Start menu, expand the folder for the current version of Visual Studio, open the shortcut menu for Visual Studio Tools, and then choose Developer Command Prompt for VS2012/VS2010.
- A Developer Command Prompt window appears.
- Enable command-line builds from a standard Command Prompt window.
- See How to: Set Environment Variables using "path".
- In the command-prompt window, navigate to the folder that contains your Welcome.cs file.
- Enter the following command to compile Welcome.cs.
- csc Welcome.cs
- If your program has no compilation errors, an executable file that is named Welcome.exe is created.
- In the command-prompt window, enter the following command to run the program:
- Welcome
Loading...
infolinks
How to Compile and Run programs from a Command Prompt
About Us
Powered by Blogger.
Post a Comment