Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify C# version in ReSharper

Tags:

resharper

I'm slowly migrating projects to VS2017 from VS2015. We have distributed team and until all is verified (there are issues with e.g. Reporting Services, SSIS, etc as there is not fully finished tooling - SSDT) I need the projects could work in VS2015 without changes.

C# projects in VS2017 use latest C# version by default in project settings (in my case it is C# 7.1) and ReSharper started to offer refactoring to these new features. However, I need to resist the temptation and wait until all is migrated (while I still need to be able to write and review code). I need to specify the version of C# to be 6.0. I can do it on per project basis but I would like to avoid this as I would have to go through each project, modify it and push it to source control and when the migration is done then I would have to switch it back.

Is there a way in R# to globally set the C# version in options (haven't found such a setting but maybe there's some hidden option?)

(VS2017 - 15.4.5, ReSharper 2017.2.2)

EDIT For Typescript there is possibility to specify language level - either auto-detection or exact version. So for C# it could be similar - auto-detection from project settings or exact version. It would allow code review for specific language version without modification of the projects.

I'm adding here also the link to R# support page as I asked there too

like image 815
eXavier Avatar asked Nov 30 '17 09:11

eXavier


People also ask

What does #define do in C?

The #define creates a macro, which is the association of an identifier or parameterized identifier with a token string. After the macro is defined, the compiler can substitute the token string for each occurrence of the identifier in the source file.

What is #define in C++ with example?

#define allows you to make text substitutions before compiling the program. Here's an example : #define MAX 70. Before compilation, if the C++ preprocessor finds MAX as one word (so words like MAXIMUM will not be affected), in the source code, it replaces it with the number 70.

What is the use of #define directive in C?

In the C Programming Language, the #define directive allows the definition of macros within your source code. These macro definitions allow constant values to be declared for use throughout your code. Macro definitions are not variables and cannot be changed by your program code like variables.


1 Answers

Add the following string to solution settings file ({Solution name}.sln.DotSettings file in the solution's root folder)

<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp60</s:String>

like image 53
Alexander Kurakin Avatar answered Nov 11 '22 18:11

Alexander Kurakin