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
For solutions using the new NuGet Central Packagement feature, trying the --upgrade option will cause dotnet-outdated to add the package versions to the csproj package references, rather than updating the package versions in Directory.Packages.props, and consequently break the build. A simplified example of how this manifests is shown below.
Updating the tool to support this NuGet feature would allow such projects to leverage the --upgrade option, rather than just needing to manually update using the console's output as a guide on what to update.
Reacted by Stuart Lang, Hannah Chan, steveoh, Steven T. Cramer, Yuriy Ostapenko, Julian Verdurmen, Jeff Schreiner, Stefan Reichel, Leonardo Chaia, Dmytry Emery and 1 more
As this calls through into the NuGet client, looks like the way to support this is to actually just wait for the .NET Core SDK to support adding/updating package references this way.
Looking at what I think is the relevant NuGet code for this, it doesn't currently support doing this and just unconditionally adds the Version metadata onto the PackageReference item, rather than delegating it to the Directory.Packages.props file:
Yeah, I was going to say that I thought this would "just work" because we shell out to the sdk. NuKeeper for example needed explicit support added (due to the custom implementation), but we should get it here for free.
@steveoh I don't think it would be outrageous. It could be a while before the standard dotnet CLI tools support central package management. If you you are interested in raising a PR in the meantime it would be most welcome.
Now that NuKeeper has deprecated itself and is no longer maintained, This became something of a thorn in our workflow, as we don't use any kind of bots of auto-PR creation tools right now, just developers updating their NuGets in their feature branches as needed.
In our case, we have the "half-way" CPVM system - With csprojs having packages with Include and no Version tags and simply using a Directory.Build.Targets file with packages that have Update and Version tags.
I'm not sure if that's entirely supported either way (Though it did work with NuKeeper's explicit support, as mentioned).
So i raise this again for consideration. As for being able to PR - Can we start a discussion of how this would be implemented, theoratically? So anyone who might be able to contribute will have more of a stepping to start from.
I went ahead and opened PR #243 to add some of the basic "placeholder' support for upgrading CPVM controlled packages as expected by the CPVM preview spec, in lieu of SDK CLI support.
Just wanted to hop in and say that I'd really like this feature to be implemented and would be happy to help any way I can.
I use central package management in all my projects, since it simplifies managing versions on >1 project solutions.
For dotnet-affected, we implemented a feature where we can detect which projects are affected by adding/deleting/updating a nuget package. I think that works great together with dotnet-outdated: you update all your packages, and then in CI or locally you only build/test/publish the projects that were changed/affected by the package changes.
This is the code we use for updating packages, I wouldn't use that in production (its for testing only) but perhaps we can get some inspiration for dotnet-outdated.
Should we create a package to share this code between these two tools?
Regards,
Leo.
Reacted by steveoh, juanmanuelrios, Nick Devereaux and Dmytry Emery
Hierarchiel ones you mean? as long as Import tags are used, it should be fine.
Probably not, unless the support for that was outside the area i updated.
Nope - They werne't a thing until after i submitted the PR and the tools weren't updated yet.
The nuget restore outputs give us if a version is centrally managed or not; if thats respected there, it will apply here.
All in all, as the OP of #243 says, this was done to add rudimentry suppport until the underlying dotnet CLI fully supports those scenarios.
For myself/the usage we have of this tool internally, we currently don't need the edge cases.
I'm sure other PR contributions will be happily accepted :)
hi @ransagy thanks for the prompt reply. I think this is a great addition to this project.
For the first point I meant this:
What this means is that if you had multiple Directory.Packages.props files in your repository, the file that is closest to your project’s directory will be evaluated for it. This allows you extra control at various levels of your repository.
Activity
coderpatros commentedon Aug 23, 2020
@martincostello that would be a great addition. We would welcome this functionality.
martincostello commentedon Aug 23, 2020
I had a dig around in the code, and saw that package upgrade is implemented via calling
dotnet add package:dotnet-outdated/src/DotNetOutdated.Core/Services/DotNetAddPackageService.cs
Lines 23 to 34 in 3169358
As this calls through into the NuGet client, looks like the way to support this is to actually just wait for the .NET Core SDK to support adding/updating package references this way.
Looking at what I think is the relevant NuGet code for this, it doesn't currently support doing this and just unconditionally adds the
Versionmetadata onto thePackageReferenceitem, rather than delegating it to theDirectory.Packages.propsfile:https://github.com/NuGet/NuGet.Client/blob/3501ddedc274ac10d4b135856b7593a6bb8a72f1/src/NuGet.Core/NuGet.CommandLine.XPlat/Utility/MSBuildAPIUtility.cs#L227
https://github.com/NuGet/NuGet.Client/blob/3501ddedc274ac10d4b135856b7593a6bb8a72f1/src/NuGet.Core/NuGet.CommandLine.XPlat/Utility/MSBuildAPIUtility.cs#L256
Looking at the NuGet repo's issues, it looks like that is tracked by NuGet/Home#9022.
slang25 commentedon Aug 23, 2020
Yeah, I was going to say that I thought this would "just work" because we shell out to the sdk. NuKeeper for example needed explicit support added (due to the custom implementation), but we should get it here for free.
It's good we have the issue to track it with.
steveoh commentedon Oct 26, 2020
Would it be outrageous to edit the
Directory.Packages.targetfrom within the tool and then shell out for a restore?coderpatros commentedon Oct 27, 2020
@steveoh I don't think it would be outrageous. It could be a while before the standard dotnet CLI tools support central package management. If you you are interested in raising a PR in the meantime it would be most welcome.
Merge pull request dotnet-outdated#6 from coderpatros/dependency-bump
ransagy commentedon Jan 26, 2022
Now that NuKeeper has deprecated itself and is no longer maintained, This became something of a thorn in our workflow, as we don't use any kind of bots of auto-PR creation tools right now, just developers updating their NuGets in their feature branches as needed.
In our case, we have the "half-way" CPVM system - With csprojs having packages with
Includeand noVersiontags and simply using a Directory.Build.Targets file with packages that haveUpdateandVersiontags.I'm not sure if that's entirely supported either way (Though it did work with NuKeeper's explicit support, as mentioned).
So i raise this again for consideration. As for being able to PR - Can we start a discussion of how this would be implemented, theoratically? So anyone who might be able to contribute will have more of a stepping to start from.
ransagy commentedon Jan 28, 2022
I went ahead and opened PR #243 to add some of the basic "placeholder' support for upgrading CPVM controlled packages as expected by the CPVM preview spec, in lieu of SDK CLI support.
leonardochaia commentedon Mar 11, 2022
Hello all.
Just wanted to hop in and say that I'd really like this feature to be implemented and would be happy to help any way I can.
I use central package management in all my projects, since it simplifies managing versions on >1 project solutions.
For dotnet-affected, we implemented a feature where we can detect which projects are affected by adding/deleting/updating a nuget package. I think that works great together with
dotnet-outdated: you update all your packages, and then in CI or locally you only build/test/publish the projects that were changed/affected by the package changes.I wanted to share our implementation for reading
Directory.Packages.props, which uses MSBuild in order to do so. This supports conditions as well, which is quite nice to have (we use conditions in props files for multi framework targeting)We also have tests where we create
Directory.Packages.propsfiles, see hereParticularly, we ensure conditions are interpreted
This is the code we use for updating packages, I wouldn't use that in production (its for testing only) but perhaps we can get some inspiration for dotnet-outdated.
Should we create a package to share this code between these two tools?
Regards,
Leo.
steveoh commentedon Sep 22, 2022
Is there a PR or something to see where this was implemented?
martincostello commentedon Sep 22, 2022
#243, linked in the comment above which closed the issue.
leonardochaia commentedon Sep 23, 2022
Hey all. I was taking a very quick look at the PR and I was thinking:
VersionOverridetaken into account?ManagePackageVersionsCentrallyrespected? May have a Directory.Packages.props but projectsManagePackageVersionsCentrally=false.We've made several changes at dotnet affected to improve how we evaluate Directory.Packages.props files in order to support these "edge cases".
Regards,
Leo.
ransagy commentedon Sep 23, 2022
Importtags are used, it should be fine.All in all, as the OP of #243 says, this was done to add rudimentry suppport until the underlying dotnet CLI fully supports those scenarios.
For myself/the usage we have of this tool internally, we currently don't need the edge cases.
I'm sure other PR contributions will be happily accepted :)
leonardochaia commentedon Sep 23, 2022
hi @ransagy thanks for the prompt reply. I think this is a great addition to this project.
For the first point I meant this:
source
Thanks for clarifying the rest of the points 👍
ransagy commentedon Sep 23, 2022
Yup, it should always look at the closest available file going up the folder hierarchy.
Thank you for your input as well :)