Don’t have Visual Studio? Don’t worry. You can compile C# in a command prompt as long as you have the Microsoft .NET Framework installed. The program used to compile C# is csc.exe and is located at
C:\Windows\Microsoft.NET\Framework64\v4.* on my installation (your location may vary slightly).
- Add the path to
csc.exeyour PATH environment variable.
- Open a command prompt and navigate to the directory where your source code is stored.
csc HelloWorld.csto compile.
HelloWorld.exeto run the program.