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

Code Analysis assemblies in NuGet package

$
0
0

I created a custom NuGet package containing a packagereference to an analyzer assembly using a targets file:

<Project>
  <ItemGroup>
    <PackageReference Include="SonarAnalyzer.CSharp" Version="8.3.0.14607">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>
</Project>

If I include this package in my solution and build, I see the analyzer warnings.

However, if i run dotnet build, it doesn't give any analyzer warnings.

If I include the analyzer package directly in my project, I get the warnings both in Visual Studio and command line.

What is the difference between a visual studio build and a dotnet build? I tried the UseCodeAnalysis=true parameter, but this doesn't work. Is there any other property I should set?


Viewing all articles
Browse latest Browse all 3117

Trending Articles



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