Disable "Name can be simplified" IDE0003 fix hint
You can use a ruleset file to disable any analysis if you know its diagnostic id (in this case 'IDE0003')
On the
References
node of you project right click onAnalyzers
and selectOpen Active Rule Set
Once the ruleset editor is open just search for
IDE0003
and uncheck the checkbox. Then save the ruleset file. Then save the project.
- The following XML will be added to you project file. You can add this ruleset file to any project where you want this rule disabled.
<CodeAnalysisRuleSet>ConsoleApp9.ruleset</CodeAnalysisRuleSet>
Looks like the current process is more complicated for .NET Core and .NET Standard projects.
From MS VS Docs:
If you have a .NET Core or .NET Standard project, the process is a little different because there's no Code Analysis property tab. Follow the steps to copy a predefined rule set to your project and set it as the active rule set. After you've copied over a rule set, you can edit it in the Visual Studio rule set editor by opening it from Solution Explorer. [emphasis mine]
Taking the first link in that quote will eventually take you, after a little sleuthing, to Code style rule options, that finally tells you how to add the file:
In Visual Studio, you can generate this file and save it to a project at Tools > Options > Text Editor > [C# or Basic] > Code Style > General. Then, click the Generate .editorconfig file from settings button.
NOTE: This produces a tiny warning just under your toolbars that an
.editorconfig
has been added to your solution. Select the "Yes" button to include it in your solution.
And now you can open and edit your new .editorconfig
file.
Looks like this is the "offending" section:
# this. and Me. preferences
dotnet_style_qualification_for_event = false:suggestion
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_method = true:suggestion
dotnet_style_qualification_for_property = false:suggestion
If that dotnet_style_qualification_for_property
is changed to = true:suggestion
(explanation here), I think you're golden [at least for properties, of course -- make edits as appropriate].