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

How to suppress contentfiles flow? #8867

sungam3r opened this issue Dec 2, 2019 · 0 comments


Copy link

@sungam3r sungam3r commented Dec 2, 2019

Details about Problem

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): VS 2019

NuGet version (

dotnet.exe --version (if appropriate): 3.0.100

VS version (if appropriate): 16.3.8

OS version (i.e. win10 v1607 (14393.321)): Windows 10.0.14393 x64

Worked before? If so, with which NuGet version: -

Detailed repro steps so we can see the same problem

I have been using the PrivateAssets="all" option for a long time. It works great for PackageReference. Now I needed to use some content file in my project and I could not achieve the desired behavior with PrivateAssets="all". I want to build "base" package with one file data.json which should be consumed in "top" package but should not be exposed further to consumers of the "top" package.

My "base" package:

<Project Sdk="Microsoft.NET.Sdk">
    <Content Include="data.json">

The result seems to be good for me:

My "top" package:

    <PackageReference Include="BasePackage" Version="1.0.0">

The Result is unexpected for me:

Why is the file again in the content section? This file is a development dependency, some sort of settings file. The "base" package is a package with Roslyn analyzers and the settings file - data.json. I do not present the analyzers used for clarity. For them, PrivateAssets works as it should - they do not fall into the dependencies of the "base" package. But for the settings file - data.json, I can’t get the same behavior.

I spent a lot of time resolving this issue and it seems to me that I do not see any obvious solution, which is somewhere nearby. I will be very grateful for the advice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.