Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling stylecop referenced via dependency #2925

Closed
sakopov opened this issue Apr 1, 2019 · 3 comments
Closed

Disabling stylecop referenced via dependency #2925

sakopov opened this issue Apr 1, 2019 · 3 comments
Labels

Comments

@sakopov
Copy link

sakopov commented Apr 1, 2019

I have project A and project B, which references it. Project A uses StyleCop code analyzer. Project B does not. When project A is built StyleCop rules are executed and I get build warnings. How do I stop StyleCop from executing in the host project?

@sharwell
Copy link
Member

sharwell commented Apr 1, 2019

You need to set PrivateAssets="all" on the PackageReference, like this:

<PackageReference Include="StyleCop.Analyzers" Version="1.1.1-rc.108" PrivateAssets="all" />

@sakopov
Copy link
Author

sakopov commented Apr 1, 2019

Slightly different syntax, but I'm already doing this.

    <PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta009">
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>

Still no dice as StyleCop analyzers flow to whatever project is consuming it.

Looks like it may be related to a known nuget issue.

@sakopov
Copy link
Author

sakopov commented Apr 2, 2019

Closing, since it's unrelated to StyleCop, but is a known issue in Nuget [1].

[1] dotnet/sdk#968 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants