none
Default Analyzers When Creating New Project RRS feed

  • Question

  • Hello,

    I searched the forums, but could not find an answer to this question:

    When I create a new project (say a .Net Framework console application) the Solution Explorer shows an "Analyzers" node under "References". I can right-click the Analyzers node and select "Open Active Rule Set" to view what I imagine are the "Microsoft Managed Recommended Rules", I say this because I can get to the same view by going to Project Properties, selecting the Code Analysis tab and then clicking "Configure" that appears next to the "Active rules" drop down that displays that same rule set name.

    My question is, what is the relationship of that Analyzer node and those rules to my project? They are not installed as packages because when I install analyzers as packages I can expand the Analyzer node to display the rules. Are these default analyzers only associated with the IDE and if so, why does that Analyzer node appear beneath "References"? Why not just use the Project Properties dialog to navigate to the rule set?

    Thanks!

    Saturday, November 2, 2019 4:30 PM

All replies

  • Hi JSChicago,

    Sorry for delay in reply.

    >>what is the relationship of that Analyzer node and those rules to my project?

    The rules are used to mention some potential errors and warnings live when edit your code in the editor. And the Analyzer node is used as a reference to add custom analyzer into your project and help you modify active ruleset quickly.

    >>Are these default analyzers only associated with the IDE and if so, why does that Analyzer node appear beneath "References"?

    The default analyzer is an assembly saved in VS installation path. So it would be as reference in your project. And it would not be copied to project path, unless you change it, and it will be referred and copied into your project. 

    >>Why not just use the Project Properties dialog to navigate to the rule set?

    It is by designed. We could add, edit and enable ruleset in properties page, however, in solution explorer, we could add custom analyzer and edit active ruleset, it could provide a quick way to modify current ruleset.

    Hope it could help you.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Monday, November 4, 2019 3:45 AM
  • Hi JSChicago,

    Is Dylan’s explanation helpful for you to understand further? if you have any confusion about this issue and maybe we are not clarify much clear, please feel free to let us know.

    As Dylan said above, the Analyzers node beneath References is designed for developers to quick access and configure. As a feature for projects, it is also been classified to Project’s Properties -> Code Analysis.

    Like you said, the Analyzers node could be expend if you install analyzers as a NuGet package. But you could still use default analyzers if you do not install analyzer as a NuGet package. This is because Visual Studio help you to find and refer local dll/ruleset files from VS Team Tools folder. Maybe not display like other references but, in a sense, it belongs to References and provides the feature what “references” do.

    Hope all above could help you.

    Best Regards,

    Tianyu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, November 8, 2019 8:01 AM