Add code analysis ruleset through nuget package

后端 未结 3 685
南旧
南旧 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:21

    There's no need to script this. Both the ruleset and dictionary can be registered via an imported MSBuild .props file, as described here https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package#include-msbuild-props-and-targets-in-a-package

    For example, your NuGet source folder structure might look like this (assuming "CodeAnalysisSettings" is your package ID):

    • build
      • CodeAnalysisSettings.props
    • content
      • MyCustomDictionary.xml
      • MyRules.ruleset

    where the contents of CodeAnalysisSettings.props are something like the following:

    
        
            true
            MyRules.ruleset
        
        
            
        
    
    

提交回复
热议问题