question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Publish: PrivateAssets=All not honored on ProjectReference items

See original GitHub issue

Steps

  1. Create a new .NET Core Console App
  2. Add a new .NET Standard Class Library
  3. Reference the class library from the console app:
    <ProjectReference Include="..\ClassLibrary1\ClassLibrary1.csproj"
                      PrivateAssets="All" />
    
  4. Run dotnet publish on the console app.

Unexpected Results

  • ClassLibrary1.dll is copied to the the ‘publish’ directory.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:16
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

5reactions
nguerreracommented, Mar 8, 2017

Using Private=false metadata instead of ReferenceOutputAssembly=false should work for the compile against but do not copy semantic. (This is another data point that the term private is a poor choice for impacting copying. Classic reference metadata and nuget metadata are overloading it with opposite meaning. 😦)

0reactions
Turnerjcommented, Apr 17, 2021

I found a blog post which does go into a workaround for this with a custom target though it would be great if this worked out-of-the-box.

Read more comments on GitHub >

github_iconTop Results From Across the Web

msbuild PackageReference.PrivateAssets = All does not ...
I thought setting PrivateAssets = All would do it, but apparently I misunderstand how it works, because it does not have the desired...
Read more >
MSBuild reference for .NET SDK projects
This page is a reference for the MSBuild properties and items that you can use to configure .NET projects. Note. This page is...
Read more >
Dotnet pack - include referenced projects
Shows how to workaround the current limitations of dotnet pack when referencing other projects.
Read more >
Include both Nuget Package References *and* project ...
Recently I have been trying to generate more Nuget packages for our dotnet core projects, utilizing the dotnet pack command. One issue I...
Read more >
Solving the source generator 'marker attribute' problem
In this post I describe how I solved a problem I've been wrestling with around source generators: where to put the 'marker attributes'...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found