From b9077cb6d02093047203a62ff67b70a6b03b115e Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Mon, 4 Nov 2024 11:40:24 -0500 Subject: [PATCH] fix: Don't require a version when using upgrade policy --- src/NvGet.Tools.Shared/Arguments/ConsoleArgsContext.cs | 2 +- .../Tools/Updater/Extensions/UpdaterParametersExtension.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/NvGet.Tools.Shared/Arguments/ConsoleArgsContext.cs b/src/NvGet.Tools.Shared/Arguments/ConsoleArgsContext.cs index 3d3cadd..b6b55d9 100644 --- a/src/NvGet.Tools.Shared/Arguments/ConsoleArgsContext.cs +++ b/src/NvGet.Tools.Shared/Arguments/ConsoleArgsContext.cs @@ -119,7 +119,7 @@ Action TryParseAndSet(Func parse, Action set) includeMaxVersion: true, floatRange: null, originalString: null)) : - (false, r.UpgradePolicy, VersionRange.Parse(r.UpdatedVersion))); + (false, r.UpgradePolicy, VersionRange.Parse(r.UpdatedVersion ?? "0.0.0.0"))); async Task> LoadFromStreamAsync() { diff --git a/src/NvGet/Tools/Updater/Extensions/UpdaterParametersExtension.cs b/src/NvGet/Tools/Updater/Extensions/UpdaterParametersExtension.cs index 2168318..b8d504d 100644 --- a/src/NvGet/Tools/Updater/Extensions/UpdaterParametersExtension.cs +++ b/src/NvGet/Tools/Updater/Extensions/UpdaterParametersExtension.cs @@ -133,11 +133,11 @@ UpgradePolicy upgradePolicy { return true; } - else if(upgradePolicy == UpgradePolicy.Minor) + else if (upgradePolicy == UpgradePolicy.Minor) { return version.Version < new Version(reference.Identity.Version.Major + 1, 0, 0); } - else if(upgradePolicy == UpgradePolicy.Patch) + else if (upgradePolicy == UpgradePolicy.Patch) { return version.Version < new Version(reference.Identity.Version.Major, reference.Identity.Version.Minor + 1, 0); }