Mark Cooper
Mark Cooper

Reputation: 6894

dotnet pack multiple projects into one package

I have a build pipeline that is building multiple library files in a single solution. In the YML file I have the following task to package the dlls;

- task: DotNetCoreCLI@2
  displayName: 'Create nuget packages'
  inputs:
    command: 'pack'
    packagesToPack: 'Framework/**/*.csproj;!**/*.Test.csproj'
    packDirectory: '$(Build.ArtifactStagingDirectory)/packages/nuget'
    nobuild: true
    versioningScheme: 'byBuildNumber'

This creates all my library files as seperate nupkg files. I would like them in one nupkg file.

Is this possible using dotnet pack?

Upvotes: 7

Views: 1663

Answers (1)

BeardinaSuit
BeardinaSuit

Reputation: 901

One of the way of doing that is to create a nuspec that includes outputs of the csproj you want to bundle since the pack command only accepts a single project.

You can also use the dependencies attribute to link to other nupkg instead of bundling them.

Upvotes: 0

Related Questions