I have a cake build which I am using to update Nugets like this
Task("Update-NuGet-Packages")
.Does(() =>
{
NuGetUpdate(@"D:\FooBar\FooBar.sln");
});
This does update nuget to latest version in all solution projects but is there an option to pass package name and version, much like we do through package console
Update-Package NLog -Version 3.5.0
You can pass in a NuGetUpdateSettings
into the second argument, this has a list of Id
s to update:
Task("Update-NuGet-Packages")
.Does(() =>
{
NuGetUpdate(@"D:\FooBar\FooBar.sln",
new NuGetUpdateSettings(){
Id = new [] { "Newtonsoft.Json", "HumbleConfig" }
});
});
However, looking at NuGetUpdater
there doesn't seem to be a way to pass in the version numbers. Doesn't look that hard to extend and I'm sure they'd be happy to accept a PR.
NuGetUpdateSettings - https://github.com/cake-build/cake/blob/main/src/Cake.Common/Tools/NuGet/Update/NuGetUpdateSettings.cs
NuGetUpdater - https://github.com/cake-build/cake/blob/main/src/Cake.Common/Tools/NuGet/Update/NuGetUpdater.cs