【发布时间】:2018-10-04 22:08:23
【问题描述】:
我使用命令行手动调用 C# 编译器来编译 C# 源文件。但是,编译坚持使用 C# 5。我使用 VS2017 的路径访问它,所以我希望它也能在更高版本的 C# 上工作。设置/langversion 属性似乎不起作用。
有什么帮助吗?
PS C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\Roslyn> csc
Microsoft (R) Visual C# Compiler version 4.7.2558.0 for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.
This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240
warning CS2008: No source files specified error CS1562: Outputs without source must have the /out option specified
.. 但仅支持 C# 5 以下的语言版本
【问题讨论】:
-
嗯,你似乎做对了,那个目录有最新版本的 csc.exe。告诉我们该文件的文件大小和时间戳,以及您是否使用了开发人员命令提示符。 “PS”不太令人鼓舞。