VS2015 + Resharper:不要使用C#6(VS2015 + Resharper: Don't use C#6)
我目前正在测试VS2015以了解它如何与我们的解决方案做出反应。 我遇到了一些麻烦,因为VS2015带来了C#6,这是我还不能使用的(因为我的同事没有这个,因为我们的构建机器在几个月前也没有这个功能)。
我看到我应该能够为每个项目语言版本指定C#5。 我为我们所有的项目(其中270个)做过。 现在,当我用C#6编译功能时,出现错误,这很好。
但是,resharper不断尝试让我使用表达式身体的属性,字符串插值,...
Resharper有没有提出这种改变的方法?
I've currently to test VS2015 to see how it reacts with our solution. I've some trouble because VS2015 brings C#6, which I cannot yet use(because my colleagues don't have this, because our build machine will also not have it before months).
I saw that I should be able to specify for each project language Version to C#5. I did it for all our projects(270 of them). Now when I compile with a C#6 feature, I've an error, which is good.
But, resharper keep trying to make me use Expression body for properties, string interpolation, ...
Is there a way that Resharper don't propose this kind of changes?
最满意答案
所以我明白你只是禁用了Roslyn的C#6支持:
项目属性/编译/高级/语言版本 。
但是您还必须通过在解决方案资源管理器中选择一个项目,然后在属性窗口中更改以下内容,告诉ReSharper不要提示C#6功能(请参阅注释 ):好消息是,您可以在解决方案资源管理器中一次选择多个项目。
So I understand you just disabled C#6 support in Roslyn using:
Project Properties/Build/Advanced/Language Version.
But you also have to tell ReSharper to not suggest C#6 features(see comments) by selecting a project in the solution explorer, and then changing the following in the properties window:The good news is that you can select multiple projects at once in the solution explorer.
相关问答
更多-
使用Resharper更改VS2015名称中C#属性的颜色(Changing the color of C# Properties in VS2015 names using Resharper)[2022-07-03]
此功能实际上源于ReSharper,但它也耦合到VisualStudio的选项对话框。 您需要启用ReSharper选项| 代码检查| 设置。 之后修改代码(以触发突出显示),并且可以从VisualStudio选项自由配置所需的所有颜色。 顺便说一下,属性的条目是'ReSharper Field Identifier'。 在各种情况下,自定义颜色真的很方便,例如,将实际方法与扩展方法,类与接口(如果不遵循DTE命名约定)或参考类型的值类型分开。 This feature actually originate ... -
看起来这些博客文章写的语法略有改变。 如错误信息所示,添加static到您的include语句: using static System.Console; // ^ class Program { static void Main() { WriteLine("Hello world!"); WriteLine("Another message"); } } 然后,您的代码将编译。 请注意,这只适用于声明为static成员。 ...
-
vs2015的新安装没有帮助。 全新安装的win10 + vs2015完成了这项工作:-( 失去了很多个小时但又回来了! New install of vs2015 didn't help. Fresh install of win10 + vs2015 did the job :-( Lost many hours but back running!
-
无法使用VS2015和resharper运行specflow测试?(Trouble running specflow tests with VS2015 and resharper?)[2022-07-10]
它是Resharper 10(以及9的某些版本)和Specflow(绑定)的已知问题 上周我花了很多时间用它撞墙(有人决定升级到R#10,所有地狱都因测试而破裂) 经过几个小时的游戏,我发现某些版本适用于某些版本的specflow(目前)..版本网格图片(Selenium到Resharper版本组合工作) http://i.stack.imgur.com/Zxh9G。 png (文字,我不能发布超过2个链接-_-) 这有望成为一个短期问题(对于VS 2013/2015),因为有一些看起来像正在进行的修复。 ... -
您可以通过转到Properties => Build tab => Advanced button => Language Version并设置您的首选版本来单独设置每个项目的语言功能。 您应该意识到,它仍将使用新的“C#6.0”.Net编译器平台(代号为Roslyn)。 但是,该编译器将模仿较老的编译器的行为,并将限制您只能使用该特定语言版本的功能。 我不认为有一个解决方案范围的设置可用。 You can set the language feature for each project separate ...
-
VS2015可变模板错误?(VS2015 Variadic templates bug?)[2023-04-06]
我已将您的代码修改为工作示例(未经过100%测试) templatebool is_any_test_impl(T t) { return false; } template bool is_any_test_impl(T1 t1, T2 t2, Args&&... args) { return t1 == t2 || is_any_test_impl(std::forward (t1),std: ... -
未能升级VS2015的nuget 这个问题应该是核心visual studio可扩展性中的一个错误或问题。 这不是NuGet特定的问题。 它通常与诸如反病毒或加密服务等相关 。 我想在这里提供一些故障排除: 以管理员身份登录到计算机,并使用管理员启动Visual Studio。 检查您的计算机是否安装了McAfee Endpoint Encryption full-disk encryption product ,而不是防病毒软件。 如果是,则应该从全盘加密中排除devenv.exe和VSIXInstall ...
-
所以我明白你只是禁用了Roslyn的C#6支持: 项目属性/编译/高级/语言版本 。 但是您还必须 通过在解决方案资源管理器中选择一个项目,然后在属性窗口中更改以下内容, 告诉ReSharper不要提示C#6功能 (请参阅注释 ): 好消息是,您可以在解决方案资源管理器中一次选择多个项目。 So I understand you just disabled C#6 support in Roslyn using: Project Properties/Build/Advanced/Language Vers ...
-
parent?.X类型parent?.X是float? ,你要添加到float - 导致另一个float? 。 这不能隐式转换为float 。 虽然Yuval的答案应该有效,但我会亲自使用以下内容: get { return (parent?.X ?? 0f) + position.X; } 要么 get { return (parent?.X).GetValueOrDefault() + position.X; } 我不确定你的设计,请注意 - 你在吸气器中添加东西而不是在设置器中添加 ...
-
在VS2015中使用Target 4.5,但我可以使用C#6功能?(Target .Net 4.5 in VS2015 but I am allowed to use C# 6 features?)[2022-09-15]
C#6等字符串插值功能是编译器功能,而不是运行时(CLR)功能。 因此,只要您的编译器支持C#6,您就可以使用它们而不管您构建的.NET版本。 在Visual Studio 2015中,您可以在Properties => Build tab => Advanced button => Language Version控制您所定位的Language Version C# 6 features such as string interpolation are compiler features, not run ...