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

标签 c# visual-studio visual-studio-2015 c#-7.0

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/

相关文章:

c# - 由 C# EF 核心调用时的暂停选择查询,MSSQL 管理工作室可以很好地执行查询。为什么?

c# - 如何将空值从 CSV 文件传递​​给数据驱动的单元测试?

c# - 在 C# 中直接从文件加载字体

c# - 如何将数据随机绑定(bind)到单选按钮列表 asp.net

visual-studio - HoughCircles 在 OpenCV 中无法正确检测圆圈

c++ - 有没有可以将 Visual Studio 对象文件转换为 GCC 格式的工具?

c# - 从透明形式的图像中删除轮廓

c# - 线程调试窗口中没有显示任何线程

c# - 运行某些特定测试时 vstest 崩溃

visual-studio-2015 - 在 VS2015 中保存来自诊断工具的事件列表