如何在Windows命令提示符下执行C#文件? [英] how to execute C# file in windows command prompt?
本文介绍了如何在Windows命令提示符下执行C#文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Windows命令提示符下不在VS中执行C#文件。
I want to execute C# file in windows command prompt not in VS.
推荐答案
您可以使用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 iscsc
and can be found in%windir%\Microsoft.NET\Framework\v<version>
. For example, the compiler for .NET 4.0 is inv4.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.
这篇关于如何在Windows命令提示符下执行C#文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文