Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReSharper: setting C# language level for Solution

Further to this question, I have lots of projects inside a solution and I dont want to create a dotsettings file for each project. Can anyone help me set the C# Language Level on a solution level.

This is relevant for me as I downloaded VS2015 today and ReSharper is offering me useful refactor suggestions based on targeting C# 6 and my projects are using C#5.

like image 700
Christo Avatar asked Jul 22 '15 21:07

Christo


People also ask

Does ReSharper work with C?

ReSharper by Language: C++ C++ support includes C, C++03, C++11, C++14, C++17, C++/CLI, and partially C++20. ATL, MFC and COM projects are supported.

How do I change my ReSharper settings?

To configure the main set of ReSharper preferences In the Visual Studio menu, choose ReSharper | Options. In the Options dialog that appears, select a node in the left pane and configure settings in the right pane. Use the search box in the left top corner to find a specific preference.

Where are ReSharper settings stored?

...the settings are stored in "%userprofile%\application data\jetbrains\resharper\v4.

How do I optimize ReSharper?

Open Visual Studio options (Tools | Options) and configure the preferences as follows: Environment | General: disable Automatically adjust visual experience based on client performance, disable Enable rich client visual experience, enable Use hardware graphics acceleration if available.


2 Answers

I added below settings in .sln.DotSettings

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

This line was added to .csproj.DotSettings when I tried to disable c#6 for a particular project. After adding this line in .sln.DotSettings resharper is reporting an error whenever I am trying to use c# 6.0 feature.

like image 176
harishr Avatar answered Sep 22 '22 13:09

harishr


According to Jetbrains documentation about C# default version, you can specify the target C# version explicitly by selecting the project in the Solution Explorer and using the C# Language Level property in the Visual Studio's Properties window.

like image 30
Afshin Avatar answered Sep 22 '22 13:09

Afshin