From 7ebfdde749013d56fe81aaa072d82f5cf0b49cf3 Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Wed, 17 Jan 2018 19:26:52 -0800 Subject: [PATCH] Add verbosity option to `install tool` command. This commit adds the `--verbosity` option to the `install tool` command. MSBuild/NuGet output is now controllable by the user and defaults to being "quiet". This enables users to see warnings from NuGet that otherwise would be swallowed unless NuGet returned a non-zero exit code. As a byproduct of this change, the exception handling and error messages related to obtaining tool packages was retooled. We no longer display `install tool` command line help for installation failures, as it should only be displayed for command line syntax errors. Fixes #8465. --- Microsoft.DotNet.Cli.sln | 29 +++++- src/dotnet/CommonLocalizableStrings.resx | 34 ++++--- src/dotnet/ToolPackage/IProjectRestorer.cs | 4 +- .../ToolPackage/IToolPackageObtainer.cs | 4 +- src/dotnet/ToolPackage/ToolConfiguration.cs | 28 +++--- .../ToolConfigurationDeserializer.cs | 28 +++--- src/dotnet/ToolPackage/ToolPackageObtainer.cs | 7 +- .../dotnet-install-tool/InstallToolCommand.cs | 88 +++++++++--------- .../InstallToolCommandParser.cs | 3 +- .../LocalizableStrings.resx | 30 +++---- .../dotnet-install-tool/ProjectRestorer.cs | 28 ++++-- .../xlf/LocalizableStrings.cs.xlf | 53 +++++------ .../xlf/LocalizableStrings.de.xlf | 53 +++++------ .../xlf/LocalizableStrings.es.xlf | 53 +++++------ .../xlf/LocalizableStrings.fr.xlf | 53 +++++------ .../xlf/LocalizableStrings.it.xlf | 53 +++++------ .../xlf/LocalizableStrings.ja.xlf | 53 +++++------ .../xlf/LocalizableStrings.ko.xlf | 53 +++++------ .../xlf/LocalizableStrings.pl.xlf | 53 +++++------ .../xlf/LocalizableStrings.pt-BR.xlf | 53 +++++------ .../xlf/LocalizableStrings.ru.xlf | 53 +++++------ .../xlf/LocalizableStrings.tr.xlf | 53 +++++------ .../xlf/LocalizableStrings.zh-Hans.xlf | 53 +++++------ .../xlf/LocalizableStrings.zh-Hant.xlf | 53 +++++------ .../xlf/CommonLocalizableStrings.cs.xlf | 64 +++++++------ .../xlf/CommonLocalizableStrings.de.xlf | 64 +++++++------ .../xlf/CommonLocalizableStrings.es.xlf | 64 +++++++------ .../xlf/CommonLocalizableStrings.fr.xlf | 64 +++++++------ .../xlf/CommonLocalizableStrings.it.xlf | 64 +++++++------ .../xlf/CommonLocalizableStrings.ja.xlf | 64 +++++++------ .../xlf/CommonLocalizableStrings.ko.xlf | 64 +++++++------ .../xlf/CommonLocalizableStrings.pl.xlf | 64 +++++++------ .../xlf/CommonLocalizableStrings.pt-BR.xlf | 64 +++++++------ .../xlf/CommonLocalizableStrings.ru.xlf | 64 +++++++------ .../xlf/CommonLocalizableStrings.tr.xlf | 64 +++++++------ .../xlf/CommonLocalizableStrings.zh-Hans.xlf | 64 +++++++------ .../xlf/CommonLocalizableStrings.zh-Hant.xlf | 64 +++++++------ test/Microsoft.DotNet.Cli.Tests.sln | 16 +++- .../FakeReporter.cs | 28 ------ .../LinuxEnvironmentPathTests.cs | 20 ++--- .../OsxEnvironmentPathTests.cs | 18 ++-- .../ToolConfigurationDeserializerTests.cs | 11 ++- .../ToolPackageObtainerTests.cs | 63 ++++++++++--- .../ToolPackageObtainerMock.cs | 3 +- .../BufferedReporter.cs | 26 ++++++ .../Commands/InstallCommand.cs | 20 +++++ .../GivenDotnetInstallTool.cs | 42 +++++++++ .../dotnet-install-tool.Tests.csproj | 20 +++++ .../InstallToolCommandTests.cs | 89 ++++++++++--------- .../ParserTests/InstallToolParserTests.cs | 11 +++ 50 files changed, 1068 insertions(+), 1103 deletions(-) delete mode 100644 test/Microsoft.DotNet.ShellShim.Tests/FakeReporter.cs create mode 100644 test/Microsoft.DotNet.Tools.Tests.Utilities/BufferedReporter.cs create mode 100644 test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/InstallCommand.cs create mode 100644 test/dotnet-install-tool.Tests/GivenDotnetInstallTool.cs create mode 100644 test/dotnet-install-tool.Tests/dotnet-install-tool.Tests.csproj diff --git a/Microsoft.DotNet.Cli.sln b/Microsoft.DotNet.Cli.sln index 6e03ba1ff..c9bddd009 100644 --- a/Microsoft.DotNet.Cli.sln +++ b/Microsoft.DotNet.Cli.sln @@ -1,4 +1,4 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27130.2020 MinimumVisualStudioVersion = 10.0.40219.1 @@ -236,6 +236,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Tools.Test EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "tool_launcher", "src\tool_launcher\tool_launcher.csproj", "{EDF19BE6-F20F-4AD0-8E3B-E837030726A5}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnet-install-tool.Tests", "test\dotnet-install-tool.Tests\dotnet-install-tool.Tests.csproj", "{8FE9D802-57F3-493B-9E14-72DF905E3838}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1692,6 +1694,30 @@ Global {E442F4C1-08DB-470F-B9A6-197444CD0295}.RelWithDebInfo|x64.Build.0 = Release|Any CPU {E442F4C1-08DB-470F-B9A6-197444CD0295}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU {E442F4C1-08DB-470F-B9A6-197444CD0295}.RelWithDebInfo|x86.Build.0 = Release|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.Debug|x64.ActiveCfg = Debug|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.Debug|x64.Build.0 = Debug|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.Debug|x86.ActiveCfg = Debug|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.Debug|x86.Build.0 = Debug|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.MinSizeRel|x86.ActiveCfg = Debug|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.MinSizeRel|x86.Build.0 = Debug|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.Release|Any CPU.Build.0 = Release|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.Release|x64.ActiveCfg = Release|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.Release|x64.Build.0 = Release|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.Release|x86.ActiveCfg = Release|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.Release|x86.Build.0 = Release|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.RelWithDebInfo|x86.ActiveCfg = Debug|Any CPU + {8FE9D802-57F3-493B-9E14-72DF905E3838}.RelWithDebInfo|x86.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1767,6 +1793,7 @@ Global {91BFE800-1624-4A58-A1CE-339705A8FFD0} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {EDF19BE6-F20F-4AD0-8E3B-E837030726A5} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} {E442F4C1-08DB-470F-B9A6-197444CD0295} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} + {8FE9D802-57F3-493B-9E14-72DF905E3838} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B526D2CE-EE2D-4AD4-93EF-1867D90FF1F5} diff --git a/src/dotnet/CommonLocalizableStrings.resx b/src/dotnet/CommonLocalizableStrings.resx index 8a236f571..7a5b6d6f1 100644 --- a/src/dotnet/CommonLocalizableStrings.resx +++ b/src/dotnet/CommonLocalizableStrings.resx @@ -520,28 +520,26 @@ Does not do an implicit restore when executing the command. - - Cannot be null or whitespace. - - - Contains one or more invalid characters: {0} - NuGet configuration file {0} does not exist. - - The tool's settings file has non "dotnet" as runner. - - - The tool's settings file has more than one command defined. - - - The tool's settings file contains error. -{0} - - The tool's settings file is invalid xml. -{0} + Invalid XML: {0} + + + Tool defines a command with a missing name setting. + + + Command '{0}' is missing an entry point setting. + + + Command '{0}' contains one or more of the following invalid characters: {1}. + + + More than one command is defined for the tool. + + + Command '{0}' uses unsupported runner '{1}'." Cannot find the tools executable path. Please ensure {0} is added to your PATH. diff --git a/src/dotnet/ToolPackage/IProjectRestorer.cs b/src/dotnet/ToolPackage/IProjectRestorer.cs index a20a2c18f..ef68a78a0 100644 --- a/src/dotnet/ToolPackage/IProjectRestorer.cs +++ b/src/dotnet/ToolPackage/IProjectRestorer.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System.Collections.Generic; using Microsoft.Extensions.EnvironmentAbstractions; namespace Microsoft.DotNet.ToolPackage @@ -11,6 +12,7 @@ namespace Microsoft.DotNet.ToolPackage FilePath projectPath, DirectoryPath assetJsonOutput, FilePath? nugetconfig, - string source); + string source, + string verbosity); } } diff --git a/src/dotnet/ToolPackage/IToolPackageObtainer.cs b/src/dotnet/ToolPackage/IToolPackageObtainer.cs index e48694f9e..5bc95c669 100644 --- a/src/dotnet/ToolPackage/IToolPackageObtainer.cs +++ b/src/dotnet/ToolPackage/IToolPackageObtainer.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System.Collections.Generic; using Microsoft.Extensions.EnvironmentAbstractions; namespace Microsoft.DotNet.ToolPackage @@ -12,6 +13,7 @@ namespace Microsoft.DotNet.ToolPackage string packageVersion = null, FilePath? nugetconfig = null, string targetframework = null, - string source = null); + string source = null, + string verbosity = null); } } diff --git a/src/dotnet/ToolPackage/ToolConfiguration.cs b/src/dotnet/ToolPackage/ToolConfiguration.cs index 83862c38b..286d7db68 100644 --- a/src/dotnet/ToolPackage/ToolConfiguration.cs +++ b/src/dotnet/ToolPackage/ToolConfiguration.cs @@ -3,6 +3,7 @@ using System; using System.IO; +using System.Linq; using Microsoft.DotNet.Tools; namespace Microsoft.DotNet.ToolPackage @@ -15,33 +16,36 @@ namespace Microsoft.DotNet.ToolPackage { if (string.IsNullOrWhiteSpace(commandName)) { - throw new ArgumentNullException(nameof(commandName), CommonLocalizableStrings.CannotBeNullOrWhitespace); + throw new ToolConfigurationException(CommonLocalizableStrings.ToolSettingsMissingCommandName); } - EnsureNoInvalidFilenameCharacters(commandName, nameof(toolAssemblyEntryPoint)); - if (string.IsNullOrWhiteSpace(toolAssemblyEntryPoint)) { - throw new ArgumentNullException(nameof(toolAssemblyEntryPoint), CommonLocalizableStrings.CannotBeNullOrWhitespace); + throw new ToolConfigurationException( + string.Format( + CommonLocalizableStrings.ToolSettingsMissingEntryPoint, + commandName)); } + EnsureNoInvalidFilenameCharacters(commandName); + CommandName = commandName; ToolAssemblyEntryPoint = toolAssemblyEntryPoint; } - private void EnsureNoInvalidFilenameCharacters(string commandName, string nameOfParam) + private void EnsureNoInvalidFilenameCharacters(string commandName) { - char[] invalidCharactors = Path.GetInvalidFileNameChars(); - if (commandName.IndexOfAny(invalidCharactors) != -1) + var invalidCharacters = Path.GetInvalidFileNameChars(); + if (commandName.IndexOfAny(invalidCharacters) != -1) { - throw new ArgumentException( - paramName: nameof(nameOfParam), - message: string.Format(CommonLocalizableStrings.ContainInvalidCharacters, - new string(invalidCharactors))); + throw new ToolConfigurationException( + string.Format( + CommonLocalizableStrings.ToolSettingsInvalidCommandName, + commandName, + string.Join(", ", invalidCharacters.Select(c => $"'{c}'")))); } } - public string CommandName { get; } public string ToolAssemblyEntryPoint { get; } } diff --git a/src/dotnet/ToolPackage/ToolConfigurationDeserializer.cs b/src/dotnet/ToolPackage/ToolConfigurationDeserializer.cs index 4938111f2..4b1a7a831 100644 --- a/src/dotnet/ToolPackage/ToolConfigurationDeserializer.cs +++ b/src/dotnet/ToolPackage/ToolConfigurationDeserializer.cs @@ -29,35 +29,29 @@ namespace Microsoft.DotNet.ToolPackage catch (InvalidOperationException e) when (e.InnerException is XmlException) { throw new ToolConfigurationException( - string.Format(CommonLocalizableStrings.ToolSettingsInvalidXml, e.InnerException.Message)); + string.Format( + CommonLocalizableStrings.ToolSettingsInvalidXml, + e.InnerException.Message)); } } if (dotNetCliTool.Commands.Length != 1) { - throw new ToolConfigurationException( - CommonLocalizableStrings.ToolSettingMoreThanOneCommand); + throw new ToolConfigurationException(CommonLocalizableStrings.ToolSettingsMoreThanOneCommand); } if (dotNetCliTool.Commands[0].Runner != "dotnet") { throw new ToolConfigurationException( - CommonLocalizableStrings.ToolSettingInvalidRunner); + string.Format( + CommonLocalizableStrings.ToolSettingsUnsupportedRunner, + dotNetCliTool.Commands[0].Name, + dotNetCliTool.Commands[0].Runner)); } - var commandName = dotNetCliTool.Commands[0].Name; - var toolAssemblyEntryPoint = dotNetCliTool.Commands[0].EntryPoint; - - try - { - return new ToolConfiguration(commandName, toolAssemblyEntryPoint); - } - catch (ArgumentException e) - { - throw new ToolConfigurationException( - string.Format(CommonLocalizableStrings.ToolSettingsContainError, - e.Message)); - } + return new ToolConfiguration( + dotNetCliTool.Commands[0].Name, + dotNetCliTool.Commands[0].EntryPoint); } } } diff --git a/src/dotnet/ToolPackage/ToolPackageObtainer.cs b/src/dotnet/ToolPackage/ToolPackageObtainer.cs index 3066c7e00..bd44fc1c4 100644 --- a/src/dotnet/ToolPackage/ToolPackageObtainer.cs +++ b/src/dotnet/ToolPackage/ToolPackageObtainer.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; using System.Xml.Linq; @@ -38,7 +40,8 @@ namespace Microsoft.DotNet.ToolPackage string packageVersion = null, FilePath? nugetconfig = null, string targetframework = null, - string source = null) + string source = null, + string verbosity = null) { if (packageId == null) { @@ -71,7 +74,7 @@ namespace Microsoft.DotNet.ToolPackage targetframework, toolDirectory); - _projectRestorer.Restore(tempProjectPath, toolDirectory, nugetconfig, source); + _projectRestorer.Restore(tempProjectPath, toolDirectory, nugetconfig, source, verbosity); if (packageVersionOrPlaceHolder.IsPlaceholder) { diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs index e8d288c82..d19fc880c 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; +using System.Collections.Generic; using System.IO; using System.Linq; using Microsoft.DotNet.Cli; @@ -27,6 +28,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool private readonly string _framework; private readonly string _source; private readonly bool _global; + private readonly string _verbosity; public InstallToolCommand( AppliedOption appliedCommand, @@ -48,6 +50,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool _framework = appliedCommand.ValueOrDefault("framework"); _source = appliedCommand.ValueOrDefault("source"); _global = appliedCommand.ValueOrDefault("global"); + _verbosity = appliedCommand.SingleArgumentOrDefault("verbosity"); var cliFolderPathCalculator = new CliFolderPathCalculator(); var offlineFeedPath = new DirectoryPath(cliFolderPathCalculator.CliFallbackFolderPath); @@ -58,7 +61,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool .WithSubDirectories(Path.GetRandomFileName()) .WithFile(Path.GetRandomFileName() + ".csproj"), new Lazy(BundledTargetFramework.GetTargetFrameworkMoniker), - new ProjectRestorer()); + new ProjectRestorer(reporter)); _environmentPathInstruction = environmentPathInstruction ?? EnvironmentPathFactory @@ -66,69 +69,68 @@ namespace Microsoft.DotNet.Tools.Install.Tool _shellShimMaker = shellShimMaker ?? new ShellShimMaker(cliFolderPathCalculator.ToolsShimPath); - _reporter = reporter ?? Reporter.Output; + _reporter = reporter; } public override int Execute() { + var reporter = (_reporter ?? Reporter.Output); + var errorReporter = (_reporter ?? Reporter.Error); if (!_global) { throw new GracefulException(LocalizableStrings.InstallToolCommandOnlySupportGlobal); } - var toolConfigurationAndExecutablePath = ObtainPackage(); + try + { + var toolConfigurationAndExecutablePath = ObtainPackage(); - var commandName = toolConfigurationAndExecutablePath.Configuration.CommandName; - _shellShimMaker.EnsureCommandNameUniqueness(commandName); + var commandName = toolConfigurationAndExecutablePath.Configuration.CommandName; + _shellShimMaker.EnsureCommandNameUniqueness(commandName); - _shellShimMaker.CreateShim( - toolConfigurationAndExecutablePath.Executable, - commandName); + _shellShimMaker.CreateShim( + toolConfigurationAndExecutablePath.Executable, + commandName); - _environmentPathInstruction - .PrintAddPathInstructionIfPathDoesNotExist(); - - _reporter.WriteLine( - string.Format(LocalizableStrings.InstallationSucceeded, commandName)); + _environmentPathInstruction + .PrintAddPathInstructionIfPathDoesNotExist(); + reporter.WriteLine( + string.Format(LocalizableStrings.InstallationSucceeded, commandName)); + } + catch (PackageObtainException ex) + { + errorReporter.WriteLine(ex.Message.Red()); + errorReporter.WriteLine(string.Format(LocalizableStrings.ToolInstallationFailed, _packageId).Red()); + return 1; + } + catch (ToolConfigurationException ex) + { + errorReporter.WriteLine( + string.Format( + LocalizableStrings.InvalidToolConfiguration, + ex.Message).Red()); + errorReporter.WriteLine(string.Format(LocalizableStrings.ToolInstallationFailedContactAuthor, _packageId).Red()); + return 1; + } return 0; } private ToolConfigurationAndExecutablePath ObtainPackage() { - try + FilePath? configFile = null; + if (_configFilePath != null) { - FilePath? configFile = null; - if (_configFilePath != null) - { - configFile = new FilePath(_configFilePath); - } - - return _toolPackageObtainer.ObtainAndReturnExecutablePath( - packageId: _packageId, - packageVersion: _packageVersion, - nugetconfig: configFile, - targetframework: _framework, - source: _source); + configFile = new FilePath(_configFilePath); } - catch (PackageObtainException ex) - { - throw new GracefulException( - message: - string.Format(LocalizableStrings.InstallFailedNuget, - ex.Message), - innerException: ex); - } - catch (ToolConfigurationException ex) - { - throw new GracefulException( - message: - string.Format( - LocalizableStrings.InstallFailedPackage, - ex.Message), - innerException: ex); - } + return _toolPackageObtainer.ObtainAndReturnExecutablePath( + packageId: _packageId, + packageVersion: _packageVersion, + nugetconfig: configFile, + targetframework: _framework, + source: _source, + verbosity: _verbosity); } } } diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommandParser.cs b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommandParser.cs index 6422517d9..c4d2a9696 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommandParser.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommandParser.cs @@ -36,7 +36,8 @@ namespace Microsoft.DotNet.Cli "-f|--framework", LocalizableStrings.FrameworkOptionDescription, Accept.ExactlyOneArgument()), - CommonOptions.HelpOption()); + CommonOptions.HelpOption(), + CommonOptions.VerbosityOption()); } } } diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/LocalizableStrings.resx b/src/dotnet/commands/dotnet-install/dotnet-install-tool/LocalizableStrings.resx index d689f4b11..7d543cab8 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/LocalizableStrings.resx +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/LocalizableStrings.resx @@ -149,24 +149,6 @@ WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - - - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - - - Install failed. Failed to download package: -NuGet returned: - -{0} - - - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} @@ -181,4 +163,16 @@ The installation succeeded. If there are no further instructions, you can type t The --global switch (-g) is currently required because only user wide tools are supported. + + The settings file in the tool's NuGet package is invalid: {0} + + + Tool '{0}' failed to install. + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + + + The tool package could not be restored. + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/ProjectRestorer.cs b/src/dotnet/commands/dotnet-install/dotnet-install-tool/ProjectRestorer.cs index 1419e0e38..ba4548c2d 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/ProjectRestorer.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/ProjectRestorer.cs @@ -14,11 +14,19 @@ namespace Microsoft.DotNet.Tools.Install.Tool { internal class ProjectRestorer : IProjectRestorer { + private IReporter _reporter; + + public ProjectRestorer(IReporter reporter) + { + _reporter = reporter; + } + public void Restore( FilePath projectPath, DirectoryPath assetJsonOutput, FilePath? nugetconfig, - string source = null) + string source = null, + string verbosity = null) { var argsToPassToRestore = new List(); @@ -42,18 +50,22 @@ namespace Microsoft.DotNet.Tools.Install.Tool $"/p:BaseIntermediateOutputPath={assetJsonOutput.ToQuotedString()}" }); + argsToPassToRestore.Add($"/verbosity:{verbosity ?? "quiet"}"); + var command = new DotNetCommandFactory(alwaysRunOutOfProc: true) - .Create("restore", argsToPassToRestore) - .CaptureStdOut() - .CaptureStdErr(); + .Create("restore", argsToPassToRestore); + + if (_reporter != null) + { + command = command + .OnOutputLine((line) => _reporter.WriteLine(line)) + .OnErrorLine((line) => _reporter.WriteLine(line)); + } var result = command.Execute(); if (result.ExitCode != 0) { - throw new PackageObtainException( - string.Format( - LocalizableStrings.FailedToRestorePackage, - result.StartInfo.WorkingDirectory, result.StartInfo.Arguments, result.StdErr, result.StdOut)); + throw new PackageObtainException(LocalizableStrings.ToolInstallationRestoreFailed); } } diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.cs.xlf index 0904e75e8..80067a1b6 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.cs.xlf +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.cs.xlf @@ -30,39 +30,6 @@ Arguments: {1} Output: {2}{3} - - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - - - - Install failed. Failed to download package: -NuGet returned: - -{0} - Install failed. Failed to download package: -NuGet returned: - -{0} - - - - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - - NuGet Package Id of the tool to install. NuGet Package Id of the tool to install. @@ -113,6 +80,26 @@ The error was: The --global switch (-g) is currently required because only user wide tools are supported. + + The settings file in the tool's NuGet package is invalid: {0} + The settings file in the tool's NuGet package is invalid: {0} + + + + Tool '{0}' failed to install. + Tool '{0}' failed to install. + + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + Tool '{0}' failed to install. Please contact the tool author for assistance. + + + + The tool package could not be restored. + The tool package could not be restored. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.de.xlf index 87144c359..3d4767d4f 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.de.xlf +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.de.xlf @@ -30,39 +30,6 @@ Arguments: {1} Output: {2}{3} - - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - - - - Install failed. Failed to download package: -NuGet returned: - -{0} - Install failed. Failed to download package: -NuGet returned: - -{0} - - - - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - - NuGet Package Id of the tool to install. NuGet Package Id of the tool to install. @@ -113,6 +80,26 @@ The error was: The --global switch (-g) is currently required because only user wide tools are supported. + + The settings file in the tool's NuGet package is invalid: {0} + The settings file in the tool's NuGet package is invalid: {0} + + + + Tool '{0}' failed to install. + Tool '{0}' failed to install. + + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + Tool '{0}' failed to install. Please contact the tool author for assistance. + + + + The tool package could not be restored. + The tool package could not be restored. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.es.xlf index 7449fa3ef..4eb2f1e92 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.es.xlf +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.es.xlf @@ -30,39 +30,6 @@ Arguments: {1} Output: {2}{3} - - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - - - - Install failed. Failed to download package: -NuGet returned: - -{0} - Install failed. Failed to download package: -NuGet returned: - -{0} - - - - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - - NuGet Package Id of the tool to install. NuGet Package Id of the tool to install. @@ -113,6 +80,26 @@ The error was: The --global switch (-g) is currently required because only user wide tools are supported. + + The settings file in the tool's NuGet package is invalid: {0} + The settings file in the tool's NuGet package is invalid: {0} + + + + Tool '{0}' failed to install. + Tool '{0}' failed to install. + + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + Tool '{0}' failed to install. Please contact the tool author for assistance. + + + + The tool package could not be restored. + The tool package could not be restored. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.fr.xlf index 789a063c5..9070e4fcf 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.fr.xlf +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.fr.xlf @@ -30,39 +30,6 @@ Arguments: {1} Output: {2}{3} - - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - - - - Install failed. Failed to download package: -NuGet returned: - -{0} - Install failed. Failed to download package: -NuGet returned: - -{0} - - - - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - - NuGet Package Id of the tool to install. NuGet Package Id of the tool to install. @@ -113,6 +80,26 @@ The error was: The --global switch (-g) is currently required because only user wide tools are supported. + + The settings file in the tool's NuGet package is invalid: {0} + The settings file in the tool's NuGet package is invalid: {0} + + + + Tool '{0}' failed to install. + Tool '{0}' failed to install. + + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + Tool '{0}' failed to install. Please contact the tool author for assistance. + + + + The tool package could not be restored. + The tool package could not be restored. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.it.xlf index b6ef111ac..93acec7ed 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.it.xlf +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.it.xlf @@ -30,39 +30,6 @@ Arguments: {1} Output: {2}{3} - - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - - - - Install failed. Failed to download package: -NuGet returned: - -{0} - Install failed. Failed to download package: -NuGet returned: - -{0} - - - - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - - NuGet Package Id of the tool to install. NuGet Package Id of the tool to install. @@ -113,6 +80,26 @@ The error was: The --global switch (-g) is currently required because only user wide tools are supported. + + The settings file in the tool's NuGet package is invalid: {0} + The settings file in the tool's NuGet package is invalid: {0} + + + + Tool '{0}' failed to install. + Tool '{0}' failed to install. + + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + Tool '{0}' failed to install. Please contact the tool author for assistance. + + + + The tool package could not be restored. + The tool package could not be restored. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.ja.xlf index d5f88a8f6..473677f11 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.ja.xlf +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.ja.xlf @@ -30,39 +30,6 @@ Arguments: {1} Output: {2}{3} - - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - - - - Install failed. Failed to download package: -NuGet returned: - -{0} - Install failed. Failed to download package: -NuGet returned: - -{0} - - - - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - - NuGet Package Id of the tool to install. NuGet Package Id of the tool to install. @@ -113,6 +80,26 @@ The error was: The --global switch (-g) is currently required because only user wide tools are supported. + + The settings file in the tool's NuGet package is invalid: {0} + The settings file in the tool's NuGet package is invalid: {0} + + + + Tool '{0}' failed to install. + Tool '{0}' failed to install. + + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + Tool '{0}' failed to install. Please contact the tool author for assistance. + + + + The tool package could not be restored. + The tool package could not be restored. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.ko.xlf index 2cf8b32f8..33a95ac44 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.ko.xlf +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.ko.xlf @@ -30,39 +30,6 @@ Arguments: {1} Output: {2}{3} - - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - - - - Install failed. Failed to download package: -NuGet returned: - -{0} - Install failed. Failed to download package: -NuGet returned: - -{0} - - - - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - - NuGet Package Id of the tool to install. NuGet Package Id of the tool to install. @@ -113,6 +80,26 @@ The error was: The --global switch (-g) is currently required because only user wide tools are supported. + + The settings file in the tool's NuGet package is invalid: {0} + The settings file in the tool's NuGet package is invalid: {0} + + + + Tool '{0}' failed to install. + Tool '{0}' failed to install. + + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + Tool '{0}' failed to install. Please contact the tool author for assistance. + + + + The tool package could not be restored. + The tool package could not be restored. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.pl.xlf index c6f63ffda..bbdbfa97c 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.pl.xlf +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.pl.xlf @@ -30,39 +30,6 @@ Arguments: {1} Output: {2}{3} - - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - - - - Install failed. Failed to download package: -NuGet returned: - -{0} - Install failed. Failed to download package: -NuGet returned: - -{0} - - - - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - - NuGet Package Id of the tool to install. NuGet Package Id of the tool to install. @@ -113,6 +80,26 @@ The error was: The --global switch (-g) is currently required because only user wide tools are supported. + + The settings file in the tool's NuGet package is invalid: {0} + The settings file in the tool's NuGet package is invalid: {0} + + + + Tool '{0}' failed to install. + Tool '{0}' failed to install. + + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + Tool '{0}' failed to install. Please contact the tool author for assistance. + + + + The tool package could not be restored. + The tool package could not be restored. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.pt-BR.xlf index 61cfe82c1..d624b7182 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.pt-BR.xlf @@ -30,39 +30,6 @@ Arguments: {1} Output: {2}{3} - - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - - - - Install failed. Failed to download package: -NuGet returned: - -{0} - Install failed. Failed to download package: -NuGet returned: - -{0} - - - - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - - NuGet Package Id of the tool to install. NuGet Package Id of the tool to install. @@ -113,6 +80,26 @@ The error was: The --global switch (-g) is currently required because only user wide tools are supported. + + The settings file in the tool's NuGet package is invalid: {0} + The settings file in the tool's NuGet package is invalid: {0} + + + + Tool '{0}' failed to install. + Tool '{0}' failed to install. + + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + Tool '{0}' failed to install. Please contact the tool author for assistance. + + + + The tool package could not be restored. + The tool package could not be restored. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.ru.xlf index 6c4047fab..67099dc3e 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.ru.xlf +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.ru.xlf @@ -30,39 +30,6 @@ Arguments: {1} Output: {2}{3} - - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - - - - Install failed. Failed to download package: -NuGet returned: - -{0} - Install failed. Failed to download package: -NuGet returned: - -{0} - - - - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - - NuGet Package Id of the tool to install. NuGet Package Id of the tool to install. @@ -113,6 +80,26 @@ The error was: The --global switch (-g) is currently required because only user wide tools are supported. + + The settings file in the tool's NuGet package is invalid: {0} + The settings file in the tool's NuGet package is invalid: {0} + + + + Tool '{0}' failed to install. + Tool '{0}' failed to install. + + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + Tool '{0}' failed to install. Please contact the tool author for assistance. + + + + The tool package could not be restored. + The tool package could not be restored. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.tr.xlf index 61059f22b..18d45358c 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.tr.xlf +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.tr.xlf @@ -30,39 +30,6 @@ Arguments: {1} Output: {2}{3} - - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - - - - Install failed. Failed to download package: -NuGet returned: - -{0} - Install failed. Failed to download package: -NuGet returned: - -{0} - - - - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - - NuGet Package Id of the tool to install. NuGet Package Id of the tool to install. @@ -113,6 +80,26 @@ The error was: The --global switch (-g) is currently required because only user wide tools are supported. + + The settings file in the tool's NuGet package is invalid: {0} + The settings file in the tool's NuGet package is invalid: {0} + + + + Tool '{0}' failed to install. + Tool '{0}' failed to install. + + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + Tool '{0}' failed to install. Please contact the tool author for assistance. + + + + The tool package could not be restored. + The tool package could not be restored. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.zh-Hans.xlf index e51c1c828..d9baee0e1 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.zh-Hans.xlf @@ -30,39 +30,6 @@ Arguments: {1} Output: {2}{3} - - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - - - - Install failed. Failed to download package: -NuGet returned: - -{0} - Install failed. Failed to download package: -NuGet returned: - -{0} - - - - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - - NuGet Package Id of the tool to install. NuGet Package Id of the tool to install. @@ -113,6 +80,26 @@ The error was: The --global switch (-g) is currently required because only user wide tools are supported. + + The settings file in the tool's NuGet package is invalid: {0} + The settings file in the tool's NuGet package is invalid: {0} + + + + Tool '{0}' failed to install. + Tool '{0}' failed to install. + + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + Tool '{0}' failed to install. Please contact the tool author for assistance. + + + + The tool package could not be restored. + The tool package could not be restored. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.zh-Hant.xlf index c74ff695d..1d77ef950 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/xlf/LocalizableStrings.zh-Hant.xlf @@ -30,39 +30,6 @@ Arguments: {1} Output: {2}{3} - - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - - - - Install failed. Failed to download package: -NuGet returned: - -{0} - Install failed. Failed to download package: -NuGet returned: - -{0} - - - - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - Install failed. The settings file in the tool's NuGet package is not valid. Please contact the owner of the NuGet package. -The error was: - -{0} - - NuGet Package Id of the tool to install. NuGet Package Id of the tool to install. @@ -113,6 +80,26 @@ The error was: The --global switch (-g) is currently required because only user wide tools are supported. + + The settings file in the tool's NuGet package is invalid: {0} + The settings file in the tool's NuGet package is invalid: {0} + + + + Tool '{0}' failed to install. + Tool '{0}' failed to install. + + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + Tool '{0}' failed to install. Please contact the tool author for assistance. + + + + The tool package could not be restored. + The tool package could not be restored. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf index fcff78d2f..2d90f2248 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf @@ -674,40 +674,6 @@ Projekt {0} byl z řešení odebrán. - - Cannot be null or whitespace. - Cannot be null or whitespace. - - - - Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} - - - - The tool's settings file is invalid xml. -{0} - The tool's settings file is invalid xml. -{0} - - - - The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. - - - - The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. - - - - The tool's settings file contains error. -{0} - The tool's settings file contains error. -{0} - - NuGet configuration file {0} does not exist. NuGet configuration file {0} does not exist. @@ -797,6 +763,36 @@ setx PATH "%PATH%;{1}" Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + Invalid XML: {0} + Invalid XML: {0} + + + + Tool defines a command with a missing name setting. + Tool defines a command with a missing name setting. + + + + Command '{0}' is missing an entry point setting. + Command '{0}' is missing an entry point setting. + + + + Command '{0}' contains one or more of the following invalid characters: {1}. + Command '{0}' contains one or more of the following invalid characters: {1}. + + + + More than one command is defined for the tool. + More than one command is defined for the tool. + + + + Command '{0}' uses unsupported runner '{1}'." + Command '{0}' uses unsupported runner '{1}'." + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf index 2ef360050..31bfc8bde 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf @@ -674,40 +674,6 @@ Das Projekt "{0}" wurde aus der Projektmappe entfernt. - - Cannot be null or whitespace. - Cannot be null or whitespace. - - - - Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} - - - - The tool's settings file is invalid xml. -{0} - The tool's settings file is invalid xml. -{0} - - - - The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. - - - - The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. - - - - The tool's settings file contains error. -{0} - The tool's settings file contains error. -{0} - - NuGet configuration file {0} does not exist. NuGet configuration file {0} does not exist. @@ -797,6 +763,36 @@ setx PATH "%PATH%;{1}" Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + Invalid XML: {0} + Invalid XML: {0} + + + + Tool defines a command with a missing name setting. + Tool defines a command with a missing name setting. + + + + Command '{0}' is missing an entry point setting. + Command '{0}' is missing an entry point setting. + + + + Command '{0}' contains one or more of the following invalid characters: {1}. + Command '{0}' contains one or more of the following invalid characters: {1}. + + + + More than one command is defined for the tool. + More than one command is defined for the tool. + + + + Command '{0}' uses unsupported runner '{1}'." + Command '{0}' uses unsupported runner '{1}'." + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf index 082d2d6d0..55c0b6fed 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf @@ -674,40 +674,6 @@ Se ha quitado el proyecto "{0}" de la solución. - - Cannot be null or whitespace. - Cannot be null or whitespace. - - - - Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} - - - - The tool's settings file is invalid xml. -{0} - The tool's settings file is invalid xml. -{0} - - - - The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. - - - - The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. - - - - The tool's settings file contains error. -{0} - The tool's settings file contains error. -{0} - - NuGet configuration file {0} does not exist. NuGet configuration file {0} does not exist. @@ -797,6 +763,36 @@ setx PATH "%PATH%;{1}" Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + Invalid XML: {0} + Invalid XML: {0} + + + + Tool defines a command with a missing name setting. + Tool defines a command with a missing name setting. + + + + Command '{0}' is missing an entry point setting. + Command '{0}' is missing an entry point setting. + + + + Command '{0}' contains one or more of the following invalid characters: {1}. + Command '{0}' contains one or more of the following invalid characters: {1}. + + + + More than one command is defined for the tool. + More than one command is defined for the tool. + + + + Command '{0}' uses unsupported runner '{1}'." + Command '{0}' uses unsupported runner '{1}'." + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf index 04790f3aa..591b4ec9a 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf @@ -674,40 +674,6 @@ Projet '{0}' retiré de la solution. - - Cannot be null or whitespace. - Cannot be null or whitespace. - - - - Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} - - - - The tool's settings file is invalid xml. -{0} - The tool's settings file is invalid xml. -{0} - - - - The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. - - - - The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. - - - - The tool's settings file contains error. -{0} - The tool's settings file contains error. -{0} - - NuGet configuration file {0} does not exist. NuGet configuration file {0} does not exist. @@ -797,6 +763,36 @@ setx PATH "%PATH%;{1}" Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + Invalid XML: {0} + Invalid XML: {0} + + + + Tool defines a command with a missing name setting. + Tool defines a command with a missing name setting. + + + + Command '{0}' is missing an entry point setting. + Command '{0}' is missing an entry point setting. + + + + Command '{0}' contains one or more of the following invalid characters: {1}. + Command '{0}' contains one or more of the following invalid characters: {1}. + + + + More than one command is defined for the tool. + More than one command is defined for the tool. + + + + Command '{0}' uses unsupported runner '{1}'." + Command '{0}' uses unsupported runner '{1}'." + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf index 2f43ff640..8d9df7d52 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf @@ -674,40 +674,6 @@ Il progetto `{0}` è stato rimosso dalla soluzione. - - Cannot be null or whitespace. - Cannot be null or whitespace. - - - - Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} - - - - The tool's settings file is invalid xml. -{0} - The tool's settings file is invalid xml. -{0} - - - - The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. - - - - The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. - - - - The tool's settings file contains error. -{0} - The tool's settings file contains error. -{0} - - NuGet configuration file {0} does not exist. NuGet configuration file {0} does not exist. @@ -797,6 +763,36 @@ setx PATH "%PATH%;{1}" Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + Invalid XML: {0} + Invalid XML: {0} + + + + Tool defines a command with a missing name setting. + Tool defines a command with a missing name setting. + + + + Command '{0}' is missing an entry point setting. + Command '{0}' is missing an entry point setting. + + + + Command '{0}' contains one or more of the following invalid characters: {1}. + Command '{0}' contains one or more of the following invalid characters: {1}. + + + + More than one command is defined for the tool. + More than one command is defined for the tool. + + + + Command '{0}' uses unsupported runner '{1}'." + Command '{0}' uses unsupported runner '{1}'." + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf index b2648f41d..fb91a7f53 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf @@ -674,40 +674,6 @@ プロジェクト `{0}` がソリューションから削除されました。 - - Cannot be null or whitespace. - Cannot be null or whitespace. - - - - Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} - - - - The tool's settings file is invalid xml. -{0} - The tool's settings file is invalid xml. -{0} - - - - The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. - - - - The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. - - - - The tool's settings file contains error. -{0} - The tool's settings file contains error. -{0} - - NuGet configuration file {0} does not exist. NuGet configuration file {0} does not exist. @@ -797,6 +763,36 @@ setx PATH "%PATH%;{1}" Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + Invalid XML: {0} + Invalid XML: {0} + + + + Tool defines a command with a missing name setting. + Tool defines a command with a missing name setting. + + + + Command '{0}' is missing an entry point setting. + Command '{0}' is missing an entry point setting. + + + + Command '{0}' contains one or more of the following invalid characters: {1}. + Command '{0}' contains one or more of the following invalid characters: {1}. + + + + More than one command is defined for the tool. + More than one command is defined for the tool. + + + + Command '{0}' uses unsupported runner '{1}'." + Command '{0}' uses unsupported runner '{1}'." + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf index c8e626ebc..828dd3b03 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf @@ -674,40 +674,6 @@ '{0}' 프로젝트가 솔루션에서 제거되었습니다. - - Cannot be null or whitespace. - Cannot be null or whitespace. - - - - Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} - - - - The tool's settings file is invalid xml. -{0} - The tool's settings file is invalid xml. -{0} - - - - The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. - - - - The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. - - - - The tool's settings file contains error. -{0} - The tool's settings file contains error. -{0} - - NuGet configuration file {0} does not exist. NuGet configuration file {0} does not exist. @@ -797,6 +763,36 @@ setx PATH "%PATH%;{1}" Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + Invalid XML: {0} + Invalid XML: {0} + + + + Tool defines a command with a missing name setting. + Tool defines a command with a missing name setting. + + + + Command '{0}' is missing an entry point setting. + Command '{0}' is missing an entry point setting. + + + + Command '{0}' contains one or more of the following invalid characters: {1}. + Command '{0}' contains one or more of the following invalid characters: {1}. + + + + More than one command is defined for the tool. + More than one command is defined for the tool. + + + + Command '{0}' uses unsupported runner '{1}'." + Command '{0}' uses unsupported runner '{1}'." + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf index 866502ed7..71096bfac 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf @@ -674,40 +674,6 @@ Projekt „{0}” został skasowany z rozwiązania. - - Cannot be null or whitespace. - Cannot be null or whitespace. - - - - Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} - - - - The tool's settings file is invalid xml. -{0} - The tool's settings file is invalid xml. -{0} - - - - The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. - - - - The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. - - - - The tool's settings file contains error. -{0} - The tool's settings file contains error. -{0} - - NuGet configuration file {0} does not exist. NuGet configuration file {0} does not exist. @@ -797,6 +763,36 @@ setx PATH "%PATH%;{1}" Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + Invalid XML: {0} + Invalid XML: {0} + + + + Tool defines a command with a missing name setting. + Tool defines a command with a missing name setting. + + + + Command '{0}' is missing an entry point setting. + Command '{0}' is missing an entry point setting. + + + + Command '{0}' contains one or more of the following invalid characters: {1}. + Command '{0}' contains one or more of the following invalid characters: {1}. + + + + More than one command is defined for the tool. + More than one command is defined for the tool. + + + + Command '{0}' uses unsupported runner '{1}'." + Command '{0}' uses unsupported runner '{1}'." + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf b/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf index d6590ff13..e1450289b 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf @@ -674,40 +674,6 @@ O projeto `{0}` foi removido da solução. - - Cannot be null or whitespace. - Cannot be null or whitespace. - - - - Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} - - - - The tool's settings file is invalid xml. -{0} - The tool's settings file is invalid xml. -{0} - - - - The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. - - - - The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. - - - - The tool's settings file contains error. -{0} - The tool's settings file contains error. -{0} - - NuGet configuration file {0} does not exist. NuGet configuration file {0} does not exist. @@ -797,6 +763,36 @@ setx PATH "%PATH%;{1}" Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + Invalid XML: {0} + Invalid XML: {0} + + + + Tool defines a command with a missing name setting. + Tool defines a command with a missing name setting. + + + + Command '{0}' is missing an entry point setting. + Command '{0}' is missing an entry point setting. + + + + Command '{0}' contains one or more of the following invalid characters: {1}. + Command '{0}' contains one or more of the following invalid characters: {1}. + + + + More than one command is defined for the tool. + More than one command is defined for the tool. + + + + Command '{0}' uses unsupported runner '{1}'." + Command '{0}' uses unsupported runner '{1}'." + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf index 0c8083046..0198396fe 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf @@ -674,40 +674,6 @@ Проект "{0}" удален из решения. - - Cannot be null or whitespace. - Cannot be null or whitespace. - - - - Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} - - - - The tool's settings file is invalid xml. -{0} - The tool's settings file is invalid xml. -{0} - - - - The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. - - - - The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. - - - - The tool's settings file contains error. -{0} - The tool's settings file contains error. -{0} - - NuGet configuration file {0} does not exist. NuGet configuration file {0} does not exist. @@ -797,6 +763,36 @@ setx PATH "%PATH%;{1}" Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + Invalid XML: {0} + Invalid XML: {0} + + + + Tool defines a command with a missing name setting. + Tool defines a command with a missing name setting. + + + + Command '{0}' is missing an entry point setting. + Command '{0}' is missing an entry point setting. + + + + Command '{0}' contains one or more of the following invalid characters: {1}. + Command '{0}' contains one or more of the following invalid characters: {1}. + + + + More than one command is defined for the tool. + More than one command is defined for the tool. + + + + Command '{0}' uses unsupported runner '{1}'." + Command '{0}' uses unsupported runner '{1}'." + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf index f1ff54bfb..58096808a 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf @@ -674,40 +674,6 @@ `{0}` projesi çözümden kaldırıldı. - - Cannot be null or whitespace. - Cannot be null or whitespace. - - - - Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} - - - - The tool's settings file is invalid xml. -{0} - The tool's settings file is invalid xml. -{0} - - - - The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. - - - - The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. - - - - The tool's settings file contains error. -{0} - The tool's settings file contains error. -{0} - - NuGet configuration file {0} does not exist. NuGet configuration file {0} does not exist. @@ -797,6 +763,36 @@ setx PATH "%PATH%;{1}" Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + Invalid XML: {0} + Invalid XML: {0} + + + + Tool defines a command with a missing name setting. + Tool defines a command with a missing name setting. + + + + Command '{0}' is missing an entry point setting. + Command '{0}' is missing an entry point setting. + + + + Command '{0}' contains one or more of the following invalid characters: {1}. + Command '{0}' contains one or more of the following invalid characters: {1}. + + + + More than one command is defined for the tool. + More than one command is defined for the tool. + + + + Command '{0}' uses unsupported runner '{1}'." + Command '{0}' uses unsupported runner '{1}'." + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf index bbe34189e..d950c2c9e 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf @@ -674,40 +674,6 @@ 已从解决方案中移除项目“{0}”。 - - Cannot be null or whitespace. - Cannot be null or whitespace. - - - - Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} - - - - The tool's settings file is invalid xml. -{0} - The tool's settings file is invalid xml. -{0} - - - - The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. - - - - The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. - - - - The tool's settings file contains error. -{0} - The tool's settings file contains error. -{0} - - NuGet configuration file {0} does not exist. NuGet configuration file {0} does not exist. @@ -797,6 +763,36 @@ setx PATH "%PATH%;{1}" Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + Invalid XML: {0} + Invalid XML: {0} + + + + Tool defines a command with a missing name setting. + Tool defines a command with a missing name setting. + + + + Command '{0}' is missing an entry point setting. + Command '{0}' is missing an entry point setting. + + + + Command '{0}' contains one or more of the following invalid characters: {1}. + Command '{0}' contains one or more of the following invalid characters: {1}. + + + + More than one command is defined for the tool. + More than one command is defined for the tool. + + + + Command '{0}' uses unsupported runner '{1}'." + Command '{0}' uses unsupported runner '{1}'." + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf index 314f986c0..3c81ce8ea 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf @@ -674,40 +674,6 @@ 專案 `{0}` 已從解決方案移除。 - - Cannot be null or whitespace. - Cannot be null or whitespace. - - - - Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} - - - - The tool's settings file is invalid xml. -{0} - The tool's settings file is invalid xml. -{0} - - - - The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. - - - - The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. - - - - The tool's settings file contains error. -{0} - The tool's settings file contains error. -{0} - - NuGet configuration file {0} does not exist. NuGet configuration file {0} does not exist. @@ -797,6 +763,36 @@ setx PATH "%PATH%;{1}" Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + Invalid XML: {0} + Invalid XML: {0} + + + + Tool defines a command with a missing name setting. + Tool defines a command with a missing name setting. + + + + Command '{0}' is missing an entry point setting. + Command '{0}' is missing an entry point setting. + + + + Command '{0}' contains one or more of the following invalid characters: {1}. + Command '{0}' contains one or more of the following invalid characters: {1}. + + + + More than one command is defined for the tool. + More than one command is defined for the tool. + + + + Command '{0}' uses unsupported runner '{1}'." + Command '{0}' uses unsupported runner '{1}'." + + \ No newline at end of file diff --git a/test/Microsoft.DotNet.Cli.Tests.sln b/test/Microsoft.DotNet.Cli.Tests.sln index 05bde078d..9e41297be 100644 --- a/test/Microsoft.DotNet.Cli.Tests.sln +++ b/test/Microsoft.DotNet.Cli.Tests.sln @@ -1,4 +1,4 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27004.2008 MinimumVisualStudioVersion = 10.0.40219.1 @@ -88,6 +88,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.ToolPackag EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Tools.Tests.ComponentMocks", "Microsoft.DotNet.Tools.Tests.ComponentMocks\Microsoft.DotNet.Tools.Tests.ComponentMocks.csproj", "{A3DE5654-7755-45C8-8AE5-5B5B00BEB248}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-install-tool.Tests", "dotnet-install-tool.Tests\dotnet-install-tool.Tests.csproj", "{E2F5F115-0DE4-4CC0-920C-EF6F89D15EAB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -578,6 +580,18 @@ Global {A3DE5654-7755-45C8-8AE5-5B5B00BEB248}.Release|x64.Build.0 = Release|Any CPU {A3DE5654-7755-45C8-8AE5-5B5B00BEB248}.Release|x86.ActiveCfg = Release|Any CPU {A3DE5654-7755-45C8-8AE5-5B5B00BEB248}.Release|x86.Build.0 = Release|Any CPU + {E2F5F115-0DE4-4CC0-920C-EF6F89D15EAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E2F5F115-0DE4-4CC0-920C-EF6F89D15EAB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E2F5F115-0DE4-4CC0-920C-EF6F89D15EAB}.Debug|x64.ActiveCfg = Debug|Any CPU + {E2F5F115-0DE4-4CC0-920C-EF6F89D15EAB}.Debug|x64.Build.0 = Debug|Any CPU + {E2F5F115-0DE4-4CC0-920C-EF6F89D15EAB}.Debug|x86.ActiveCfg = Debug|Any CPU + {E2F5F115-0DE4-4CC0-920C-EF6F89D15EAB}.Debug|x86.Build.0 = Debug|Any CPU + {E2F5F115-0DE4-4CC0-920C-EF6F89D15EAB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E2F5F115-0DE4-4CC0-920C-EF6F89D15EAB}.Release|Any CPU.Build.0 = Release|Any CPU + {E2F5F115-0DE4-4CC0-920C-EF6F89D15EAB}.Release|x64.ActiveCfg = Release|Any CPU + {E2F5F115-0DE4-4CC0-920C-EF6F89D15EAB}.Release|x64.Build.0 = Release|Any CPU + {E2F5F115-0DE4-4CC0-920C-EF6F89D15EAB}.Release|x86.ActiveCfg = Release|Any CPU + {E2F5F115-0DE4-4CC0-920C-EF6F89D15EAB}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/test/Microsoft.DotNet.ShellShim.Tests/FakeReporter.cs b/test/Microsoft.DotNet.ShellShim.Tests/FakeReporter.cs deleted file mode 100644 index a75956df7..000000000 --- a/test/Microsoft.DotNet.ShellShim.Tests/FakeReporter.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System; -using Microsoft.DotNet.Cli.Utils; - -namespace Microsoft.DotNet.ShellShim.Tests -{ - internal class FakeReporter : IReporter - { - public string Message { get; private set; } = ""; - - public void WriteLine(string message) - { - Message = message; - } - - public void WriteLine() - { - throw new NotImplementedException(); - } - - public void Write(string message) - { - throw new NotImplementedException(); - } - } -} diff --git a/test/Microsoft.DotNet.ShellShim.Tests/LinuxEnvironmentPathTests.cs b/test/Microsoft.DotNet.ShellShim.Tests/LinuxEnvironmentPathTests.cs index e039e392b..1457e6274 100644 --- a/test/Microsoft.DotNet.ShellShim.Tests/LinuxEnvironmentPathTests.cs +++ b/test/Microsoft.DotNet.ShellShim.Tests/LinuxEnvironmentPathTests.cs @@ -19,10 +19,10 @@ namespace Microsoft.DotNet.ShellShim.Tests [Fact] public void GivenEnvironmentAndReporterItCanPrintOutInstructionToAddPath() { - var fakeReporter = new FakeReporter(); + var reporter = new BufferedReporter(); var linuxEnvironmentPath = new LinuxEnvironmentPath( new BashPathUnderHomeDirectory("/myhome", "executable/path"), - fakeReporter, + reporter, new FakeEnvironmentProvider( new Dictionary { @@ -33,7 +33,7 @@ namespace Microsoft.DotNet.ShellShim.Tests linuxEnvironmentPath.PrintAddPathInstructionIfPathDoesNotExist(); // similar to https://code.visualstudio.com/docs/setup/mac - fakeReporter.Message.Should().Be( + reporter.Lines.Should().Equal( string.Format( CommonLocalizableStrings.EnvironmentPathLinuxManualInstruction, "/myhome/executable/path", "/myhome/executable/path")); @@ -42,10 +42,10 @@ namespace Microsoft.DotNet.ShellShim.Tests [Fact] public void GivenEnvironmentAndReporterItPrintsNothingWhenenvironmentExists() { - var fakeReporter = new FakeReporter(); + var reporter = new BufferedReporter(); var linuxEnvironmentPath = new LinuxEnvironmentPath( new BashPathUnderHomeDirectory("/myhome", "executable/path"), - fakeReporter, + reporter, new FakeEnvironmentProvider( new Dictionary { @@ -55,16 +55,16 @@ namespace Microsoft.DotNet.ShellShim.Tests linuxEnvironmentPath.PrintAddPathInstructionIfPathDoesNotExist(); - fakeReporter.Message.Should().BeEmpty(); + reporter.Lines.Should().BeEmpty(); } [Fact] public void GivenAddPackageExecutablePathToUserPathJustRunItPrintsInstructionToLogout() { - var fakeReporter = new FakeReporter(); + var reporter = new BufferedReporter(); var linuxEnvironmentPath = new LinuxEnvironmentPath( new BashPathUnderHomeDirectory("/myhome", "executable/path"), - fakeReporter, + reporter, new FakeEnvironmentProvider( new Dictionary { @@ -75,8 +75,8 @@ namespace Microsoft.DotNet.ShellShim.Tests linuxEnvironmentPath.PrintAddPathInstructionIfPathDoesNotExist(); - fakeReporter.Message.Should() - .Be(CommonLocalizableStrings.EnvironmentPathLinuxNeedLogout); + reporter.Lines.Should() + .Equal(CommonLocalizableStrings.EnvironmentPathLinuxNeedLogout); } } } diff --git a/test/Microsoft.DotNet.ShellShim.Tests/OsxEnvironmentPathTests.cs b/test/Microsoft.DotNet.ShellShim.Tests/OsxEnvironmentPathTests.cs index 230692608..df37a6b15 100644 --- a/test/Microsoft.DotNet.ShellShim.Tests/OsxEnvironmentPathTests.cs +++ b/test/Microsoft.DotNet.ShellShim.Tests/OsxEnvironmentPathTests.cs @@ -19,10 +19,10 @@ namespace Microsoft.DotNet.ShellShim.Tests [Fact] public void GivenEnvironmentAndReporterItCanPrintOutInstructionToAddPath() { - var fakeReporter = new FakeReporter(); + var reporter = new BufferedReporter(); var osxEnvironmentPath = new OSXEnvironmentPath( new BashPathUnderHomeDirectory("/myhome", "executable/path"), - fakeReporter, + reporter, new FakeEnvironmentProvider( new Dictionary { @@ -33,7 +33,7 @@ namespace Microsoft.DotNet.ShellShim.Tests osxEnvironmentPath.PrintAddPathInstructionIfPathDoesNotExist(); // similar to https://code.visualstudio.com/docs/setup/mac - fakeReporter.Message.Should().Be( + reporter.Lines.Should().Equal( string.Format( CommonLocalizableStrings.EnvironmentPathOSXManualInstruction, "/myhome/executable/path", "/myhome/executable/path")); @@ -44,10 +44,10 @@ namespace Microsoft.DotNet.ShellShim.Tests [InlineData("~/executable/path")] public void GivenEnvironmentAndReporterItPrintsNothingWhenenvironmentExists(string existingPath) { - var fakeReporter = new FakeReporter(); + var reporter = new BufferedReporter(); var osxEnvironmentPath = new OSXEnvironmentPath( new BashPathUnderHomeDirectory("/myhome", "executable/path"), - fakeReporter, + reporter, new FakeEnvironmentProvider( new Dictionary { @@ -57,16 +57,16 @@ namespace Microsoft.DotNet.ShellShim.Tests osxEnvironmentPath.PrintAddPathInstructionIfPathDoesNotExist(); - fakeReporter.Message.Should().BeEmpty(); + reporter.Lines.Should().BeEmpty(); } [Fact] public void GivenAddPackageExecutablePathToUserPathJustRunItPrintsInstructionToLogout() { - var fakeReporter = new FakeReporter(); + var reporter = new BufferedReporter(); var osxEnvironmentPath = new OSXEnvironmentPath( new BashPathUnderHomeDirectory("/myhome", "executable/path"), - fakeReporter, + reporter, new FakeEnvironmentProvider( new Dictionary { @@ -77,7 +77,7 @@ namespace Microsoft.DotNet.ShellShim.Tests osxEnvironmentPath.PrintAddPathInstructionIfPathDoesNotExist(); - fakeReporter.Message.Should().Be(CommonLocalizableStrings.EnvironmentPathOSXNeedReopen); + reporter.Lines.Should().Equal(CommonLocalizableStrings.EnvironmentPathOSXNeedReopen); } } } diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs b/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs index 0c739f674..977efdf35 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs +++ b/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs @@ -38,16 +38,21 @@ namespace Microsoft.DotNet.ToolPackage.Tests Action a = () => ToolConfigurationDeserializer.Deserialize("DotnetToolSettingsMissing.xml"); a.ShouldThrow() .And.Message.Should() - .Contain(string.Format(CommonLocalizableStrings.ToolSettingsContainError, string.Empty)); + .Contain(CommonLocalizableStrings.ToolSettingsMissingCommandName); } [Fact] public void GivenInvalidCharAsFileNameItThrows() { - Action a = () => new ToolConfiguration("na\0me", "my.dll"); + var invalidCommandName = "na\0me"; + Action a = () => new ToolConfiguration(invalidCommandName, "my.dll"); a.ShouldThrow() .And.Message.Should() - .Contain(string.Format(CommonLocalizableStrings.ContainInvalidCharacters, string.Empty)); + .Contain( + string.Format( + CommonLocalizableStrings.ToolSettingsInvalidCommandName, + invalidCommandName, + string.Join(", ", Path.GetInvalidFileNameChars().Select(c => $"'{c}'")))); } } } diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs index 08a8d14c9..b57e5cde1 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs +++ b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs @@ -9,6 +9,7 @@ using FluentAssertions; using Microsoft.DotNet.Tools.Test.Utilities; using Microsoft.Extensions.EnvironmentAbstractions; using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Tools; using Microsoft.DotNet.Tools.Install.Tool; using Xunit; @@ -21,6 +22,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests [Fact] public void GivenNoFeedItThrows() { + var reporter = new BufferedReporter(); var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); ToolPackageObtainer packageObtainer = @@ -29,7 +31,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests new DirectoryPath("no such path"), GetUniqueTempProjectPathEachTest, new Lazy(), - new ProjectRestorer()); + new ProjectRestorer(reporter)); Action a = () => packageObtainer.ObtainAndReturnExecutablePath( packageId: TestPackageId, @@ -37,11 +39,15 @@ namespace Microsoft.DotNet.ToolPackage.Tests targetframework: _testTargetframework); a.ShouldThrow(); + + reporter.Lines.Count.Should().Be(1); + reporter.Lines[0].Should().Contain(TestPackageId); } [Fact] public void GivenOfflineFeedWhenCallItCanDownloadThePackage() { + var reporter = new BufferedReporter(); var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); ToolPackageObtainer packageObtainer = @@ -50,7 +56,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests offlineFeedPath: new DirectoryPath(GetTestLocalFeedPath()), getTempProjectPath: GetUniqueTempProjectPathEachTest, bundledTargetFrameworkMoniker: new Lazy(), - projectRestorer: new ProjectRestorer()); + projectRestorer: new ProjectRestorer(reporter)); ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = packageObtainer.ObtainAndReturnExecutablePath( @@ -58,6 +64,8 @@ namespace Microsoft.DotNet.ToolPackage.Tests packageVersion: TestPackageVersion, targetframework: _testTargetframework); + reporter.Lines.Should().BeEmpty(); + var executable = toolConfigurationAndExecutablePath .Executable; @@ -77,11 +85,12 @@ namespace Microsoft.DotNet.ToolPackage.Tests public void GivenNugetConfigAndPackageNameAndVersionAndTargetFrameworkWhenCallItCanDownloadThePackage( bool testMockBehaviorIsInSync) { + var reporter = new BufferedReporter(); FilePath nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); var packageObtainer = - ConstructDefaultPackageObtainer(toolsPath, testMockBehaviorIsInSync, nugetConfigPath.Value); + ConstructDefaultPackageObtainer(toolsPath, reporter, testMockBehaviorIsInSync, nugetConfigPath.Value); ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = packageObtainer.ObtainAndReturnExecutablePath( @@ -90,6 +99,8 @@ namespace Microsoft.DotNet.ToolPackage.Tests nugetconfig: nugetConfigPath, targetframework: _testTargetframework); + reporter.Lines.Should().BeEmpty(); + FilePath executable = toolConfigurationAndExecutablePath.Executable; File.Exists(executable.Value) .Should() @@ -104,11 +115,12 @@ namespace Microsoft.DotNet.ToolPackage.Tests public void GivenNugetConfigAndPackageNameAndVersionAndTargetFrameworkWhenCallItCreateAssetFile( bool testMockBehaviorIsInSync) { + var reporter = new BufferedReporter(); var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); var packageObtainer = - ConstructDefaultPackageObtainer(toolsPath, testMockBehaviorIsInSync, nugetConfigPath.Value); + ConstructDefaultPackageObtainer(toolsPath, reporter, testMockBehaviorIsInSync, nugetConfigPath.Value); ToolConfigurationAndExecutablePath toolConfigurationAndExecutableDirectory = packageObtainer.ObtainAndReturnExecutablePath( @@ -117,6 +129,8 @@ namespace Microsoft.DotNet.ToolPackage.Tests nugetconfig: nugetConfigPath, targetframework: _testTargetframework); + reporter.Lines.Should().BeEmpty(); + /* From mytool.dll to project.assets.json .dotnet/.tools/packageid/version/packageid/version/mytool.dll @@ -146,6 +160,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests [InlineData(true)] public void GivenAllButNoNugetConfigFilePathItCanDownloadThePackage(bool testMockBehaviorIsInSync) { + var reporter = new BufferedReporter(); var uniqueTempProjectPath = GetUniqueTempProjectPathEachTest(); var tempProjectDirectory = uniqueTempProjectPath.GetDirectoryPath(); var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); @@ -171,7 +186,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests new DirectoryPath("no such path"), () => uniqueTempProjectPath, new Lazy(), - new ProjectRestorer()); + new ProjectRestorer(reporter)); } ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = @@ -180,6 +195,8 @@ namespace Microsoft.DotNet.ToolPackage.Tests packageVersion: TestPackageVersion, targetframework: _testTargetframework); + reporter.Lines.Should().BeEmpty(); + var executable = toolConfigurationAndExecutablePath.Executable; File.Exists(executable.Value) @@ -194,11 +211,12 @@ namespace Microsoft.DotNet.ToolPackage.Tests [InlineData(true)] public void GivenAllButNoPackageVersionItCanDownloadThePackage(bool testMockBehaviorIsInSync) { + var reporter = new BufferedReporter(); var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); var packageObtainer = - ConstructDefaultPackageObtainer(toolsPath, testMockBehaviorIsInSync, nugetConfigPath.Value); + ConstructDefaultPackageObtainer(toolsPath, reporter, testMockBehaviorIsInSync, nugetConfigPath.Value); ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = packageObtainer.ObtainAndReturnExecutablePath( @@ -206,6 +224,8 @@ namespace Microsoft.DotNet.ToolPackage.Tests nugetconfig: nugetConfigPath, targetframework: _testTargetframework); + reporter.Lines.Should().BeEmpty(); + var executable = toolConfigurationAndExecutablePath.Executable; File.Exists(executable.Value) @@ -220,22 +240,27 @@ namespace Microsoft.DotNet.ToolPackage.Tests [InlineData(true)] public void GivenAllButNoPackageVersionAndInvokeTwiceItShouldNotThrow(bool testMockBehaviorIsInSync) { + var reporter = new BufferedReporter(); var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); var packageObtainer = - ConstructDefaultPackageObtainer(toolsPath, testMockBehaviorIsInSync, nugetConfigPath.Value); + ConstructDefaultPackageObtainer(toolsPath, reporter, testMockBehaviorIsInSync, nugetConfigPath.Value); packageObtainer.ObtainAndReturnExecutablePath( packageId: TestPackageId, nugetconfig: nugetConfigPath, targetframework: _testTargetframework); + reporter.Lines.Should().BeEmpty(); + Action secondCall = () => packageObtainer.ObtainAndReturnExecutablePath( packageId: TestPackageId, nugetconfig: nugetConfigPath, targetframework: _testTargetframework); + reporter.Lines.Should().BeEmpty(); + secondCall.ShouldNotThrow(); } @@ -244,6 +269,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests [InlineData(true)] public void GivenAllButNoTargetFrameworkItCanDownloadThePackage(bool testMockBehaviorIsInSync) { + var reporter = new BufferedReporter(); var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); @@ -261,7 +287,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests { new MockFeedPackage { - PackageId = "global.tool.console.demo", + PackageId = TestPackageId, Version = "1.0.4" } } @@ -275,7 +301,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests new DirectoryPath("no such path"), GetUniqueTempProjectPathEachTest, new Lazy(() => BundledTargetFramework.GetTargetFrameworkMoniker()), - new ProjectRestorer()); + new ProjectRestorer(reporter)); } ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = packageObtainer.ObtainAndReturnExecutablePath( @@ -283,6 +309,8 @@ namespace Microsoft.DotNet.ToolPackage.Tests packageVersion: TestPackageVersion, nugetconfig: nugetConfigPath); + reporter.Lines.Should().BeEmpty(); + var executable = toolConfigurationAndExecutablePath.Executable; File.Exists(executable.Value) @@ -297,10 +325,11 @@ namespace Microsoft.DotNet.ToolPackage.Tests [InlineData(true)] public void GivenNonExistentNugetConfigFileItThrows(bool testMockBehaviorIsInSync) { + var reporter = new BufferedReporter(); var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); var packageObtainer = - ConstructDefaultPackageObtainer(toolsPath, testMockBehaviorIsInSync); + ConstructDefaultPackageObtainer(toolsPath, reporter, testMockBehaviorIsInSync); var nonExistNugetConfigFile = new FilePath("NonExistent.file"); Action a = () => @@ -317,6 +346,8 @@ namespace Microsoft.DotNet.ToolPackage.Tests .Message.Should().Contain(string.Format( CommonLocalizableStrings.NuGetConfigurationFileDoesNotExist, Path.GetFullPath(nonExistNugetConfigFile.Value))); + + reporter.Lines.Should().BeEmpty(); } [Theory] @@ -324,15 +355,18 @@ namespace Microsoft.DotNet.ToolPackage.Tests [InlineData(true)] public void GivenASourceItCanObtainThePackageFromThatSource(bool testMockBehaviorIsInSync) { + var reporter = new BufferedReporter(); var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); - var packageObtainer = ConstructDefaultPackageObtainer(toolsPath); + var packageObtainer = ConstructDefaultPackageObtainer(toolsPath, reporter); var toolConfigurationAndExecutableDirectory = packageObtainer.ObtainAndReturnExecutablePath( packageId: TestPackageId, packageVersion: TestPackageVersion, targetframework: _testTargetframework, source:GetTestLocalFeedPath()); + reporter.Lines.Should().BeEmpty(); + var executable = toolConfigurationAndExecutableDirectory.Executable; File.Exists(executable.Value) @@ -353,6 +387,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests private static IToolPackageObtainer ConstructDefaultPackageObtainer( string toolsPath, + IReporter reporter, bool testMockBehaviorIsInSync = false, string addNugetConfigFeedWithFilePath = null, string addSourceFeedWithFilePath = null) @@ -372,7 +407,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests { new MockFeedPackage { - PackageId = "global.tool.console.demo", + PackageId = TestPackageId, Version = "1.0.4" } } @@ -393,7 +428,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests { new MockFeedPackage { - PackageId = "global.tool.console.demo", + PackageId = TestPackageId, Version = "1.0.4" } } @@ -409,7 +444,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests new DirectoryPath("no such path"), GetUniqueTempProjectPathEachTest, new Lazy(), - new ProjectRestorer()); + new ProjectRestorer(reporter)); } private static FilePath WriteNugetConfigFileToPointToTheFeed() diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageObtainerMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageObtainerMock.cs index efc42f4e8..6c1e31b7c 100644 --- a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageObtainerMock.cs +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageObtainerMock.cs @@ -56,7 +56,8 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks string packageVersion = null, FilePath? nugetconfig = null, string targetframework = null, - string source = null) + string source = null, + string verbosity = null) { _beforeRunObtain(); diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/BufferedReporter.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/BufferedReporter.cs new file mode 100644 index 000000000..d4c865b08 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/BufferedReporter.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using Microsoft.DotNet.Cli.Utils; + +namespace Microsoft.DotNet.Tools.Test.Utilities +{ + public class BufferedReporter : IReporter + { + public List Lines { get; private set; } = new List(); + + public void WriteLine(string message) + { + Lines.Add(message); + } + + public void WriteLine() + { + Lines.Add(""); + } + + public void Write(string message) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/InstallCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/InstallCommand.cs new file mode 100644 index 000000000..ee1daa874 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/InstallCommand.cs @@ -0,0 +1,20 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using Microsoft.DotNet.Cli.Utils; + +namespace Microsoft.DotNet.Tools.Test.Utilities +{ + public sealed class InstallCommand : DotnetCommand + { + public override CommandResult Execute(string args = "") + { + return base.Execute($"install {args}"); + } + + public override CommandResult ExecuteWithCapturedOutput(string args = "") + { + return base.ExecuteWithCapturedOutput($"install {args}"); + } + } +} diff --git a/test/dotnet-install-tool.Tests/GivenDotnetInstallTool.cs b/test/dotnet-install-tool.Tests/GivenDotnetInstallTool.cs new file mode 100644 index 000000000..8fecb093d --- /dev/null +++ b/test/dotnet-install-tool.Tests/GivenDotnetInstallTool.cs @@ -0,0 +1,42 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using FluentAssertions; +using Microsoft.DotNet.Tools.Test.Utilities; +using Xunit; + +namespace Microsoft.DotNet.Cli.Install.Tests +{ + public class GivenDotnetInstallTool : TestBase + { + [Fact] + public void ItRunsWithQuietVerbosityByDefault() + { + var result = new InstallCommand() + .ExecuteWithCapturedOutput("tool -g nonexistent_tool_package"); + + result + .Should() + .Fail() + .And + .NotHaveStdOutContaining("Restoring"); + } + + [Fact] + public void ItRunsWithTheSpecifiedVerbosity() + { + var result = new InstallCommand() + .ExecuteWithCapturedOutput("tool -g -v:m nonexistent_tool_package"); + + result + .Should() + .Fail(); + + result + .StdOut + .Should() + .ContainVisuallySameFragmentIfNotLocalized("Restoring"); + } + } +} diff --git a/test/dotnet-install-tool.Tests/dotnet-install-tool.Tests.csproj b/test/dotnet-install-tool.Tests/dotnet-install-tool.Tests.csproj new file mode 100644 index 000000000..775ca7f35 --- /dev/null +++ b/test/dotnet-install-tool.Tests/dotnet-install-tool.Tests.csproj @@ -0,0 +1,20 @@ + + + $(CliTargetFramework) + $(MicrosoftNETCoreAppPackageVersion) + true + dotnet-install-tool.Tests + $(AssetTargetFallback);dotnet5.4;portable-net451+win8 + + + + + + + + + + + + + diff --git a/test/dotnet.Tests/InstallToolCommandTests/InstallToolCommandTests.cs b/test/dotnet.Tests/InstallToolCommandTests/InstallToolCommandTests.cs index 118db746b..60effad3b 100644 --- a/test/dotnet.Tests/InstallToolCommandTests/InstallToolCommandTests.cs +++ b/test/dotnet.Tests/InstallToolCommandTests/InstallToolCommandTests.cs @@ -12,6 +12,7 @@ using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.ToolPackage; using Microsoft.DotNet.Tools.Install.Tool; using Microsoft.DotNet.Tools.Tests.ComponentMocks; +using Microsoft.DotNet.Tools.Test.Utilities; using Microsoft.Extensions.DependencyModel.Tests; using Microsoft.Extensions.EnvironmentAbstractions; using Newtonsoft.Json; @@ -29,7 +30,7 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests private readonly EnvironmentPathInstructionMock _environmentPathInstructionMock; private readonly AppliedOption _appliedCommand; private readonly ParseResult _parseResult; - private readonly FakeReporter _fakeReporter; + private readonly BufferedReporter _reporter; private const string PathToPlaceShim = "pathToPlace"; public InstallToolCommandTests() @@ -37,9 +38,9 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests _fileSystemWrapper = new FileSystemMockBuilder().Build(); _toolPackageObtainerMock = new ToolPackageObtainerMock(_fileSystemWrapper); _shellShimMakerMock = new ShellShimMakerMock(PathToPlaceShim, _fileSystemWrapper); - _fakeReporter = new FakeReporter(); + _reporter = new BufferedReporter(); _environmentPathInstructionMock = - new EnvironmentPathInstructionMock(_fakeReporter, PathToPlaceShim); + new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim); ParseResult result = Parser.Instance.Parse("dotnet install tool -g global.tool.console.demo"); _appliedCommand = result["dotnet"]["install"]["tool"]; @@ -56,7 +57,7 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests _shellShimMakerMock, _environmentPathInstructionMock); - installToolCommand.Execute(); + installToolCommand.Execute().Should().Be(0); // It is hard to simulate shell behavior. Only Assert shim can point to executable dll _fileSystemWrapper.File.Exists(Path.Combine("pathToPlace", ToolPackageObtainerMock.FakeCommandName)) @@ -99,7 +100,7 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests _shellShimMakerMock, _environmentPathInstructionMock); - installToolCommand.Execute(); + installToolCommand.Execute().Should().Be(0); // It is hard to simulate shell behavior. Only Assert shim can point to executable dll _fileSystemWrapper.File.Exists(Path.Combine("pathToPlace", ToolPackageObtainerMock.FakeCommandName)) @@ -121,13 +122,13 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests _shellShimMakerMock, _environmentPathInstructionMock); - installToolCommand.Execute(); + installToolCommand.Execute().Should().Be(0); - _fakeReporter.Message.Single().Should().NotBeEmpty(); + _reporter.Lines.Single().Should().NotBeEmpty(); } [Fact] - public void GivenFailedPackageObtainWhenRunWithPackageIdItShouldThrow() + public void GivenFailedPackageObtainWhenRunWithPackageIdItShouldFail() { var toolPackageObtainerSimulatorThatThrows = new ToolPackageObtainerMock( @@ -139,17 +140,25 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests toolPackageObtainerSimulatorThatThrows, _shellShimMakerMock, _environmentPathInstructionMock, - _fakeReporter); + _reporter); - Action a = () => installToolCommand.Execute(); + installToolCommand.Execute().Should().Be(1); - a.ShouldThrow() - .And.Message.Should() - .Contain(string.Format(LocalizableStrings.InstallFailedNuget, "Simulated error")); + _reporter.Lines.Count.Should().Be(2); + + _reporter + .Lines[0] + .Should() + .Contain("Simulated error"); + + _reporter + .Lines[1] + .Should() + .Contain(string.Format(LocalizableStrings.ToolInstallationFailed, "global.tool.console.demo")); } [Fact] - public void GivenInCorrectToolConfigurationWhenRunWithPackageIdItShouldThrow() + public void GivenInCorrectToolConfigurationWhenRunWithPackageIdItShouldFail() { var toolPackageObtainerSimulatorThatThrows = new ToolPackageObtainerMock( @@ -161,12 +170,24 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests toolPackageObtainerSimulatorThatThrows, _shellShimMakerMock, _environmentPathInstructionMock, - _fakeReporter); + _reporter); - Action a = () => installToolCommand.Execute(); - a.ShouldThrow() - .And.Message.Should() - .Contain(string.Format(LocalizableStrings.InstallFailedPackage, "Simulated error")); + installToolCommand.Execute().Should().Be(1); + + _reporter.Lines.Count.Should().Be(2); + + _reporter + .Lines[0] + .Should() + .Contain( + string.Format( + LocalizableStrings.InvalidToolConfiguration, + "Simulated error")); + + _reporter + .Lines[1] + .Should() + .Contain(string.Format(LocalizableStrings.ToolInstallationFailedContactAuthor, "global.tool.console.demo")); } [Fact] @@ -177,35 +198,15 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests _parseResult, _toolPackageObtainerMock, _shellShimMakerMock, - new EnvironmentPathInstructionMock(_fakeReporter, PathToPlaceShim, true), - _fakeReporter); + new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true), + _reporter); - installToolCommand.Execute(); + installToolCommand.Execute().Should().Be(0); - _fakeReporter - .Message + _reporter + .Lines .Single().Should() .Contain(string.Format(LocalizableStrings.InstallationSucceeded, "SimulatorCommand")); } - - internal class FakeReporter : IReporter - { - public List Message { get; set; } = new List(); - - public void WriteLine(string message) - { - Message.Add(message); - } - - public void WriteLine() - { - throw new NotImplementedException(); - } - - public void Write(string message) - { - throw new NotImplementedException(); - } - } } } diff --git a/test/dotnet.Tests/ParserTests/InstallToolParserTests.cs b/test/dotnet.Tests/ParserTests/InstallToolParserTests.cs index 625f110c1..72d04d1c9 100644 --- a/test/dotnet.Tests/ParserTests/InstallToolParserTests.cs +++ b/test/dotnet.Tests/ParserTests/InstallToolParserTests.cs @@ -68,5 +68,16 @@ namespace Microsoft.DotNet.Tests.ParserTests var appliedOptions = result["dotnet"]["install"]["tool"]; appliedOptions.ValueOrDefault("global").Should().Be(true); } + + [Fact] + public void InstallToolParserCanParseVerbosityOption() + { + const string expectedVerbosityLevel = "diag"; + + var result = Parser.Instance.Parse($"dotnet install tool -g --verbosity:{expectedVerbosityLevel} console.test.app"); + + var appliedOptions = result["dotnet"]["install"]["tool"]; + appliedOptions.SingleArgumentOrDefault("verbosity").Should().Be(expectedVerbosityLevel); + } } }