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

[DCR]: Central Package Management - Respect .props file as a way to opt-in to the feature. #11834

Closed
JonDouglas opened this issue May 24, 2022 · 3 comments · Fixed by NuGet/NuGet.Client#5572
Assignees
Labels
Area:RestoreCPM Central package management Category:BreakingChange Functionality:Restore Priority:2 Issues for the current backlog. Type:DCR Design Change Request
Milestone

Comments

@JonDouglas
Copy link
Contributor

JonDouglas commented May 24, 2022

NuGet Product(s) Affected

Other/NA

Current Behavior

To opt-in to central package management, one must explicitly enable a MSBuild property today. This brings quite a bit of confusion to users given the original spec mentions that if a file exists, all projects will be opted-in to the feature.

https://github.com/NuGet/Home/wiki/Centrally-managing-NuGet-package-versions#opt-in-central-package-version-management

Desired Behavior

If a .props file exists or is imported appropriately, projects should be automatically opted-in to central package management unless there is an explicit MSBuild property disabling the use of the feature.

Additional Context

This is currently a papercut that brings confusion to everyday users. We have documented this for now, but would like to make this more intuitive in the future.

Breaking Change

This would be considered a breaking change in the scenario where a user has a Directory.Packages.props for some reason and is not setting the ManagePackageVersionsCentrally property. CPM would now be on and they would need to set ManagePackageVersionsCentrally to false explicitly if they don't want to use CPM.

<PropertyGroup>
  <ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
</PropertyGroup>
@JonDouglas JonDouglas added Type:DCR Design Change Request Area:RestoreCPM Central package management Triage:Untriaged labels May 24, 2022
@jeffkl jeffkl self-assigned this May 24, 2022
@zivkan zivkan added the Priority:2 Issues for the current backlog. label May 26, 2022
@knocte
Copy link

knocte commented Jul 26, 2022

To opt-in to central package management, one must explicitly enable a MSBuild property today.

Is this bug outdated? I ask because you're saying that devs that want CentralPackageManagement need to opt-in via MSBuild property, but the URL you quote (https://github.com/NuGet/Home/wiki/Centrally-managing-NuGet-package-versions#opt-in-central-package-version-management ) says that it's enough to have the .props file.

@jeffkl jeffkl removed their assignment Mar 17, 2023
@jeffkl jeffkl self-assigned this Oct 2, 2023
@jeffkl jeffkl added this to the 6.10 milestone Feb 29, 2024
@aortiz-msft aortiz-msft reopened this Jul 17, 2024
@aortiz-msft
Copy link
Contributor

We have decided to revert this breaking change based on customer feedback.

@aortiz-msft aortiz-msft closed this as not planned Won't fix, can't repro, duplicate, stale Jul 17, 2024
@CZEMacLeod
Copy link

Spent a long time fixing this in a solution of 100+ projects, some of which used CPM (opt-in) and some didn't. The D.P.p file existed (for those that opted-in) but then broke everything else. Glad to see this reverted. I'm not a big fan of the 'magic file' mechanism - at least not unless there is a 'soft-on' mechanism. If it was possible to have it use PackageVersion if they exist, but allow the direct version refs in PackageReference, in a sort of mixed mode without warnings/errors - it would allow this to be much smoother. Then you could opt-in, opt-out, or have the default as mixed.

CPM doesn't work very well for multi-targetting when you need different versions based on target framework - so it is not a total panacea and shouldn't be the default.

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