Supporting Roslyn Analyzers(.ruleset) in Visual St

2020-04-11 11:10发布

问题:

How to add support for Roslyn Analyzers(.ruleset) in Visual Studio 2017 .NET Core Projects? In "project.json" it is configured by using buildOptions:

    "buildOptions": {
        "additionalArguments": [ "/ruleset:rules.ruleset" ]
    },

回答1:

Just edit the .csproj file and add: <PropertyGroup><CodeAnalysisRuleSet>rules.ruleset</CodeAnalysisRuleSet></PropertyGroup>

Note: path is relative to a .csproj file.

Original post here: https://www.linkedin.com/pulse/supporting-roslyn-analyzers-visual-studio-2017-net-core-jake-brandt