Hey!
The docs indicate that the first time you right click to ask for the active ruleset, it will be automatically created.
I just did that and it did not, so I'm wondering if the docs are wrong, I've done something wrong or the docs are right under certain conditions?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Some pictures - attempting to set severity without a ruleset file generates the following dialog:

Also, the menu mentioned here does not exist:
Open the rule set file by double-clicking it in Solution Explorer, selecting Open Active Rule Set on the right-click menu of the Analyzers node, or by selecting Open on the Code Analysis property page for the project.

(VS2019 Preview 2.2, ASP.NET Core project)
I just tried in VS2017 and it worked, so this seems to be a regression.
@mavasani Can you take a look at this feedback for VS 2019?
This was a regression in VS2019 Preview2 which was recently fixed with https://github.com/dotnet/roslyn/pull/32990, and should work fine in the upcoming Preview3.
@mavasani Thanks for the quick clarification!
hey @gewarren, you haven't dealt with my question but closed the issue nonetheless...
can you please look at my original post and deal with that?
this has nothing to do with VS2019... Even the tag from the docs says 2017...
@TheBeardedLlama Apologies. From @Porges 's comments I assumed this was the same problem.
no worries, thank you for reopening 😃
There are couple of issues here:
Issue raised by @Porges - "Open Active Ruleset" command for old csproj style or non-SDK style projects regressed in VS2019 Preview2, and was fixed with the PR mentioned above.
Original issue raised by @TheBeardedLlama - NetCore/NetStandard projects OR the new SDK style projects do not support "Open Active Ruleset" command in the solution explorer.
Tagging @Pilchie @tmeschter @jinujoseph for 2. if we have any issue in https://github.com/dotnet/project-system/issues tracking it. Note that this is a comparatively low priority feature for us given our shift from ruleset based configuration to editorconfig based configuration - see https://github.com/dotnet/roslyn/issues/19618 to learn more about the differences between two format and the direction forward.
I think my original point has been lost...
Shall I close this one and start again? Or shall I restate my question here in an effort to make it clearer?
@TheBeardedLlama I think Manish captured your problem in point 2 here. If that is not correct, could you clarify which project type(s) you are not seeing the ruleset file get created when you choose Open Active Rule Set?
no worries @gewarren and apologies for the delay in replying
I wasn't trying to file a bug via docs, just trying to understand what's supposed to happen and under what circumstances, so I can then file the right issue/PR in the right place
I'm on VS2017 Pro and it was a ASP.Net (4.7.2) project
@mavasani I think I verified the behavior that @TheBeardedLlama is seeing. In VS 2017, in an ASP.NET (.NET Framework) project, if you select Analyzers > Open Active Rule Set, the MinimumRecommendedRules.ruleset file opens. But it doesn't get added to the project. If I make a change to the ruleset and then click Save, the file gets added to the project. Is this the intended behavior? Or is it different for some project types?
- Original issue raised by @TheBeardedLlama - NetCore/NetStandard projects OR the new SDK style projects do not support "Open Active Ruleset" command in the solution explorer.
I also ran into this issue; it would be helpful to have this clarified in the documentation if this is intended.
I'm seeing the same issue as @kierendixon in VS2017 version 15.9.9.
Is the "Open Active Ruleset" option supposed to be available for .NET Standard/Core projects in that version of Visual Studio?
If not, is there any other way, in a .Net Standard project, to import or share a .ruleset file that was used for .Net Framework projects?
@Greeng0 .NET Standard/Core projects do not support the UI commands in solution explorer related to ruleset files. However, you can still manually edit the project file and configure a ruleset for these projects, using a shared .ruleset file if required, see https://docs.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules?view=vs-2017#specify-a-rule-set-for-a-project.
In VS 2017, in an ASP.NET (.NET Framework) project, if you select Analyzers > Open Active Rule Set, the MinimumRecommendedRules.ruleset file opens. But it doesn't get added to the project. If I make a change to the ruleset and then click Save, the file gets added to the project. Is this the intended behavior? Or is it different for some project types?
Adding @tmeschter - I am not sure if the command was supposed to work for all flavors of managed projects or regressed some way down the line for ASP.NET (.NET Framework) project. @gewarren If he is not sure, I would recommend filing a bug in Roslyn repo for the same.
Thank you @mavasani, that works well enough as a workaround.
Do you know if there are plans to add those UI commands for .NET Standard and Core projects, or is it implied that we should adhere to the default rulesets?
Otherwise it would be quite tedious if we were intended to right click each rule in the Solution Explorer to adjust its priority, and then do that for each of our projects...
@Greeng0 I believe the plan is to soon move to using EditorConfig file for all the rule configuration. EditorConfig file does not support rule severity configuration as of today, but the C#/VB compiler and IDE teams are working towards adding that support soon. Once that is done, rulesets and ruleset editor will become a legacy configuration mechanism.
@Greeng0 By the way - the manual step for rulesets for .NET Standard and Core is only the part where you edit the project file and add CodeAnalysisRuleSet property. From there on, you can open the ruleset file in the ruleset editor UI in VS and make changes to the rules using the UI, and saving will apply the changes to the underlying ruleset.
@mavasani Thank you very much for the clarifications!
In VS 2017, in an ASP.NET (.NET Framework) project, if you select Analyzers > Open Active Rule Set, the MinimumRecommendedRules.ruleset file opens. But it doesn't get added to the project. If I make a change to the ruleset and then click Save, the file gets added to the project. Is this the intended behavior? Or is it different for some project types?
Adding @tmeschter - I am not sure if the command was supposed to work for all flavors of managed projects or regressed some way down the line for ASP.NET (.NET Framework) project. @gewarren If he is not sure, I would recommend filing a bug in Roslyn repo for the same.
@TheBeardedLlama Steven, please file an issue in the Roslyn repo for this behavior in an ASP.NET (.NET Framework) project where the ruleset file is not automatically added to the project.
@TheBeardedLlama @mavasani Sorry for the delay in replying. Some context may be helpful.
Effectively every C# or VB project defines the CodeAnalysisRulesetProperty. If you do nothing you get the default value, which resolves to MinimumRecommendedRules.ruleset. This file is part of the VS installation, and many different projects in many different solutions will end up referencing it. As such it is read-only; you wouldn't want a modification to a severity in one project to affect a whole bunch of unrelated projects.
So if you open and modify MinimumRecommendedRules.ruleset we will instead make a copy in your project directory, update CodeAnalysisRulesetProperty to point to it, and add the file to the project. The latter is just a matter of convenience for the developer--the .ruleset doesn't need to be an item in the project to be effective, but since we're making a copy we want you to be able to find it.
If the docs state that the file is created the first time you open it then that is incorrect. Rather, your project is _always_ using at least a default rule set, and if you try to modify one of the standard .ruleset files we will first copy it for you.
@tmeschter Thanks for the clarification.
I also added a note to the doc about the menu commands for .NET Core/Standard projects, and that will be live tomorrow at this time.
I think everything in this issue is now addressed, so I am closing it.
Most helpful comment
I also ran into this issue; it would be helpful to have this clarified in the documentation if this is intended.