代码之家  ›  专栏  ›  技术社区  ›  Wouter van Koppen

如何让命令行C#编译器为C#version>5工作?[副本]

  •  0
  • Wouter van Koppen  · 技术社区  · 6 年前

    为了编译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
    

    1 回复  |  直到 6 年前
        1
  •  3
  •   user247702    6 年前

    您的Visual Studio安装或生成工具安装已过期。

    PS C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn> .\csc
    Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f2354)
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    warning CS2008: No source files specified.
    error CS1562: Outputs without source must have the /out option specified