diff --git a/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallGlobalOrToolPathCommand.cs b/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallGlobalOrToolPathCommand.cs index 9793d2e2a686..870a87cee6b7 100644 --- a/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallGlobalOrToolPathCommand.cs +++ b/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallGlobalOrToolPathCommand.cs @@ -159,7 +159,7 @@ private int ExecuteInstallCommand(PackageId packageId) if (ToolVersionAlreadyInstalled(oldPackageNullable, nugetVersion)) { - _reporter.WriteLine(string.Format(LocalizableStrings.ToolAlreadyInstalled, _packageId, oldPackageNullable.Version.ToNormalizedString()).Green()); + _reporter.WriteLine(string.Format(LocalizableStrings.ToolAlreadyInstalled, oldPackageNullable.Id, oldPackageNullable.Version.ToNormalizedString()).Green()); return 0; } } diff --git a/src/Cli/dotnet/commands/dotnet-tool/update/ToolUpdateCommand.cs b/src/Cli/dotnet/commands/dotnet-tool/update/ToolUpdateCommand.cs index 1499142be4c0..42b9dd56417e 100644 --- a/src/Cli/dotnet/commands/dotnet-tool/update/ToolUpdateCommand.cs +++ b/src/Cli/dotnet/commands/dotnet-tool/update/ToolUpdateCommand.cs @@ -8,6 +8,7 @@ using Microsoft.DotNet.ToolManifest; using Microsoft.DotNet.ToolPackage; using Microsoft.DotNet.Tools.Tool.Common; +using Microsoft.Extensions.EnvironmentAbstractions; using CreateShellShimRepository = Microsoft.DotNet.Tools.Tool.Install.CreateShellShimRepository; namespace Microsoft.DotNet.Tools.Tool.Update @@ -43,16 +44,17 @@ public ToolUpdateCommand( localToolsResolverCache, reporter); + _global = result.GetValue(ToolInstallCommandParser.GlobalOption); + _toolPath = result.GetValue(ToolInstallCommandParser.ToolPathOption); + DirectoryPath? location = string.IsNullOrWhiteSpace(_toolPath) ? null : new DirectoryPath(_toolPath); _toolUpdateGlobalOrToolPathCommand = toolUpdateGlobalOrToolPathCommand ?? new ToolUpdateGlobalOrToolPathCommand( result, createToolPackageStoreDownloaderUninstaller, createShellShimRepository, - reporter); - - _global = result.GetValue(ToolInstallCommandParser.GlobalOption); - _toolPath = result.GetValue(ToolInstallCommandParser.ToolPathOption); + reporter, + ToolPackageFactory.CreateToolPackageStoreQuery(location)); }