Add code analysis ruleset through nuget package

后端 未结 3 681
南旧
南旧 2020-12-09 12:52

I\'m trying to build a NuGet package that adds our company\'s code analysis dictionary automatically and updatable.

The rule set is added in the content folder and n

3条回答
  •  鱼传尺愫
    2020-12-09 13:15

    I had the same problem as reported in the comments: the dictionary was added as content, not as a CodeAnalysisDictionary.

    I added this piece of code in the install.ps1 of the nuget package to solve this:

    $dictionary = $project.ProjectItems | Where-Object {$_.Name.EndsWith("CustomDictionary.xml")}
    $dictionary.Properties.Item("Buildaction").Value = [int]5;
    

提交回复
热议问题