Click here to Skip to main content
15,895,740 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to execute C# file in windows command prompt not in VS.
Posted

You can run your C# program using CSharp compiler, CSC.exe. Check this article in MSDN for detailed steps.
Command-line Building With csc.exe[^]

Hope, it helps :)
 
Share this answer
 
v2
To execute a C# file, you first have to compile it. The compiler's name is csc and can be found in %windir%\Microsoft.NET\Framework\v<version>. For example, the compiler for .NET 4.0 is in v4.0.30319.

To compile a C# file from the command line, do this:
C#
%windir%\Microsoft.NET\Framework\v<version>\csc file.cs /out:application.exe

More information:
https://msdn.microsoft.com/en-us/library/78f4aasd.aspx[^]

After compiling it, you can execute the .exe file.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900