Visual Studio Enterprise 2015 中的 C# 7.0

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

<分区>

您可以在 Visual Studio 2015 (Enterprise) 中启用 C# 7.0 功能还是需要升级到 2017?

最佳答案

是的,您可以通过安装 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 值元组功能。

关于Visual Studio Enterprise 2015 中的 C# 7.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42156603/

相关文章:

c# - Google Drive API 上传/创建文件 (.NET)

c# - 什么是 F# 尾调用?为什么它比 C# 有性能提升?

asp.net - 需要安装Dnx Runtime软件包。请参阅输出窗口以获取更多详细信息

ios - visual studio cordova 部署到 ios 设备失败和 visual studio 崩溃

visual-studio-2015 - fopen 用于写入但不独占

c# - 一劳永逸地修复 NuGet 包和引用

c# - 如何遍历表格来输入数据

c# - 追踪 NaN float 的原因

visual-studio - Visual Studio : Is there a way to Perform a "Find in files" with one single shortcut?

c++ - 访问冲突读取位置 0xfeef002A