You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: dotnet.exe add package support for projects onboarded onto central package management #11807
The dotnet add package command provides a convenient option to add or update a package reference in a project file. If the repo has been onboarded onto Central Package Management feature then the said command should add package reference to project (no version) and add a package version to the props file. Few scenarios to consider during implementation.
If the version already exists in the. props file then the command should update it.
If no version is specified for add package command, then add latest version to CPM props file.
In case of update the tooling changes the version number in .props file but no edits should be made to the project file.
changed the title [-][Feature]: dotnet.exe add package support for projects onboarded onto cental package management[/-][+][Feature]: dotnet.exe add package support for projects onboarded onto central package management[/+]on May 10, 2022
When using the CLI command dotnet add package on a project that is already onboarded to Central Package Management the following error is thrown: error: NU1008: Projects that use central package version management should not define the version on the PackageReference items but on the PackageVersion items: [PackageName].
The aim of this project will be to resolve this by enabling the dotnet CLI command to be used, regardless of whether the project has been onboarded to CPM or not.
error NU1008: Projects that use central package version management should not define the version on the PackageReference items but on the PackageVersion items
Hey @martinrrm@kartheekp-ms - I am trying to update an existing package in the Directory.Packages.props file to the newest version. However when running dotnet add [PROJECT] package [PACKAGE], the package never updates. If I remove the package from the .props file, it adds the latest version fine and if I add -v [LATEST] to command it will update it as well. However I won't easily know what the latest version is to add to the command. Is dotnet add [PROJECT] package [PACKAGE] the correct format that I should be using to update an existing package to the latest version in the .props file?
I have the following installed .NET SDK 7.0.3xx Nuget 6.6.1.2
@BenjaminBatman Can you open a bug issue for this so we can track upvotes and move the conversation there? I just tested this, and the behavior is not the expected one, I'll investigate more about.
Activity
[-][Feature]: dotnet.exe add package support for projects onboarded onto cental package management[/-][+][Feature]: dotnet.exe add package support for projects onboarded onto central package management[/+]pragnya17 commentedon May 23, 2022
When using the CLI command
dotnet add packageon a project that is already onboarded to Central Package Management the following error is thrown:error: NU1008: Projects that use central package version management should not define the version on the PackageReference items but on the PackageVersion items: [PackageName].The aim of this project will be to resolve this by enabling the dotnet CLI command to be used, regardless of whether the project has been onboarded to CPM or not.
darthkurak commentedon Jul 20, 2022
When we can expect a release of this functionality? :)
kartheekp-ms commentedon Aug 27, 2022
cc @martinrrm
constantinmuraru commentedon Jan 23, 2023
Hey @martinrrm @kartheekp-ms - is this working? I see a few PRs merged, but can't seem to make it work with
dotnet 7.0.102:https://stackoverflow.com/questions/75213427/how-to-make-dotnet-add-work-with-central-package-management
When I run
dotnet add, aPackageReferenceis added in the .csproj file, which contains the version.Example:
This upsets CPM on
dotnet restore:kartheekp-ms commentedon Jan 24, 2023
PR NuGet/NuGet.Client#4987 is merged into .NET SDK 7.0.2xx. You can download the daily .NET SDK build from https://github.com/dotnet/installer/blob/main/README.md#table until .NET SDK 7.0.2xx is released publicly.
kartheekp-ms commentedon Jul 17, 2023
All the issues in this epic have been addressed. Hence closing this issue.
BenjaminBatman commentedon Jul 19, 2023
Hey @martinrrm @kartheekp-ms - I am trying to update an existing package in the Directory.Packages.props file to the newest version. However when running
dotnet add [PROJECT] package [PACKAGE], the package never updates. If I remove the package from the .props file, it adds the latest version fine and if I add-v [LATEST]to command it will update it as well. However I won't easily know what the latest version is to add to the command. Isdotnet add [PROJECT] package [PACKAGE]the correct format that I should be using to update an existing package to the latest version in the .props file?I have the following installed
.NET SDK 7.0.3xxNuget 6.6.1.2martinrrm commentedon Jul 20, 2023
@BenjaminBatman Can you open a bug issue for this so we can track upvotes and move the conversation there? I just tested this, and the behavior is not the expected one, I'll investigate more about.