我想使用命令提示符编译 C# 文件
I want to compile a C# file using command prompt
我写了一个简单的 C# 文件。当我使用命令提示符编译它时,出现错误
'csc' is not recognized as an internal or external command, operable program or batch file.
需要设置环境变量吗?
当您安装 Visual Studio 时,它附带了一个批处理文件,可以为您设置环境并打开 cmd window。它称为 Developer Command Prompt for VS201x
(其中 x 是您拥有的 Visual Studio 版本)。它位于 Visual Studio 工具菜单中,通常位于:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Visual Studio 201x\Visual Studio Tools
这是结果:
编辑:
如果您没有安装 Visual Studio,您仍然可以在 Windows 8 中访问 .NET Framework 附带的 C# 编译器。您可以在以下位置找到它:
C:\Windows\Microsoft.NET\Framework\v4.0.30319
否则您可以手动安装。这是 link
之后你需要做的就是将它添加到你的环境变量中 path
希望对您有所帮助。
我写了一个简单的 C# 文件。当我使用命令提示符编译它时,出现错误
'csc' is not recognized as an internal or external command, operable program or batch file.
需要设置环境变量吗?
当您安装 Visual Studio 时,它附带了一个批处理文件,可以为您设置环境并打开 cmd window。它称为 Developer Command Prompt for VS201x
(其中 x 是您拥有的 Visual Studio 版本)。它位于 Visual Studio 工具菜单中,通常位于:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Visual Studio 201x\Visual Studio Tools
这是结果:
编辑:
如果您没有安装 Visual Studio,您仍然可以在 Windows 8 中访问 .NET Framework 附带的 C# 编译器。您可以在以下位置找到它:
C:\Windows\Microsoft.NET\Framework\v4.0.30319
否则您可以手动安装。这是 link
之后你需要做的就是将它添加到你的环境变量中 path
希望对您有所帮助。