ReSharper: setting C# language level for Solution

我只是一个虾纸丫 提交于 2019-11-28 23:53:29

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/31574543/resharper-setting-c-sharp-language-level-for-solution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!