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
[PackageReference] Centrally manage NuGet package versions for a solution or a repo #6764
Reacted by jp2masa, Christoph Bergmeister, Jorge Costa, Daniel Cazzulino, Alejandro Barreto, PaulVrugt, Erik, Martin Andreas Ullrich, Shay Rojansky, Matt Jones and 91 more
Reacted by Bastian Schmidt, Steven Brix, rcollina, Ryouko Konpaku, Tom Pažourek, Pavel Fedotovsky, lippinio, handerss-spotfire, Joren Thijs, AliReZa Sabouri and 3 more
Reacted by Bastian Schmidt, Steven Brix, Alexander Leontiev, Tom Pažourek, Dave, Joël, handerss-spotfire, Joren Thijs, AliReZa Sabouri, Wojciech Nagórski and 3 more
Reacted by Bastian Schmidt, Steven Brix, Alexander Leontiev, Tom Pažourek, lippinio, handerss-spotfire, Joren Thijs, AliReZa Sabouri and Wojciech Nagórski
Reacted by Nirmal Guru, Justin Swanson, Frank Alvarez, handerss-spotfire, Joren Thijs, Wojciech Nagórski and AliReZa Sabouri
Do we have a strawman for this, design-wise? I'm not sure where that information would be when this is supported across repo boundaries (as the title suggest we do). At that point, this looks like a feature of the feed. It's almost like we'd like to have snapshotted feeds at that point.
@terrajobst No designs as such. My current thinking right now is to be able to define it per solution level in a file. And sometimes instead of defining it in the file, it could be imported from some global file present anywhere accessible by NuGet/MSBuild.
The purpose of keeping the term repo is to help not constrain anything for a 'solution' level. There would be some cases where an app is distributed across solutions in a repo.
I agree that if this file starts being a list all versions of packages allowed across a team/product - its becomes similar to just being a curated feed/repository.
If we had better tooling for maintaining/populating feeds, creating snapshotted feeds is probably the most logical model. And the file that people need to check in is a nuget.config with the proper feed :-)
changed the title [-]PackageReference - Enable allowed packages/versions across solution/repo/app[/-][+]PackageReference] Centrally manage NuGet package versions for a solution or a repo[/+]on May 4, 2018
changed the title [-]PackageReference] Centrally manage NuGet package versions for a solution or a repo[/-][+][PackageReference] Centrally manage NuGet package versions for a solution or a repo[/+]on May 4, 2018
As i changed computer and try to find the docs for Directory.Packages.props i found both :
It is expected. This is tracking an implementation with similar functionality as the SDK you linked.
Also i spotted this in the Wiki page :
I edited the wiki to point back to this issue because that spec is just a more elaborate version of the one linked in this issue. :)
Lots of people came across the spec you linked but could never figure out the right issue back.
not sure i understand the wiki part of your comment.
Is it normal to contains twice "github.com" and so that when you click, you are redirected to the wiki home instead of the issue ?
With respect to package source mapping, what is the expected way to configure this correctly for the combination of nuget.org and AzureDevOps Azure Artifacts (upstream mirror) feed?
the nuget.org feed is there to ensure packages can be discovered, but is actually disabled on the build servers
@japj
That's really up to you.
When we designed the feature, often times the people had different preferences (ex. map out nuget.org, vs map out their private feed).
Is there any sence to place PackageVersions inside Directory.Packages.props? AFAIK, it all works fine if I place PackageVersions just inside Directory.Build.props, so I don't need Directory.Packages.props at all. Correct me if I wrong.
Is there any sense to place PackageVersions inside Directory.Packages.props?
Since MSBuild basically allows you to do anything you want, you can place your PackageVersions in any common import. However, the supported scenario is to place them in a file that NuGet imports for you so that other tooling can take a dependency on it. Tools like Dependabot might only work with certain files as well so I think anyone should just follow the recommendations for features like this.
Reacted by Martin Costello, Tau Gärtli and Markus Schaber
I was encountering the issue that the .csproj is updated, not the Directory.Packages.props
The documentation mentions:
It will add a package reference to the project. The Package version will be added only to the Directory.Packages.props file. To update the version in the Directory.Packages.props file use the --force-version-update option.
I made sure to try on latest dotnet dotnet --version => 7.0.100-preview.7.22377.5
We do have dotnet add support mostly completed during some intern projects over the summer, but we will need to insert it into the next release and polish it. We will blog/release notes/add docs when that happens. Sorry for the confusion.
I took a look at the the next iteration items, but didn't see an item for dotnet add. Is there a issue for it that I can use to track it's progress?
Some context, I'm looking to try and adopt CPM in my company, however need a good story for automated package bumping. Perhaps there is some alternative way of working to achieve this?
Turns out NuKeeper also supports it, which surprises me since that project ceased development about a year ago. My company is already using this so great news :)
Activity
bording commentedon Apr 3, 2018
@anangaur Have you seen https://github.com/Microsoft/MSBuildSdks/tree/master/src/CentralPackageVersions? This seems like it enables the kind of control this requirement is talking about.
anangaur commentedon Apr 3, 2018
@bording true that. Thanks.
@jeffkl @jainaashish we should sync up on this
jainaashish commentedon Apr 3, 2018
pretty neat, just wondering how does it work out with VS, if it all it does?
anangaur commentedon Apr 3, 2018
Lets see how can we make this mainstream in NuGet and if satisfies all the requirements.
terrajobst commentedon Apr 3, 2018
Do we have a strawman for this, design-wise? I'm not sure where that information would be when this is supported across repo boundaries (as the title suggest we do). At that point, this looks like a feature of the feed. It's almost like we'd like to have snapshotted feeds at that point.
anangaur commentedon Apr 3, 2018
@terrajobst No designs as such. My current thinking right now is to be able to define it per solution level in a file. And sometimes instead of defining it in the file, it could be imported from some global file present anywhere accessible by NuGet/MSBuild.
The purpose of keeping the term repo is to help not constrain anything for a 'solution' level. There would be some cases where an app is distributed across solutions in a repo.
I agree that if this file starts being a list all versions of packages allowed across a team/product - its becomes similar to just being a curated feed/repository.
terrajobst commentedon Apr 3, 2018
If we had better tooling for maintaining/populating feeds, creating snapshotted feeds is probably the most logical model. And the file that people need to check in is a nuget.config with the proper feed :-)
[-]PackageReference - Enable allowed packages/versions across solution/repo/app[/-][+]PackageReference] Centrally manage NuGet package versions for a solution or a repo[/+][-]PackageReference] Centrally manage NuGet package versions for a solution or a repo[/-][+][PackageReference] Centrally manage NuGet package versions for a solution or a repo[/+]tebeco commentedon Dec 31, 2019
Hello @anangaur @nkolev92
As i changed computer and try to find the docs for
Directory.Packages.propsi found both :is the Dup' intended ?
Also i spotted this in the Wiki page :

