3

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" ]
    },
Skorunka František
  • 5,102
  • 7
  • 44
  • 69

1 Answers1

6

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

Skorunka František
  • 5,102
  • 7
  • 44
  • 69
  • This appears to only work for the StyleCop Analyzer, right? Have you found any way to get old Code Analysis (CAxxxx) rules to run in .NET Core projects. – StriplingWarrior Jun 23 '17 at 16:43
  • Nevermind, it looks like you can just add `true` to make those rules work. https://stackoverflow.com/a/44726528/120955 – StriplingWarrior Jun 23 '17 at 16:58