How to manage Code Analysis rules ? #73545
-
Task is to manage existing or add new rules, while keeping the default set of rules enabled by default . The following seems to be supposed to work, but how to determine the AnalyzerId and Namespace by rule ID ? Directory.Build.props
NETAnalyzers.ruleset
Documentation is sparse, i also searched in this and https://github.com/dotnet/roslyn-analyzers repos and didn't find that . |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Ruleset is somehow legacy. Visual Studio has a designer for it and you can use as a reference. The latest way is |
Beta Was this translation helpful? Give feedback.
-
@huoyaoyuan ty for response. i did try this for extracting the reference data, but it doesn't contain a large set of items, specifically all that start with i saw this. are default values for whether to run each custom rule can be specified in file which can be passed to project operations by |
Beta Was this translation helpful? Give feedback.
There are more documentation at https://learn.microsoft.com/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules https://learn.microsoft.com/cpp/code-quality/using-rule-sets-to-specify-the-cpp-rules-to-run .
The IDE analyzers are integrated differently with CA analyzers. Try
EnforceCodeStyleOnBuild
MSBuild property may help.