Language level is overridden by Rider Settings to "C# 4.0"

Answered

My Rider instance keeps overriding the language level of any new projects to C# 4.0. This means every time I open a new project or open a new solution with projects already in it, I get a lot of errors regarding the C# version. I have to - for each single project - go to the property settings, click 'Reset' and a .DotSettings file is added. It works, but this way of working is really annoying and shouldn't be necessary.

I have the .NET 6.0 SDK (Microsoft .NET SDK 6.0.101) installed (among others), and made sure that the corresponding MSBuild version (17.0) is configured (in File > Settings > Build, Execution, Deployment > Toolset and Build), since I saw in other posts that that could cause the issue. This isn't the case in my situation.

Does anyone have a solution for this? Would be really helpful!

0
5 comments

Hello Peter,

Thank you for contacting Rider support.

I assume you have a wrong MSBuild set on the global level of Rider settings. Would you mind verifying if you have a correct path to MSBuild in `GlobalSettingsStorage.DotSettings` file? To find it, please select `Help | Diagnostic Tools | Special Files and Folders` and double click on `R# global settings`. In the folder opened you will find it.

`<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/CustomBuildToolPath/@EntryValue">{path}</s:String`>

If you have a wrong path here, please open `File | Settings | Build, Execution, Deployment | Toolset and Build`, ensure the correct MSBuild is selected, click the arrow button which is next to `Save`, select `This computer`. It will update the global settings to use the correct MSBuild by default.

If the above does not help, would you mind sharing the additional information as described below?

* Collect Rider logs via `Help | Collect Logs` after reproducing the problem;
* Upload the archive generated to the [Upload Service](https://uploads.jetbrains.com/) and let me know the Upload ID.
* Share a screenshot of the above settings page;

I will be waiting for your response, have a nice day!

0

Hello Dmitry, thanks for your quick reply!

I tried the steps you described in your comment - but they didn't work. I could see in the Rider settings - and the GlobalSettingsStorage.DotSettings - that the MSBuild version was updated properly, but the issue still occurred.

Because I'm working for a client and bound by confidentiality agreements, I did not feel comfortable exporting and sending the logs. I therefore tried the following steps as well:

  • I uninstalled Rider, removed all Rider-related files (including the GlobalSettingsStorage.DotSettings) and re-installed Rider. This had no effect, unfortunately, the issue still occurred;
  • I checked the .DotSettings file that was generated when clicking the 'Reset' button in the screenshot above. It generated a .DotSettings file on project/solution level in which the key '/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue' was set to value 'Default'. I then looked up that configuration in the GlobalSettingsStorage.DotSettings and updated the value to Default there as well. The original value was indicating C#4.0 - I don't remember the exact syntax anymore.

The last bullet above seems to have done the trick - the only drawback was that I now need to/can remove all project/solution level .DotSettings files, but that's fine!

Is there a setting accessible via Rider's File > Settings menu where I can manage the default language version? Or did I do it correctly by updating the GlobalSettingsStorage.DotSettings?

Thanks in advance for your reply!

0

Hello Peter,

Thank you for the details shared. Apologies for not responding earlier. 

There is no option in Rider settings to manage the default language version per-IDE or per-machine, but only per-project (The window where you saw `Reset` button).
It is strange that you have the mentioned(LanguageLevel) entry in GlobalSettingsStorage.DotSettings. Ideally, you should not have this entry in global .DotSettings file and we can only assume how it might appear there. 

Would you mind trying to backup this file and removing the mentioned entry?
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">Default</s:String>
It is better to leave it without this entry. If you would notice any related issues, you can revert the settings file back.

Would you mind letting us know the following details?

  • do you work with Unity projects?
  • did you use ReSharper extension with Visual Studio?

Thank you in advance and have a nice day!

0

Hi Dmitry,

Thanks again for your reply. I've updated the GlobalSettingsStorage.DotSettings to remove the CSharpLanguageProject entry and I've created a new, empty net6.0 console application to test if it overrides the version. Somehow, now, the version that is selected is C# 10.0, so it still seems to be working correctly. I have recently installed Visual Studio 2022 and installed a new dotnet SDK, maybe this fixed the issue in the background.

To answer your questions:

  • I do not work with Unity projects;
  • I have not used the ReSharper extension in Visual Studio 2022 or Visual Studio 2019;

Thanks for thinking with me! I'll keep the GlobalSettingsStorage.DotSettings file without the LanguageLevel-entry, and see if I run into any issues later on - but for now, it seems to work correctly.

0

Hello Peter,

Thank you for keeping me posted.
I am happy to hear that the issue is resolved. Should you have any other questions or difficulties in the future, do not hesitate to contact support.

Have a nice day!

0

Please sign in to leave a comment.