Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Ruleset deployed via NuGet Package not applied

$
0
0

I created a NuGet Package to share a ruleset for StyleCop.Analyzers within our projects as described here: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/Configuration.md#sharing-configuration-among-solutions(Except i use $(MSBuildThisFileDirectory) instead of $(CodeAnalysisRuleSetLocation))

The files:

LDBV.CodeAnalysis.RuleSet.nuspec

<?xml version="1.0"?><package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"><metadata minClientVersion="2.5"><id>LDBV.CodeAnalysis.RuleSet</id><version>0.1.15311</version><authors>[...]</authors><owners>LDBV</owners><requireLicenseAcceptance>false</requireLicenseAcceptance><developmentDependency>true</developmentDependency><description>[...]</description><copyright>Copyright &#169;2019 LDBV</copyright><dependencies><dependency id="StyleCop.Analyzers" version="1.1.118" /></dependencies></metadata><files><file src="stylecop.json" target="" /><file src="LDBV.ruleset" target="" /><file src="LDBV.CodeAnalysis.RuleSet.props" target="build" /></files></package>

LDBV.CodeAnalysis.RuleSet.props

<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)..\LDBV.ruleset</CodeAnalysisRuleSet></PropertyGroup><ItemGroup><AdditionalFiles Include="$(MSBuildThisFileDirectory)..\stylecop.json" Link="stylecop.json" /></ItemGroup>

LDBV.ruleset

<?xml version="1.0" encoding="utf-8"?><RuleSet Name="LDBV RuleSet" Description="" ToolsVersion="14.0"><Include Path="minimumrecommendedrules.ruleset" Action="Default" /><Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers"><Rule Id="SA1308" Action="Hidden" /><Rule Id="SA1310" Action="None" /> <!-- Field 'SOME_CONSTANT' should not contain an underscore --><Rule Id="SA1600" Action="None" /><Rule Id="SA1601" Action="None" /><Rule Id="SA1602" Action="None" /> <!-- Enumeration items should be documented --><Rule Id="SA1633" Action="None" /><Rule Id="SA1652" Action="None" /></Rules></RuleSet>

stylecop.json

{"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json","settings": {  }}

The problem:

This works well in Visual Studio.But on our Jenkins Buildserver the rulefile is not served to the compiler for projects migrated to SDK-Style. (at least that is the behaviour i seem to see)

Old-Style projects receive a call to the compiler like

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Roslyn\csc.exe [..] /ruleset:C:\Users\ServiceJenkins\.nuget\packages\ldbv.codeanalysis.ruleset\0.1.15311\LDBV.ruleset 

SDK-Style projects do not receive the parameter /ruleset:[...]

Do i miss some property that should be set in SDK-Style projects, or what may cause such a behaviour?

BuildTools Version is 16.8.1 (latest)


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>