Matt Whetton
Matt Whetton

Reputation: 6786

Control the version constraint for dotnet pack project references

When I'm using dotnet pack to create nuget packages, it creates package dependencies for project references.

It seems to always create these with the constraint being "greater than or equal to the current project version"

Is there any way to control the version constraint that dotnet pack produces?

I'm using VS2017 and csproj files for netstandard1.6;net461 projects.

Upvotes: 8

Views: 1611

Answers (1)

csmacnz
csmacnz

Reputation: 351

This appears to work for PackageReference in csproj using the range syntax [1.0.1,2) https://learn.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files but isn't yet supported for ProjectReference (that I have been able to find).

You could split your projects out so that they build seperately and use PackageReference instead, but thats not a great workaround if you have many projects that are all chained together.

Upvotes: 3

Related Questions