gpt4 book ai didi

c# - 如何在 Visual Studio 2015 中使用 C# 7?

转载 作者:IT王子 更新时间:2023-10-29 03:32:29 24 4
gpt4 key购买 nike

Visual Studio 2017 (15.x) 支持 C# 7,但 Visual Studio 2015 (14.x) 呢?

我如何使用它来使用 C# 7?

最佳答案

您可以通过安装 Nuget 包 Microsoft.Net.Compilers 将 Visual Studio 随附的编译器替换为支持 C# 7 的版本:

Referencing this package will cause the project to be built using the specific version of the C# and Visual Basic compilers contained in the package, as opposed to any system installed version.

没有迹象表明我可以在包页面上看到它是否在 Visual Studio 2015 中得到正式支持。到目前为止我的不彻底测试表明它可以工作但并非无痛 - C# 7 代码编译,但有下划线带有表示语法错误的红色波浪线: Screenshot请注意,您还需要安装 Nuget 包 System.ValueTuple使用新的 C# 7 值元组功能。

关于c# - 如何在 Visual Studio 2015 中使用 C# 7?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39461407/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com