Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: NuGet Package Manager does not update Directory.Packages.props #11826

Open
sbenzenko opened this issue May 22, 2022 · 4 comments
Open
Assignees

Comments

@sbenzenko
Copy link

sbenzenko commented May 22, 2022

NuGet Product Used

Visual Studio Package Management UI
Visual Studio Package Manager Console

Product Version

dotnet 6.0.300, Visual Studio 17.2.1

Worked before?

No response

Impact

It's more difficult to complete my work

Repro Steps & Context

When using Central Package Management with Directory.Packages.props file on solution level, trying to update package from Visual Studio Package Management UI or via Package Management Console results in package version being updated in project's .csproj file rather than in Directory.Packages.props file. It adds Version="..." attribute to <PackageReference /> in .csproj. That in turn causes the following compilation error:
NU1008 Projects that use central package version management should not define the version on the PackageReference items but on the PackageVersion items

Had to manually remove Version="..." from .csproj and update it in Directory.Packages.props to make it work.
image

Verbose Logs

No response

@jeffkl
Copy link
Contributor

jeffkl commented May 23, 2022

@sbenzenko Thank you for your report, we are actively working on Visual Studio support as well as dotnet CLI support for CPM.

At a top level, the Visual Studio work is tracked here: #9015

@reduckted
Copy link

@jeffkl Does that mean we can't use Central Package Management and install new packages in Visual Studio?

I've switched to CPM and Visual Studio can restore the packages just fine, but when I try to install a package, I get the error mentioned in this issue and the package installation is rolled back, so I can't install any packages at all.

NU1008: Projects that use central package version management should not define the version on the PackageReference items but on the PackageVersion items: MyPackage.
Package restore failed. Rolling back package changes for 'MyProject'.

That seems to go against what the documentation says about this feature:

The feature is available across all NuGet integrated tooling.

@jeffkl
Copy link
Contributor

jeffkl commented Jun 6, 2022

@jeffkl Does that mean we can't use Central Package Management and install new packages in Visual Studio?

@reduckted That's correct. We are working on the tooling side of things like Visual Studio and dotnet so that they work with CPM. Some of the work is already done and will be available in upcoming releases. We're tracking the work here: #11752

Sorry that wasn't clear from the documentation.

@awattar
Copy link

awattar commented Oct 21, 2023

@jeffkl any ETA for this basic functionality?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants