From c555f79b8af5dd77c28a820f80355bdcb6fc874d Mon Sep 17 00:00:00 2001 From: AraHaan Date: Sat, 12 Mar 2022 19:36:06 -0500 Subject: [PATCH] Skip installing templates and manifest when SDK, Ref, and Runtime pack versions cannot be obtained. (#1) This should fix a bug where when it can be obtained it would generate an error saying to run "Update" instead. Signed-off-by: AraHaan --- src/Elskom.Check.csproj | 4 ++-- src/InstallCommand.cs | 31 +++++++++++++++++++------------ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/Elskom.Check.csproj b/src/Elskom.Check.csproj index 5fa0a78..1d1e4af 100644 --- a/src/Elskom.Check.csproj +++ b/src/Elskom.Check.csproj @@ -12,7 +12,7 @@ latest Elskom.Net.Check .NET Elskom Workload Check Tool - 1.0.11 + 1.0.12 Els_kom org. Els_kom org. A dotnet tool for installing/uninstalling and updating the Elskom workload. @@ -20,7 +20,7 @@ A dotnet tool for installing/uninstalling and updating the Elskom workload. - Fixed issue installing / updating the workload does not factor in manually installed runtime and reference pack updates. + Skip installing templates and manifest when SDK, Ref, and Runtime pack versions cannot be obtained. Copyright © 2021 https://github.com/Elskom/installer diff --git a/src/InstallCommand.cs b/src/InstallCommand.cs index 0a53f3f..0e4c412 100644 --- a/src/InstallCommand.cs +++ b/src/InstallCommand.cs @@ -69,20 +69,27 @@ public override async Task ExecuteAsync([NotNull] CommandContext context, [ Console.WriteLine($"Successfully installed workload package '{Constants.RuntimePackName}'."); } - var templatePackVersion = await DownloadPackageAsync( - Constants.TemplatePackName).ConfigureAwait(false); - if (!templatePackVersion.Equals("already installed")) + // avoid installing the templates and the workload manifest if sdkPackVersion, refPackVersion, + // and runtimePackVersion is null or empty. + if (!string.IsNullOrEmpty(sdkPackVersion) + && !string.IsNullOrEmpty(refPackVersion) + && !string.IsNullOrEmpty(runtimePackVersion)) { - Console.WriteLine($"Successfully installed workload package '{Constants.TemplatePackName}'."); - } + var templatePackVersion = await DownloadPackageAsync( + Constants.TemplatePackName).ConfigureAwait(false); + if (!templatePackVersion.Equals("already installed")) + { + Console.WriteLine($"Successfully installed workload package '{Constants.TemplatePackName}'."); + } - InstallManifest(settings.SdkVersion!, new Dictionary - { - { Constants.SdkPackName, sdkPackVersion }, - { Constants.RefPackName, refPackVersion }, - { Constants.RuntimePackName, runtimePackVersion }, - { Constants.TemplatePackName, templatePackVersion }, - }); + InstallManifest(settings.SdkVersion!, new Dictionary + { + { Constants.SdkPackName, sdkPackVersion }, + { Constants.RefPackName, refPackVersion }, + { Constants.RuntimePackName, runtimePackVersion }, + { Constants.TemplatePackName, templatePackVersion }, + }); + } return 0; }