J4N
J4N

Reputation: 20727

VS2015 + Resharper: Don't use C#6

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?

Upvotes: 4

Views: 957

Answers (2)

citizenmatt
citizenmatt

Reputation: 18583

ReSharper will use the default C# level of the project. By default, this is not set, meaning it always floats up - so VS2015 uses C# 6. So you can specify the language version via project properties → Build → Advanced → Language Version (which sets the property in the .csproj file) and ReSharper will honour that setting.

However, ReSharper doesn't get notified that the value has changed, so does not update on-the-fly, but it will honour the setting on project/solution reload.

Alternatively, as per @lucas-trzesniewski's answer, you can override the project's LangVersion (or default, lack of LangVersion) by telling ReSharper directly what C# version it should target.

Upvotes: 2

Lucas Trzesniewski
Lucas Trzesniewski

Reputation: 51330

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:

properties window

The good news is that you can select multiple projects at once in the solution explorer.

Upvotes: 5

Related Questions