且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Windows命令提示符下执行C#文件?

更新时间:2022-11-02 23:06:16

您可以使用CSharp编译器CSC.exe运行C#程序。请查看MSDN中的这篇文章,了解详细步骤。

使用csc.exe进行命令行构建 [ ^ ]



希望,它有帮助:)
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 :)


执行一个C#文件,你首先要编译它。编译器的名称是 csc ,可在%windir%\ Mesrosoft.NET \ Framework \v< version> $ c中找到$ C>。例如,.NET 4.0的编译器位于 v4.0.30319



编译C#文件在命令行中,执行以下操作:

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:
%windir%\Microsoft.NET\Framework\v<version>\csc file.cs /out:application.exe



更多信息:

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



编译完成后,可以执行.exe文件。


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

After compiling it, you can execute the .exe file.