Skip to content

Provides an ability to pack project with project-to-project references.

License

Notifications You must be signed in to change notification settings

btshft/ProjectPack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project Pack PackProject NuGet

⚠️ Preview

Tool is in preview stage and may not work as expected. In case of errors, feel free to create an issue.

Project packer is a simple dotnet tool that allows you to package projects with 'project-to-project' dependencies. Tool execution result is the original project packed in NuGet and all the project dependency graph packaged separate NuGets with the same version as the original project. Basically, the tool is just a wrapper over dotnet msbuild and dotnet pack.

Also Project Pack supports package downgrade check - it scans remote NuGet sources for bundled packages and compares remote versions to locals. If remote contains higher versions, the tool will fail or warn about downgrade depending on provided options. Downgrade scan is disabled by default.

Installation

Tool can be installed from NuGet as

dotnet tool install --global btshft.pack-project --version 1.0.0-preview.4

Usage

The program call is the same as the dotnet pack, except for a few extra cases descibed below.

dotnet pack-project <project-path> <args>

Examples

Following example will pack project 'MyProject' and all of dependencies to folder './artifacts' with version '1.1.0'.

dotnet pack-project ./src/MyProject --output ./artifacts -p:Version=1.1.0

Extra arguments

  • --parallel - Enables parallel package creation.
  • --output-graph - Generates project dependency graph in path specified.
  • --warn-downgrade - Warns if package downgrade detected for any of bundling packages.
  • --disallow-downgrade - Terminates execution with non-zero code if package downgrade detected.

Unsupported arguments

  • --no-dependencies - it's mutual exclusive with tool purpose.

Why

There are some inconvenience that are still not resolved with the way dotnet pack works with project-to-project references.

If you simply call dotnet pack on a project with such dependencies, it will create single project package with 'ProjectReference' replaced by 'PackageReference' with the provided version. So you need to publish packages for the entire project dependency graph with the same version as you specified for the current project. It's a mess.

There are some ways to solve 'inconvenience' like setting PrivateAssets="all" or hacking csproj which can lead to runtime exceptions.

Therefore, this tool was created trying to cope with project-to-project dependencies in NuGet packages and make working with them not so terrible.

How it works

Tool inspired by article Analyzing .NET Core project dependencies. It uses the same mechanism to analyze dependencies and build a graph, through a MSBuild GenerateRestoreGraphFile targer after which the tool analyzes dependencies and for each of them translates the call to dotnet pack.

About

Provides an ability to pack project with project-to-project references.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages