From 49d7d6feb7e2be21e6322f4d37a372f65cc4902c Mon Sep 17 00:00:00 2001 From: Alper Ebicoglu Date: Wed, 24 Jun 2020 18:34:32 +0300 Subject: [PATCH] closes #2420 --- .../Volo/Abp/Cli/Commands/SuiteCommand.cs | 47 +++++++++++++++++-- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs index b4a4ff8bdd..fbe7fa675f 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs @@ -59,15 +59,33 @@ namespace Volo.Abp.Cli.Commands return; } - var result = CmdHelper.RunCmd("dotnet tool install " + SuitePackageName + " --add-source " + nugetIndexUrl + " -g"); + try + { + var result = CmdHelper.RunCmd("dotnet tool install " + SuitePackageName + " --add-source " + nugetIndexUrl + " -g"); - if (result == 0) + if (result == 0) + { + Logger.LogInformation("ABP Suite has been successfully installed."); + Logger.LogInformation("You can run it with the CLI command \"abp suite\""); + } + else + { + ShowSuiteManualInstallCommand(); + } + } + catch (Exception e) { - Logger.LogInformation("ABP Suite has been successfully installed."); - Logger.LogInformation("You can run it with the CLI command \"abp suite\""); + Logger.LogError("Couldn't install ABP Suite." + e.Message); + ShowSuiteManualInstallCommand(); } } + private void ShowSuiteManualInstallCommand() + { + Logger.LogInformation("You can also run the following command to install ABP Suite."); + Logger.LogInformation("dotnet tool install -g Volo.Abp.Suite"); + } + private async Task UpdateSuiteAsync() { var nugetIndexUrl = await _nuGetIndexUrlService.GetAsync(); @@ -77,7 +95,26 @@ namespace Volo.Abp.Cli.Commands return; } - CmdHelper.RunCmd("dotnet tool update " + SuitePackageName + " --add-source " + nugetIndexUrl + " -g"); + try + { + var result = CmdHelper.RunCmd("dotnet tool update " + SuitePackageName + " --add-source " + nugetIndexUrl + " -g"); + + if (result != 0) + { + ShowSuiteManualUpdateCommand(); + } + } + catch (Exception ex) + { + Logger.LogError("Couldn't update ABP Suite." + ex.Message); + ShowSuiteManualUpdateCommand(); + } + } + + private void ShowSuiteManualUpdateCommand() + { + Logger.LogError("You can also run the following command to update ABP Suite."); + Logger.LogError("dotnet tool update -g Volo.Abp.Suite"); } private static void RemoveSuite()