(Sorry the zoom)
but i have no idea where to submit an issue/PR for the Wiki part
nkolev92 commentedon Dec 31, 2019
It is expected. This is tracking an implementation with similar functionality as the SDK you linked.
I edited the wiki to point back to this issue because that spec is just a more elaborate version of the one linked in this issue. :)
Lots of people came across the spec you linked but could never figure out the right issue back.
tebeco commentedon Dec 31, 2019
not sure i understand the wiki part of your comment.
Is it normal to contains twice "github.com" and so that when you click, you are redirected to the wiki home instead of the issue ?
184 remaining items
nkolev92 commentedon Apr 13, 2022
@erinlah-ms
NuGet respects
TreatWarningsAsErrors,WarningsAsErrorsandNoWarn.In your case you might want
WarningsAsErrorsjapj commentedon Apr 14, 2022
With respect to package source mapping, what is the expected way to configure this correctly for the combination of nuget.org and AzureDevOps Azure Artifacts (upstream mirror) feed?
the nuget.org feed is there to ensure packages can be discovered, but is actually disabled on the build servers
nkolev92 commentedon Apr 14, 2022
@japj
That's really up to you.
When we designed the feature, often times the people had different preferences (ex. map out nuget.org, vs map out their private feed).
https://docs.microsoft.com/en-us/nuget/consume-packages/package-source-mapping#package-pattern-precedence and https://docs.microsoft.com/en-us/nuget/consume-packages/package-source-mapping#setting-default-sources has some details about how to configure things.
ds1709 commentedon Jul 29, 2022
Is there any sence to place
PackageVersions insideDirectory.Packages.props? AFAIK, it all works fine if I placePackageVersions just insideDirectory.Build.props, so I don't needDirectory.Packages.propsat all. Correct me if I wrong.reduckted commentedon Jul 29, 2022
@ds1709 This comment from @jeffkl on the NuGet blog may be of interest to you.
https://devblogs.microsoft.com/nuget/introducing-central-package-management/#comment-186
jeffkl commentedon Jul 29, 2022
Since MSBuild basically allows you to do anything you want, you can place your PackageVersions in any common import. However, the supported scenario is to place them in a file that NuGet imports for you so that other tooling can take a dependency on it. Tools like Dependabot might only work with certain files as well so I think anyone should just follow the recommendations for features like this.
CoenraadS commentedon Aug 27, 2022
Today I was reading about the dotnet CLI experience: https://github.com/NuGet/Home/wiki/Centrally-managing-NuGet-package-versions#dotnet-add
I was encountering the issue that the
.csprojis updated, not theDirectory.Packages.propsThe documentation mentions:
I made sure to try on latest dotnet
dotnet --version => 7.0.100-preview.7.22377.5I run
dotnet add .\ClassLibrary1\ClassLibrary1.csproj package Microsoft.Extensions.Logging.Abstractions --version 3.1.28 --force-version-updateI get the error
Unrecognized command or argument '--force-version-update'JonDouglas commentedon Aug 27, 2022
@CoenraadS That link is just a old specification. It is quite outdated and the most recent docs are found here:
https://devblogs.microsoft.com/nuget/introducing-central-package-management/
https://docs.microsoft.com/en-us/nuget/consume-packages/central-package-management
We do have
dotnet addsupport mostly completed during some intern projects over the summer, but we will need to insert it into the next release and polish it. We will blog/release notes/add docs when that happens. Sorry for the confusion.reduckted commentedon Aug 27, 2022
Perhaps it would be a good idea to either remove those pages from the wiki, or add a big disclaimer at the top stating that they are out of date.
JonDouglas commentedon Aug 28, 2022
@reduckted Thanks. I keep forgetting how much SEO this page gets.
Check out #11952 for our next major iteration.
Here is a reference for small enhancements last release - #11752
CoenraadS commentedon Aug 28, 2022
Thanks for your responses.
I took a look at the the next iteration items, but didn't see an item for
dotnet add. Is there a issue for it that I can use to track it's progress?Some context, I'm looking to try and adopt CPM in my company, however need a good story for automated package bumping. Perhaps there is some alternative way of working to achieve this?
martincostello commentedon Aug 28, 2022
In case it's useful to you, dependabot version updates already support CPM, which makes it viable for automated package bumping.
CoenraadS commentedon Aug 28, 2022
Turns out
NuKeeperalso supports it, which surprises me since that project ceased development about a year ago. My company is already using this so great news :)