How to use Project-to-Project references in nuget packages with .NET Core CLI SDK
Out of the box the dotnet pack command (from the .Net Core CLI) treat every project in the Visual Studio solution as its own Nuget package.
Project-to-project references aren’t packaged inside the project. Currently, you must have a package per project if you have project-to-project dependencies. - .NET Core CLI Docs
Today i learned that if you add PrivateAssets="all" to the ProjectReferece in the .csproj file, these project will be included in the Nuget package, instead of marked as a dependency.
This only works for .NET Core or .NET Standard build with the .NET Core CLI and not .Net Framework build with MSBuild.
About the author
A cloud solution architect and with a passion for Azure, .Net Core design patterns and a little Swift/iOS.
Comments
Join the discussionNo comments yet. Be the first to comment.
TIL
I share my teams and my own TIL (Today I Learned) moments with the world. It’s a kind of way of given back to the community which we all benefits from.


