I'm trying to use custom ruleset file form our nuget package. I've added to the build folder of the package .props file:
<Project>
<PropertyGroup>
<CodeAnalysisRuleSet>
$(MSBuildThisFileDirectory)..\My.Shared.ruleset
</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
</Project>
Rule set file is in the package root folder, the paths are correct, it's adding import of the .props file into csproj file.
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\My.Shared.Rulesets.1.0.0.7118\build\My.Shared.Rulesets.props" Condition="Exists('..\packages\My.Shared.Rulesets.1.0.0.7118\build\My.Shared.Rulesets.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
...
But Visual Studio is not seeing correct rule set. When I open active rule set from References -> Analyzers, it's pointing to different file: MinimumRecommendedRules.ruleset and it's using rules from this file not my custom one.
- Visual Studio Comunity 2017 Version 15.5.0
- Project Target framework 4.6.1