本文介绍了如何在 Visual Studio 2015 中禁用 C# 6 支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个项目,我们正在 VS 2015 中开发并启用 C#6,有时需要由使用 VS 2013 而不使用 C#6 的开发人员打开.

We have a project that we're developing in VS 2015 with C#6 enabled that occasionally needs to be opened by developers using VS 2013 without C#6.

我们无意在这个特定的解决方案中使用 C# 6(只要我愿意).

We have no intention to use C# 6 within this particular solution (as much as I'd like to).

Visual Studio 和 ReSharper 建议使用有用的 C# 6 语言结构,这些结构使解决方案在没有 C#6 支持的早期版本的 Visual Studio 中无法运行.

Visual Studio and ReSharper suggest helpful C# 6 language constructs that render the solution inoperable in earlier versions of Visual Studio without C#6 support.

我已经禁用了 ReSharper C#6 支持但是我似乎无法在整个解决方案中禁用/限制 C# 功能.

I've disabled the ReSharper C#6 support but I can't seem to disable / limit C# features across the whole solution.

如何在解决方案或 Visual Studio 2015 中将 C# 功能限制为 C#5?

How do I limit C# to C#5 capabilities within a solution or within Visual Studio 2015?

推荐答案

您可以通过转到 Properties => 为每个项目分别设置语言功能.构建选项卡 =>高级按钮 =>语言版本并设置您的首选版本.

You can set the language feature for each project separately by going to Properties => Build tab => Advanced button => Language Version and set your preferred version.

您应该意识到它仍将使用新的C# 6.0".Net 编译器平台(代号为 Roslyn).但是,该编译器将模仿旧编译器的行为,并将限制您使用仅在该特定语言版本上可用的功能.

You should realize that it will still use the new "C# 6.0" .Net Compiler Platform (codenamed Roslyn). However, that compiler will imitate the behavior of older compilers and will limit you to features only available on that specific language version.

我认为没有可用的解决方案范围的设置.

I don't think that there's a solution-wide setting available.

这篇关于如何在 Visual Studio 2015 中禁用 C# 6 支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-05 10:20