Some people think that Visual Studio is necessary to Compile and Run .NET Applications, but it is not so. You only need to have .NET Framework installed on your Computer which is of very small size around 40mb and is available for free download on Microsoft’s website. Once you have .NET Framework installed on your Computer, then you can Compile and Run your Applications using Command Prompt only. If you have Visual Studio installed, then you can also use Visual Studio Command Prompt tool to Compile and Run your Applications which is by default already Configured to run .NET syntax and commands. For that You can see my article on How To Compile C# Applications using Visual Studio Command Prompt. If you don’t have Visual Studio installed, then you can configure the Windows Command Prompt as well to run the .NET commands and then Compile and Run your Applications.
- Open Command Prompt by first clicking on Start button, then searching for CMD.
- In Command Prompt, type the following command, which will configure the Command Prompt to Run .NET syntaxes.
- If you have some another version of .NET installed, then you can replace v3.5 with that version as well. To see what .NET version you have, Go to C->Windows->Microsoft.NET->Framework. In that folder, you will find one different folder for every version of .NET framework you have in your Computer. So, you can use any folder’s name in upper command by replacing v3.5
- Now your Command Prompt in configured to Compile and Run .NET syntax. Type csc filename.cs to Compile your file, which will create executable file of that code in the same drive with same name, but with .exe extension. Now to Run the .exe file just type its name there and press Enter.
Incoming search terms:
- compile c# di cmd (1)
- how to invoke command prompt command into c# net (1)
- how to set path to compile c# in xp (1)
- how to set the path for net on xp to run c# (1)
- run c# from command line (1)