From f8254778552caeb00c4862a013fd5097f93c56b1 Mon Sep 17 00:00:00 2001 From: Tomas Weinfurt Date: Wed, 1 Nov 2017 15:06:28 -0700 Subject: [PATCH 001/103] add basic support for FreeBSD --- src/Microsoft.DotNet.Cli.Utils/FileNameSuffixes.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Microsoft.DotNet.Cli.Utils/FileNameSuffixes.cs b/src/Microsoft.DotNet.Cli.Utils/FileNameSuffixes.cs index 5bb3fc795..43cdc1926 100644 --- a/src/Microsoft.DotNet.Cli.Utils/FileNameSuffixes.cs +++ b/src/Microsoft.DotNet.Cli.Utils/FileNameSuffixes.cs @@ -24,6 +24,8 @@ namespace Microsoft.DotNet.Cli.Utils return OSX; case Platform.Linux: return Linux; + case Platform.FreeBSD: + return FreeBSD; default: throw new InvalidOperationException("Unknown Platform"); } @@ -62,6 +64,14 @@ namespace Microsoft.DotNet.Cli.Utils StaticLib = ".a" }; + public static PlatformFileNameSuffixes FreeBSD { get; } = new PlatformFileNameSuffixes + { + DynamicLib = ".so", + Exe = "", + ProgramDatabase = ".pdb", + StaticLib = ".a" + }; + public struct PlatformFileNameSuffixes { public string DynamicLib { get; internal set; } From 090a241a12a082c9047e22cc12d98ab71451da61 Mon Sep 17 00:00:00 2001 From: test Date: Mon, 4 Dec 2017 11:30:38 -0800 Subject: [PATCH 002/103] update according to feedback --- src/Microsoft.DotNet.Cli.Utils/FileNameSuffixes.cs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Microsoft.DotNet.Cli.Utils/FileNameSuffixes.cs b/src/Microsoft.DotNet.Cli.Utils/FileNameSuffixes.cs index 43cdc1926..48c149c74 100644 --- a/src/Microsoft.DotNet.Cli.Utils/FileNameSuffixes.cs +++ b/src/Microsoft.DotNet.Cli.Utils/FileNameSuffixes.cs @@ -64,13 +64,7 @@ namespace Microsoft.DotNet.Cli.Utils StaticLib = ".a" }; - public static PlatformFileNameSuffixes FreeBSD { get; } = new PlatformFileNameSuffixes - { - DynamicLib = ".so", - Exe = "", - ProgramDatabase = ".pdb", - StaticLib = ".a" - }; + public static PlatformFileNameSuffixes FreeBSD { get; } = Linux; public struct PlatformFileNameSuffixes { From 5b5d69c95dade6d84f4cbbd980bcfeeda76aa266 Mon Sep 17 00:00:00 2001 From: Yanchen Wu Date: Wed, 17 Jan 2018 11:12:19 -0800 Subject: [PATCH 003/103] Adds Microsoft.Docker.Sdk to CLI This change is to add Sdk.props and Sdk.targets of Microsoft.Docker.Sdk into CLI. This unblocks the scenario where a VS solution contains a few .NET Core projects as well as a docker-compose.dcproj project and people want to build the solution from command line with .NET Core CLI. With the Sdk.props and Sdk.targets being present in CLI, building docker-compose.dcproj becomes no-op so it won't block building the other .NET Core projects. --- .../docker-compose/docker-compose.dcproj | 13 ++++++++ .../docker-compose/docker-compose.yml | 8 +++++ build/BundledSdks.props | 1 + build/NugetConfigFile.targets | 3 +- .../GivenDotnetBuildBuildsDcproj.cs | 32 +++++++++++++++++++ 5 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 TestAssets/TestProjects/docker-compose/docker-compose.dcproj create mode 100644 TestAssets/TestProjects/docker-compose/docker-compose.yml create mode 100644 test/dotnet-build.Tests/GivenDotnetBuildBuildsDcproj.cs diff --git a/TestAssets/TestProjects/docker-compose/docker-compose.dcproj b/TestAssets/TestProjects/docker-compose/docker-compose.dcproj new file mode 100644 index 000000000..17ed6f924 --- /dev/null +++ b/TestAssets/TestProjects/docker-compose/docker-compose.dcproj @@ -0,0 +1,13 @@ + + + + 2.0 + Linux + LaunchBrowser + http://localhost:{ServicePort} + testwebapplication + + + + + \ No newline at end of file diff --git a/TestAssets/TestProjects/docker-compose/docker-compose.yml b/TestAssets/TestProjects/docker-compose/docker-compose.yml new file mode 100644 index 000000000..9903b7748 --- /dev/null +++ b/TestAssets/TestProjects/docker-compose/docker-compose.yml @@ -0,0 +1,8 @@ +version: '3.0' + +services: + testwebapplication: + image: testwebapplication + build: + context: . + dockerfile: testwebapplication/Dockerfile diff --git a/build/BundledSdks.props b/build/BundledSdks.props index d665ef7f3..f4fd195ac 100644 --- a/build/BundledSdks.props +++ b/build/BundledSdks.props @@ -6,5 +6,6 @@ + diff --git a/build/NugetConfigFile.targets b/build/NugetConfigFile.targets index 128a68954..4a5692ef8 100644 --- a/build/NugetConfigFile.targets +++ b/build/NugetConfigFile.targets @@ -30,7 +30,8 @@ - + + ]]> diff --git a/test/dotnet-build.Tests/GivenDotnetBuildBuildsDcproj.cs b/test/dotnet-build.Tests/GivenDotnetBuildBuildsDcproj.cs new file mode 100644 index 000000000..eb062eb71 --- /dev/null +++ b/test/dotnet-build.Tests/GivenDotnetBuildBuildsDcproj.cs @@ -0,0 +1,32 @@ +// 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 FluentAssertions; +using Microsoft.DotNet.Tools.Test.Utilities; +using Xunit; + +namespace Microsoft.DotNet.Cli.Build.Tests +{ + public class GivenDotnetBuildBuildsDcproj : TestBase + { + [Fact] + public void ItPrintsBuildSummary() + { + var testAppName = "docker-compose"; + var testInstance = TestAssets.Get(testAppName) + .CreateInstance(testAppName) + .WithSourceFiles() + .WithRestoreFiles(); + + string expectedBuildSummary = @"Build succeeded. + 0 Warning(s) + 0 Error(s)"; + + var cmd = new BuildCommand() + .WithWorkingDirectory(testInstance.Root) + .ExecuteWithCapturedOutput(); + cmd.Should().Pass(); + cmd.StdOut.Should().ContainVisuallySameFragment(expectedBuildSummary); + } + } +} \ No newline at end of file From 9d5bd8637e2c6ab9ab10657e5577b1644a102958 Mon Sep 17 00:00:00 2001 From: jbeisner Date: Mon, 22 Jan 2018 20:37:35 +0000 Subject: [PATCH 004/103] If the Nuget.config has already been generated, do not re-generate the file every time 'Run-Build' or 'Build' is called. --- build/NugetConfigFile.targets | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/build/NugetConfigFile.targets b/build/NugetConfigFile.targets index 128a68954..3c83fe7b2 100644 --- a/build/NugetConfigFile.targets +++ b/build/NugetConfigFile.targets @@ -1,10 +1,11 @@ - + + + + + - - - - ]]> - - + + - + Date: Mon, 22 Jan 2018 20:49:23 +0000 Subject: [PATCH 005/103] If 'OrchestratedPackageVersionsProps.props' is present, do not re-download the file every time 'Run-Build' or 'Build' is called. --- build/DownloadPackageVersions.targets | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/DownloadPackageVersions.targets b/build/DownloadPackageVersions.targets index dc821037b..0ba046e7c 100644 --- a/build/DownloadPackageVersions.targets +++ b/build/DownloadPackageVersions.targets @@ -1,6 +1,7 @@ + Condition=" !Exists('$(OrchestratedPackageVersionsProps)') " + DependsOnTargets="BuildDotnetCliBuildFramework"> Date: Mon, 22 Jan 2018 13:32:51 -0800 Subject: [PATCH 006/103] Updating the branding to 2.1.3-preview2. --- build/Branding.props | 2 +- build/Version.props | 6 +++--- packaging/osx/clisdk/resources/cs.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/de.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/en.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/es.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/fr.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/it.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/ja.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/ko.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/pl.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/pt-br.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/ru.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/tr.lproj/conclusion.html | 2 +- .../osx/clisdk/resources/zh-hans.lproj/conclusion.html | 2 +- .../osx/clisdk/resources/zh-hant.lproj/conclusion.html | 2 +- packaging/windows/clisdk/bundle.wxl | 2 +- 17 files changed, 19 insertions(+), 19 deletions(-) diff --git a/build/Branding.props b/build/Branding.props index ade8799ad..eadbd0927 100644 --- a/build/Branding.props +++ b/build/Branding.props @@ -1,7 +1,7 @@ cli - Microsoft .NET Core SDK 2.2.0 - Preview + Microsoft .NET Core SDK 2.1.300 - Preview .NET Standard Support for Visual Studio 2015 Microsoft .NET Core Runtime 2.1.0 - Preview Microsoft .NET Core Host 2.1.0 - Preview diff --git a/build/Version.props b/build/Version.props index 6e311dd4d..99f4241a6 100644 --- a/build/Version.props +++ b/build/Version.props @@ -1,9 +1,9 @@ 2 - 2 - 0 - preview1 + 1 + 300 + preview2 $(VersionMajor).$(VersionMinor).$(VersionPatch)-$(ReleaseSuffix) $(VersionMajor).$(VersionMinor).$(VersionPatch).$(CommitCount) diff --git a/packaging/osx/clisdk/resources/cs.lproj/conclusion.html b/packaging/osx/clisdk/resources/cs.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/cs.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/cs.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/de.lproj/conclusion.html b/packaging/osx/clisdk/resources/de.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/de.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/de.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/en.lproj/conclusion.html b/packaging/osx/clisdk/resources/en.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/en.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/en.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/es.lproj/conclusion.html b/packaging/osx/clisdk/resources/es.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/es.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/es.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/fr.lproj/conclusion.html b/packaging/osx/clisdk/resources/fr.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/fr.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/fr.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/it.lproj/conclusion.html b/packaging/osx/clisdk/resources/it.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/it.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/it.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/ja.lproj/conclusion.html b/packaging/osx/clisdk/resources/ja.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/ja.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/ja.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/ko.lproj/conclusion.html b/packaging/osx/clisdk/resources/ko.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/ko.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/ko.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/pl.lproj/conclusion.html b/packaging/osx/clisdk/resources/pl.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/pl.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/pl.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/pt-br.lproj/conclusion.html b/packaging/osx/clisdk/resources/pt-br.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/pt-br.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/pt-br.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/ru.lproj/conclusion.html b/packaging/osx/clisdk/resources/ru.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/ru.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/ru.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/tr.lproj/conclusion.html b/packaging/osx/clisdk/resources/tr.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/tr.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/tr.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/zh-hans.lproj/conclusion.html b/packaging/osx/clisdk/resources/zh-hans.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/zh-hans.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/zh-hans.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/zh-hant.lproj/conclusion.html b/packaging/osx/clisdk/resources/zh-hant.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/zh-hant.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/zh-hant.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/windows/clisdk/bundle.wxl b/packaging/windows/clisdk/bundle.wxl index 2a8b6148f..09d08194b 100644 --- a/packaging/windows/clisdk/bundle.wxl +++ b/packaging/windows/clisdk/bundle.wxl @@ -50,7 +50,7 @@ The installation was successful The following were installed at [DOTNETHOME] - • .NET Core SDK 2.2.0 + • .NET Core SDK 2.1.300 • .NET Core Runtime 2.1.0 • ASP.NET Core Runtime 2.1.0 From 8cb01e226cf733b56059c09228a74e58bd6b0e10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbyn=C4=9Bk=20Sailer?= Date: Mon, 22 Jan 2018 22:56:03 +0100 Subject: [PATCH 007/103] LOC CHECKIN | cli - master | 20180112 (#8385) * LOC CHECKIN | cli - master | 20180112 * LOC CHECKIN | cli - master | 20180118 update * LOC CHECKIN | cli - master | 20180119 update | DEU fix --- .../xlf/LocalizableStrings.de.xlf | 2 +- .../commands/dotnet-help/xlf/LocalizableStrings.cs.xlf | 4 ++-- .../commands/dotnet-help/xlf/LocalizableStrings.de.xlf | 8 ++++---- .../commands/dotnet-help/xlf/LocalizableStrings.es.xlf | 4 ++-- .../commands/dotnet-help/xlf/LocalizableStrings.fr.xlf | 4 ++-- .../commands/dotnet-help/xlf/LocalizableStrings.it.xlf | 4 ++-- .../commands/dotnet-help/xlf/LocalizableStrings.ja.xlf | 4 ++-- .../commands/dotnet-help/xlf/LocalizableStrings.ko.xlf | 4 ++-- .../commands/dotnet-help/xlf/LocalizableStrings.pl.xlf | 4 ++-- .../commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf | 4 ++-- .../commands/dotnet-help/xlf/LocalizableStrings.ru.xlf | 4 ++-- .../commands/dotnet-help/xlf/LocalizableStrings.tr.xlf | 4 ++-- .../dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf | 4 ++-- .../dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf | 4 ++-- .../commands/dotnet-publish/xlf/LocalizableStrings.de.xlf | 2 +- .../commands/dotnet-restore/xlf/LocalizableStrings.de.xlf | 2 +- .../commands/dotnet-store/xlf/LocalizableStrings.de.xlf | 2 +- src/dotnet/xlf/CommonLocalizableStrings.de.xlf | 2 +- 18 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.de.xlf b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.de.xlf index 03af407f7..d09a4d531 100644 --- a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.de.xlf +++ b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.de.xlf @@ -216,7 +216,7 @@ {0}: Ignoring prefercliruntime file as the tool target framework ({1}) has a different major version than the current CLI runtime ({2}) - {0}: Die Datei "prefercliruntime" wird ignoriert, da das Tool-Ziellaufwerk ({1}) eine andere Hauptversion aufweist als die aktuelle CLI-Laufzeit ({2}). + {0}: Die Datei "prefercliruntime" wird ignoriert, da das Tool-Ziellaufwerk ({1}) eine andere Hauptversion aufweist als die aktuelle CLI-Runtime ({2}). diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf index 1fb918e20..60c3f06c0 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf @@ -199,12 +199,12 @@ Display the installed SDKs. - Display the installed SDKs. + Zobrazí nainstalované sady SDK. Display the installed runtimes. - Display the installed runtimes. + Zobrazí nainstalované moduly runtime. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf index abe8ca5e0..626ac712d 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf @@ -79,7 +79,7 @@ Publishes a .NET project for deployment (including the runtime). - Veröffentlicht ein .NET-Projekt für die Bereitstellung (einschließlich Laufzeit). + Veröffentlicht ein .NET-Projekt für die Bereitstellung (einschließlich Runtime). @@ -199,12 +199,12 @@ Display the installed SDKs. - Display the installed SDKs. + Die installierten SDKs anzeigen. Display the installed runtimes. - Display the installed runtimes. + Die installierten Runtimes anzeigen. @@ -249,7 +249,7 @@ Stores the specified assemblies in the runtime store. - Speichert die angegebenen Assemblys im Laufzeitspeicher. + Speichert die angegebenen Assemblys im Runtimespeicher. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf index 4e2c38024..be6b957d5 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf @@ -199,12 +199,12 @@ Display the installed SDKs. - Display the installed SDKs. + Muestra los SDK instalados. Display the installed runtimes. - Display the installed runtimes. + Muestra los runtimes instalados. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf index 02402ccd8..4bc43827b 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf @@ -199,12 +199,12 @@ Display the installed SDKs. - Display the installed SDKs. + Affichez les SDK installés. Display the installed runtimes. - Display the installed runtimes. + Affichez les runtimes installés. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf index 637855a3b..02ce8040d 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf @@ -199,12 +199,12 @@ Display the installed SDKs. - Display the installed SDKs. + Visualizza gli SDK installati. Display the installed runtimes. - Display the installed runtimes. + Visualizza i runtime installati. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf index 00024f552..db469af6d 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf @@ -199,12 +199,12 @@ Display the installed SDKs. - Display the installed SDKs. + インストール済み SDK を表示します。 Display the installed runtimes. - Display the installed runtimes. + インストール済みランタイムを表示します。 diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf index ee370d0a4..a1f5caf5f 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf @@ -199,12 +199,12 @@ Display the installed SDKs. - Display the installed SDKs. + 설치된 SDK를 표시합니다. Display the installed runtimes. - Display the installed runtimes. + 설치된 런타임을 표시합니다. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf index a1e190326..dedb2d7a8 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf @@ -199,12 +199,12 @@ Display the installed SDKs. - Display the installed SDKs. + Wyświetl zainstalowane zestawy SDK. Display the installed runtimes. - Display the installed runtimes. + Wyświetl zainstalowane środowiska uruchomieniowe. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf index 07da2c572..c6bff9d2e 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf @@ -199,12 +199,12 @@ Display the installed SDKs. - Display the installed SDKs. + Exiba os SDKs instalados. Display the installed runtimes. - Display the installed runtimes. + Exiba os runtimes instalados. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf index 7bca9053d..8cba3d0b4 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf @@ -199,12 +199,12 @@ Display the installed SDKs. - Display the installed SDKs. + Отображение установленных пакетов SDK. Display the installed runtimes. - Display the installed runtimes. + Отображение установленных сред выполнения. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf index 7cf185f5d..66f2b8431 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf @@ -199,12 +199,12 @@ Display the installed SDKs. - Display the installed SDKs. + Yüklü SDK’ları görüntüleyin. Display the installed runtimes. - Display the installed runtimes. + Yüklü çalışma zamanlarını görüntüleyin. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf index e42cfcaec..f885412c5 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf @@ -199,12 +199,12 @@ Display the installed SDKs. - Display the installed SDKs. + 显示安装的 SDK。 Display the installed runtimes. - Display the installed runtimes. + 显示安装的运行时。 diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf index 37c8943cf..571d32f19 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf @@ -199,12 +199,12 @@ Display the installed SDKs. - Display the installed SDKs. + 顯示已安裝的 SDK。 Display the installed runtimes. - Display the installed runtimes. + 顯示已安裝的執行階段。 diff --git a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.de.xlf index e3a1c6ecf..832d56a35 100644 --- a/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.de.xlf +++ b/src/dotnet/commands/dotnet-publish/xlf/LocalizableStrings.de.xlf @@ -39,7 +39,7 @@ Publish the .NET Core runtime with your application so the runtime doesn't need to be installed on the target machine. Defaults to 'true' if a runtime identifier is specified. - Veröffentlichen Sie die .NET Core-Laufzeit mit Ihrer Anwendung, damit die Laufzeit auf dem Zielcomputer nicht installiert werden muss. Der Standardwert ist "true", wenn ein Laufzeitbezeichner angegeben ist. + Veröffentlichen Sie die .NET Core-Runtime mit Ihrer Anwendung, damit die Runtime auf dem Zielcomputer nicht installiert werden muss. Der Standardwert ist "true", wenn ein Runtimebezeichner angegeben ist. diff --git a/src/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.de.xlf index 30e522954..0055fc72c 100644 --- a/src/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.de.xlf +++ b/src/dotnet/commands/dotnet-restore/xlf/LocalizableStrings.de.xlf @@ -79,7 +79,7 @@ Target runtime to restore packages for. - Ziellaufzeit für die Wiederherstellung von Paketen. + Zielruntime für die Wiederherstellung von Paketen. diff --git a/src/dotnet/commands/dotnet-store/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-store/xlf/LocalizableStrings.de.xlf index 654ca4754..17eebcdd8 100644 --- a/src/dotnet/commands/dotnet-store/xlf/LocalizableStrings.de.xlf +++ b/src/dotnet/commands/dotnet-store/xlf/LocalizableStrings.de.xlf @@ -4,7 +4,7 @@ Stores the specified assemblies for the .NET Platform. By default, these will be optimized for the target runtime and framework. - Speichert die angegebenen Assemblys für die .NET-Plattform. Standardmäßig werden diese für die Ziellaufzeit und das Framework optimiert. + Speichert die angegebenen Assemblys für die .NET-Plattform. Standardmäßig werden diese für die Zielruntime und das Framework optimiert. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf index 777d128ea..2ef360050 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf @@ -646,7 +646,7 @@ Publish the project for a given runtime. This is used when creating self-contained deployment. Default is to publish a framework-dependent app. - Veröffentlichen Sie das Projekt für eine angegebene Laufzeit. Wird zum Erstellen einer eigenständigen Bereitstellung verwendet. Standardmäßig wird eine frameworkabhängige App veröffentlicht. + Veröffentlichen Sie das Projekt für eine angegebene Runtime. Wird zum Erstellen einer eigenständigen Bereitstellung verwendet. Standardmäßig wird eine frameworkabhängige App veröffentlicht. From 579e84734ad5f1b873652f67328d7072c77cf9ce Mon Sep 17 00:00:00 2001 From: jbeisner Date: Mon, 22 Jan 2018 21:39:47 -0800 Subject: [PATCH 008/103] The orchestrated "PackageVersion" type variables should not be used in any of the 'proj' files of the built build tools under: "build_projects" --- build_projects/dotnet-cli-build/dotnet-cli-build.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_projects/dotnet-cli-build/dotnet-cli-build.csproj b/build_projects/dotnet-cli-build/dotnet-cli-build.csproj index 779806a94..4a9a444c4 100644 --- a/build_projects/dotnet-cli-build/dotnet-cli-build.csproj +++ b/build_projects/dotnet-cli-build/dotnet-cli-build.csproj @@ -14,7 +14,7 @@ - + From 94fc976ea54196e98cf6b0301aad78c3fa08ae4e Mon Sep 17 00:00:00 2001 From: jbeisner Date: Tue, 23 Jan 2018 17:45:14 +0000 Subject: [PATCH 009/103] Revert "If the Nuget.config has already been generated, do not re-generate the file every time 'Run-Build' or 'Build' is called." This reverts commit 9d5bd8637e2c6ab9ab10657e5577b1644a102958. --- build/NugetConfigFile.targets | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/build/NugetConfigFile.targets b/build/NugetConfigFile.targets index 3c83fe7b2..128a68954 100644 --- a/build/NugetConfigFile.targets +++ b/build/NugetConfigFile.targets @@ -1,11 +1,10 @@ - - - - - + + + + + ]]> - - + + - + Date: Tue, 23 Jan 2018 17:46:09 +0000 Subject: [PATCH 010/103] Revert "If 'OrchestratedPackageVersionsProps.props' is present, do not re-download the file every time 'Run-Build' or 'Build' is called." This reverts commit d3e905997ce4d522dece1edcfa2dbefdbf036641. --- build/DownloadPackageVersions.targets | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build/DownloadPackageVersions.targets b/build/DownloadPackageVersions.targets index 0ba046e7c..dc821037b 100644 --- a/build/DownloadPackageVersions.targets +++ b/build/DownloadPackageVersions.targets @@ -1,7 +1,6 @@ + DependsOnTargets="BuildDotnetCliBuildFramework"> Date: Wed, 24 Jan 2018 10:16:27 -0800 Subject: [PATCH 011/103] Use rich mock to test InstallCommand (#8402) To ensure the mock has the same behavior the component has, run mock under the same tests the adapter has. It is a common problem that moq has -- "everything is mocked out, you are not test anything" --- Microsoft.DotNet.Cli.sln | 27 ++ build/test/TestProjects.targets | 1 + .../Properties/Properties.cs | 3 + src/dotnet/Properties/AssemblyInfo.cs | 2 + src/dotnet/ShellShim/IShellShimMaker.cs | 8 + src/dotnet/ShellShim/ShellShimMaker.cs | 2 +- .../ToolPackage/IToolPackageObtainer.cs | 17 ++ src/dotnet/ToolPackage/ToolPackageObtainer.cs | 2 +- .../dotnet-install-tool/InstallToolCommand.cs | 79 +++--- test/Microsoft.DotNet.Cli.Tests.sln | 14 + .../Microsoft.DotNet.ShellShim.Tests.csproj | 1 + .../ShellShimMakerTests.cs | 34 ++- .../Microsoft.DotNet.ToolPackage.Tests.csproj | 1 + .../ToolPackageObtainerTests.cs | 267 +++++++++++++----- .../EnvironmentPathInstructionMock.cs | 39 +++ ...t.DotNet.Tools.Tests.ComponentMocks.csproj | 16 ++ .../MockFeed.cs | 14 + .../MockFeedPackage.cs | 11 + .../MockFeedType.cs | 12 + .../Properties/Properties.cs | 8 + .../ShellShimMakerMock.cs | 58 ++++ .../ToolPackageObtainerMock.cs | 159 +++++++++++ .../Properties/Properties.cs | 7 +- .../InstallToolCommandTests.cs | 211 ++++++++++++++ test/dotnet.Tests/dotnet.Tests.csproj | 1 + 25 files changed, 881 insertions(+), 113 deletions(-) create mode 100644 src/dotnet/ShellShim/IShellShimMaker.cs create mode 100644 src/dotnet/ToolPackage/IToolPackageObtainer.cs create mode 100644 test/Microsoft.DotNet.Tools.Tests.ComponentMocks/EnvironmentPathInstructionMock.cs create mode 100644 test/Microsoft.DotNet.Tools.Tests.ComponentMocks/Microsoft.DotNet.Tools.Tests.ComponentMocks.csproj create mode 100644 test/Microsoft.DotNet.Tools.Tests.ComponentMocks/MockFeed.cs create mode 100644 test/Microsoft.DotNet.Tools.Tests.ComponentMocks/MockFeedPackage.cs create mode 100644 test/Microsoft.DotNet.Tools.Tests.ComponentMocks/MockFeedType.cs create mode 100644 test/Microsoft.DotNet.Tools.Tests.ComponentMocks/Properties/Properties.cs create mode 100644 test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimMakerMock.cs create mode 100644 test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageObtainerMock.cs create mode 100644 test/dotnet.Tests/InstallToolCommandTests/InstallToolCommandTests.cs diff --git a/Microsoft.DotNet.Cli.sln b/Microsoft.DotNet.Cli.sln index 0748db81a..6e03ba1ff 100644 --- a/Microsoft.DotNet.Cli.sln +++ b/Microsoft.DotNet.Cli.sln @@ -232,6 +232,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.ShellShim. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.ToolPackage.Tests", "test\Microsoft.DotNet.ToolPackage.Tests\Microsoft.DotNet.ToolPackage.Tests.csproj", "{91BFE800-1624-4A58-A1CE-339705A8FFD0}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Tools.Tests.ComponentMocks", "test\Microsoft.DotNet.Tools.Tests.ComponentMocks\Microsoft.DotNet.Tools.Tests.ComponentMocks.csproj", "{E442F4C1-08DB-470F-B9A6-197444CD0295}" +EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "tool_launcher", "src\tool_launcher\tool_launcher.csproj", "{EDF19BE6-F20F-4AD0-8E3B-E837030726A5}" EndProject Global @@ -1666,6 +1668,30 @@ Global {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.RelWithDebInfo|x64.Build.0 = Release|Any CPU {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.RelWithDebInfo|x86.Build.0 = Release|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.Debug|x64.ActiveCfg = Debug|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.Debug|x64.Build.0 = Debug|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.Debug|x86.ActiveCfg = Debug|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.Debug|x86.Build.0 = Debug|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.MinSizeRel|x86.ActiveCfg = Debug|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.MinSizeRel|x86.Build.0 = Debug|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.Release|Any CPU.Build.0 = Release|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.Release|x64.ActiveCfg = Release|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.Release|x64.Build.0 = Release|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.Release|x86.ActiveCfg = Release|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.Release|x86.Build.0 = Release|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {E442F4C1-08DB-470F-B9A6-197444CD0295}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {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 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1740,6 +1766,7 @@ Global {E84C08C9-70D7-48B0-9507-ADB8B9A2694C} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {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} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B526D2CE-EE2D-4AD4-93EF-1867D90FF1F5} diff --git a/build/test/TestProjects.targets b/build/test/TestProjects.targets index 8a5d21a55..96b08c34d 100644 --- a/build/test/TestProjects.targets +++ b/build/test/TestProjects.targets @@ -15,6 +15,7 @@ diff --git a/src/Microsoft.DotNet.InternalAbstractions/Properties/Properties.cs b/src/Microsoft.DotNet.InternalAbstractions/Properties/Properties.cs index 4b08b51db..ecdec5b5d 100644 --- a/src/Microsoft.DotNet.InternalAbstractions/Properties/Properties.cs +++ b/src/Microsoft.DotNet.InternalAbstractions/Properties/Properties.cs @@ -8,6 +8,7 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Microsoft.Extensions.DependencyModel, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("dotnet, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.DotNet.Tools.Tests.Utilities, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("Microsoft.DotNet.Tools.Tests.ComponentMocks, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.Extensions.DependencyModel.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.DotNet.Configurer, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.DotNet.Configurer.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] @@ -15,3 +16,5 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("dotnet-test.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100039ac461fa5c82c7dd2557400c4fd4e9dcdf7ac47e3d572548c04cd4673e004916610f4ea5cbf86f2b1ca1cb824f2a7b3976afecfcf4eb72d9a899aa6786effa10c30399e6580ed848231fec48374e41b3acf8811931343fc2f73acf72dae745adbcb7063cc4b50550618383202875223fc75401351cd89c44bf9b50e7fa3796")] [assembly: InternalsVisibleTo("Microsoft.DotNet.Tools.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.DotNet.ShellShim.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("Microsoft.DotNet.ToolPackage.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("dotnet.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] diff --git a/src/dotnet/Properties/AssemblyInfo.cs b/src/dotnet/Properties/AssemblyInfo.cs index 249576dc2..25bd8cb8c 100644 --- a/src/dotnet/Properties/AssemblyInfo.cs +++ b/src/dotnet/Properties/AssemblyInfo.cs @@ -17,5 +17,7 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("dotnet-sln-remove.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("dotnet-msbuild.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("dotnet-run.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("Microsoft.DotNet.Tools.Tests.Utilities, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("Microsoft.DotNet.Tools.Tests.ComponentMocks, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.DotNet.ToolPackage.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.DotNet.ShellShim.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] diff --git a/src/dotnet/ShellShim/IShellShimMaker.cs b/src/dotnet/ShellShim/IShellShimMaker.cs new file mode 100644 index 000000000..35ff02493 --- /dev/null +++ b/src/dotnet/ShellShim/IShellShimMaker.cs @@ -0,0 +1,8 @@ +namespace Microsoft.DotNet.ShellShim +{ + public interface IShellShimMaker + { + void CreateShim(string packageExecutablePath, string shellCommandName); + void EnsureCommandNameUniqueness(string shellCommandName); + } +} diff --git a/src/dotnet/ShellShim/ShellShimMaker.cs b/src/dotnet/ShellShim/ShellShimMaker.cs index bf204a1ef..f3247c620 100644 --- a/src/dotnet/ShellShim/ShellShimMaker.cs +++ b/src/dotnet/ShellShim/ShellShimMaker.cs @@ -13,7 +13,7 @@ using Microsoft.Extensions.EnvironmentAbstractions; namespace Microsoft.DotNet.ShellShim { - public class ShellShimMaker + public class ShellShimMaker : IShellShimMaker { private const string LauncherExeResourceName = "Microsoft.DotNet.Tools.Launcher.Executable"; private const string LauncherConfigResourceName = "Microsoft.DotNet.Tools.Launcher.Config"; diff --git a/src/dotnet/ToolPackage/IToolPackageObtainer.cs b/src/dotnet/ToolPackage/IToolPackageObtainer.cs new file mode 100644 index 000000000..e48694f9e --- /dev/null +++ b/src/dotnet/ToolPackage/IToolPackageObtainer.cs @@ -0,0 +1,17 @@ +// 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.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.ToolPackage +{ + internal interface IToolPackageObtainer + { + ToolConfigurationAndExecutablePath ObtainAndReturnExecutablePath( + string packageId, + string packageVersion = null, + FilePath? nugetconfig = null, + string targetframework = null, + string source = null); + } +} diff --git a/src/dotnet/ToolPackage/ToolPackageObtainer.cs b/src/dotnet/ToolPackage/ToolPackageObtainer.cs index 151fe83e7..3ef3597b0 100644 --- a/src/dotnet/ToolPackage/ToolPackageObtainer.cs +++ b/src/dotnet/ToolPackage/ToolPackageObtainer.cs @@ -10,7 +10,7 @@ using NuGet.ProjectModel; namespace Microsoft.DotNet.ToolPackage { - internal class ToolPackageObtainer + internal class ToolPackageObtainer : IToolPackageObtainer { private readonly Lazy _bundledTargetFrameworkMoniker; private readonly Func _getTempProjectPath; 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 276a681f5..783666939 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs @@ -14,18 +14,27 @@ using Microsoft.Extensions.EnvironmentAbstractions; namespace Microsoft.DotNet.Tools.Install.Tool { - public class InstallToolCommand : CommandBase + internal class InstallToolCommand : CommandBase { - private static string _packageId; - private static string _packageVersion; - private static string _configFilePath; - private static string _framework; - private static string _source; - private static bool _global; + private readonly IToolPackageObtainer _toolPackageObtainer; + private readonly IEnvironmentPathInstruction _environmentPathInstruction; + private readonly IShellShimMaker _shellShimMaker; + private readonly IReporter _reporter; + + private readonly string _packageId; + private readonly string _packageVersion; + private readonly string _configFilePath; + private readonly string _framework; + private readonly string _source; + private readonly bool _global; public InstallToolCommand( AppliedOption appliedCommand, - ParseResult parseResult) + ParseResult parseResult, + IToolPackageObtainer toolPackageObtainer = null, + IShellShimMaker shellShimMaker = null, + IEnvironmentPathInstruction environmentPathInstruction = null, + IReporter reporter = null) : base(parseResult) { if (appliedCommand == null) @@ -39,6 +48,27 @@ namespace Microsoft.DotNet.Tools.Install.Tool _framework = appliedCommand.ValueOrDefault("framework"); _source = appliedCommand.ValueOrDefault("source"); _global = appliedCommand.ValueOrDefault("global"); + + var cliFolderPathCalculator = new CliFolderPathCalculator(); + var executablePackagePath = new DirectoryPath(cliFolderPathCalculator.ExecutablePackagesPath); + var offlineFeedPath = new DirectoryPath(cliFolderPathCalculator.CliFallbackFolderPath); + _toolPackageObtainer = toolPackageObtainer ?? new ToolPackageObtainer( + executablePackagePath, + offlineFeedPath, + () => new DirectoryPath(Path.GetTempPath()) + .WithSubDirectories(Path.GetRandomFileName()) + .WithFile(Path.GetRandomFileName() + ".csproj"), + new Lazy(BundledTargetFramework.GetTargetFrameworkMoniker), + new PackageToProjectFileAdder(), + new ProjectRestorer()); + + _environmentPathInstruction = environmentPathInstruction + ?? EnvironmentPathFactory + .CreateEnvironmentPathInstruction(); + + _shellShimMaker = shellShimMaker ?? new ShellShimMaker(executablePackagePath.Value); + + _reporter = reporter ?? Reporter.Output; } public override int Execute() @@ -48,33 +78,25 @@ namespace Microsoft.DotNet.Tools.Install.Tool throw new GracefulException(LocalizableStrings.InstallToolCommandOnlySupportGlobal); } - var cliFolderPathCalculator = new CliFolderPathCalculator(); - var executablePackagePath = new DirectoryPath(cliFolderPathCalculator.ExecutablePackagesPath); - var offlineFeedPath = new DirectoryPath(cliFolderPathCalculator.CliFallbackFolderPath); + var toolConfigurationAndExecutablePath = ObtainPackage(); - var toolConfigurationAndExecutablePath = ObtainPackage(executablePackagePath, offlineFeedPath); - - var shellShimMaker = new ShellShimMaker(executablePackagePath.Value); var commandName = toolConfigurationAndExecutablePath.Configuration.CommandName; - shellShimMaker.EnsureCommandNameUniqueness(commandName); + _shellShimMaker.EnsureCommandNameUniqueness(commandName); - shellShimMaker.CreateShim( + _shellShimMaker.CreateShim( toolConfigurationAndExecutablePath.Executable.Value, commandName); - EnvironmentPathFactory - .CreateEnvironmentPathInstruction() + _environmentPathInstruction .PrintAddPathInstructionIfPathDoesNotExist(); - Reporter.Output.WriteLine( + _reporter.WriteLine( string.Format(LocalizableStrings.InstallationSucceeded, commandName)); return 0; } - private static ToolConfigurationAndExecutablePath ObtainPackage( - DirectoryPath executablePackagePath, - DirectoryPath offlineFeedPath) + private ToolConfigurationAndExecutablePath ObtainPackage() { try { @@ -84,18 +106,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool configFile = new FilePath(_configFilePath); } - var toolPackageObtainer = - new ToolPackageObtainer( - executablePackagePath, - offlineFeedPath, - () => new DirectoryPath(Path.GetTempPath()) - .WithSubDirectories(Path.GetRandomFileName()) - .WithFile(Path.GetRandomFileName() + ".csproj"), - new Lazy(BundledTargetFramework.GetTargetFrameworkMoniker), - new PackageToProjectFileAdder(), - new ProjectRestorer()); - - return toolPackageObtainer.ObtainAndReturnExecutablePath( + return _toolPackageObtainer.ObtainAndReturnExecutablePath( packageId: _packageId, packageVersion: _packageVersion, nugetconfig: configFile, diff --git a/test/Microsoft.DotNet.Cli.Tests.sln b/test/Microsoft.DotNet.Cli.Tests.sln index 863d564db..05bde078d 100644 --- a/test/Microsoft.DotNet.Cli.Tests.sln +++ b/test/Microsoft.DotNet.Cli.Tests.sln @@ -86,6 +86,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.ShellShim. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.ToolPackage.Tests", "Microsoft.DotNet.ToolPackage.Tests\Microsoft.DotNet.ToolPackage.Tests.csproj", "{453C809B-40FC-4A93-93B8-DE449D48B9FF}" 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 Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -564,6 +566,18 @@ Global {453C809B-40FC-4A93-93B8-DE449D48B9FF}.Release|x64.Build.0 = Release|Any CPU {453C809B-40FC-4A93-93B8-DE449D48B9FF}.Release|x86.ActiveCfg = Release|Any CPU {453C809B-40FC-4A93-93B8-DE449D48B9FF}.Release|x86.Build.0 = Release|Any CPU + {A3DE5654-7755-45C8-8AE5-5B5B00BEB248}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A3DE5654-7755-45C8-8AE5-5B5B00BEB248}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A3DE5654-7755-45C8-8AE5-5B5B00BEB248}.Debug|x64.ActiveCfg = Debug|Any CPU + {A3DE5654-7755-45C8-8AE5-5B5B00BEB248}.Debug|x64.Build.0 = Debug|Any CPU + {A3DE5654-7755-45C8-8AE5-5B5B00BEB248}.Debug|x86.ActiveCfg = Debug|Any CPU + {A3DE5654-7755-45C8-8AE5-5B5B00BEB248}.Debug|x86.Build.0 = Debug|Any CPU + {A3DE5654-7755-45C8-8AE5-5B5B00BEB248}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A3DE5654-7755-45C8-8AE5-5B5B00BEB248}.Release|Any CPU.Build.0 = Release|Any CPU + {A3DE5654-7755-45C8-8AE5-5B5B00BEB248}.Release|x64.ActiveCfg = Release|Any CPU + {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 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/test/Microsoft.DotNet.ShellShim.Tests/Microsoft.DotNet.ShellShim.Tests.csproj b/test/Microsoft.DotNet.ShellShim.Tests/Microsoft.DotNet.ShellShim.Tests.csproj index 64fdac72b..6cae0fd85 100644 --- a/test/Microsoft.DotNet.ShellShim.Tests/Microsoft.DotNet.ShellShim.Tests.csproj +++ b/test/Microsoft.DotNet.ShellShim.Tests/Microsoft.DotNet.ShellShim.Tests.csproj @@ -9,6 +9,7 @@ + diff --git a/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs b/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs index 75379aaae..3bf4ff3d0 100644 --- a/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs +++ b/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs @@ -11,6 +11,8 @@ using FluentAssertions; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.TestFramework; using Microsoft.DotNet.Tools.Test.Utilities; +using Microsoft.DotNet.Tools.Test.Utilities.Mock; +using Microsoft.DotNet.Tools.Tests.ComponentMocks; using Xunit; using Xunit.Abstractions; @@ -91,14 +93,23 @@ namespace Microsoft.DotNet.ShellShim.Tests } } - [Fact] - public void GivenAnExecutablePathWithExistingSameNameShimItThrows() + [InlineData(false)] + [InlineData(true)] + public void GivenAnExecutablePathWithExistingSameNameShimItThrows(bool testMockBehaviorIsInSync) { var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); MakeNameConflictingCommand(TempRoot.Root, shellCommandName); - var shellShimMaker = new ShellShimMaker(TempRoot.Root); + IShellShimMaker shellShimMaker; + if (testMockBehaviorIsInSync) + { + shellShimMaker = new ShellShimMakerMock(TempRoot.Root); + } + else + { + shellShimMaker = new ShellShimMaker(TempRoot.Root); + } Action a = () => shellShimMaker.EnsureCommandNameUniqueness(shellCommandName); a.ShouldThrow() @@ -107,13 +118,22 @@ namespace Microsoft.DotNet.ShellShim.Tests $"Failed to install tool {shellCommandName}. A command with the same name already exists."); } - - [Fact] - public void GivenAnExecutablePathWithoutExistingSameNameShimItShouldNotThrow() + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAnExecutablePathWithoutExistingSameNameShimItShouldNotThrow(bool testMockBehaviorIsInSync) { var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); - var shellShimMaker = new ShellShimMaker(TempRoot.Root); + IShellShimMaker shellShimMaker; + if (testMockBehaviorIsInSync) + { + shellShimMaker = new ShellShimMakerMock(TempRoot.Root); + } + else + { + shellShimMaker = new ShellShimMaker(TempRoot.Root); + } Action a = () => shellShimMaker.EnsureCommandNameUniqueness(shellCommandName); a.ShouldNotThrow(); diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/Microsoft.DotNet.ToolPackage.Tests.csproj b/test/Microsoft.DotNet.ToolPackage.Tests/Microsoft.DotNet.ToolPackage.Tests.csproj index 736655e5b..0670e8c91 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/Microsoft.DotNet.ToolPackage.Tests.csproj +++ b/test/Microsoft.DotNet.ToolPackage.Tests/Microsoft.DotNet.ToolPackage.Tests.csproj @@ -13,6 +13,7 @@ + diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs index 4e948966e..8b60baef3 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs +++ b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs @@ -2,48 +2,35 @@ // 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.Reflection; using FluentAssertions; using Microsoft.DotNet.Tools.Test.Utilities; using Microsoft.Extensions.EnvironmentAbstractions; using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Tools; using Microsoft.DotNet.Tools.Install.Tool; using Xunit; +using Microsoft.DotNet.Tools.Tests.ComponentMocks; namespace Microsoft.DotNet.ToolPackage.Tests { public class ToolPackageObtainerTests : TestBase { - [Fact] - public void GivenNugetConfigAndPackageNameAndVersionAndTargetFrameworkWhenCallItCanDownloadThePackage() - { - FilePath nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); - var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); - - var packageObtainer = - ConstructDefaultPackageObtainer(toolsPath); - ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - nugetconfig: nugetConfigPath, - targetframework: _testTargetframework); - - var executable = toolConfigurationAndExecutablePath - .Executable; - - File.Exists(executable.Value) - .Should() - .BeTrue(executable + " should have the executable"); - } - [Fact] public void GivenNoFeedItThrows() { var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); ToolPackageObtainer packageObtainer = - ConstructDefaultPackageObtainer(toolsPath); + new ToolPackageObtainer( + new DirectoryPath(toolsPath), + new DirectoryPath("no such path"), + GetUniqueTempProjectPathEachTest, + new Lazy(), + new PackageToProjectFileAdder(), + new ProjectRestorer()); Action a = () => packageObtainer.ObtainAndReturnExecutablePath( packageId: TestPackageId, @@ -80,24 +67,57 @@ namespace Microsoft.DotNet.ToolPackage.Tests .Should() .BeTrue(executable + " should have the executable"); - executable.Value.Should().NotContain(GetTestLocalFeedPath(), "Executalbe should not be still in fallbackfolder"); - executable.Value.Should().Contain(toolsPath, "Executalbe should be copied to tools Path"); + executable.Value.Should().NotContain(GetTestLocalFeedPath(), "Executable should not be still in fallbackfolder"); + executable.Value.Should().Contain(toolsPath, "Executable should be copied to tools Path"); + + File.Delete(executable.Value); } - [Fact] - public void GivenNugetConfigAndPackageNameAndVersionAndTargetFrameworkWhenCallItCreateAssetFile() + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenNugetConfigAndPackageNameAndVersionAndTargetFrameworkWhenCallItCanDownloadThePackage( + bool testMockBehaviorIsInSync) + { + FilePath nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); + var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); + + var packageObtainer = + ConstructDefaultPackageObtainer(toolsPath, testMockBehaviorIsInSync, nugetConfigPath.Value); + + ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath + = packageObtainer.ObtainAndReturnExecutablePath( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + nugetconfig: nugetConfigPath, + targetframework: _testTargetframework); + + FilePath executable = toolConfigurationAndExecutablePath.Executable; + File.Exists(executable.Value) + .Should() + .BeTrue(executable + " should have the executable"); + + File.Delete(executable.Value); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenNugetConfigAndPackageNameAndVersionAndTargetFrameworkWhenCallItCreateAssetFile( + bool testMockBehaviorIsInSync) { var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); var packageObtainer = - ConstructDefaultPackageObtainer(toolsPath); + ConstructDefaultPackageObtainer(toolsPath, testMockBehaviorIsInSync, nugetConfigPath.Value); - ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - nugetconfig: nugetConfigPath, - targetframework: _testTargetframework); + ToolConfigurationAndExecutablePath toolConfigurationAndExecutableDirectory = + packageObtainer.ObtainAndReturnExecutablePath( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + nugetconfig: nugetConfigPath, + targetframework: _testTargetframework); /* From mytool.dll to project.assets.json @@ -106,7 +126,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests /dependency2 package id/ /project.assets.json */ - var assetJsonPath = toolConfigurationAndExecutablePath + var assetJsonPath = toolConfigurationAndExecutableDirectory .Executable .GetDirectoryPath() .GetParentPath() @@ -119,10 +139,14 @@ namespace Microsoft.DotNet.ToolPackage.Tests File.Exists(assetJsonPath) .Should() .BeTrue(assetJsonPath + " should be created"); + + File.Delete(assetJsonPath); } - [Fact] - public void GivenAllButNoNugetConfigFilePathItCanDownloadThePackage() + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAllButNoNugetConfigFilePathItCanDownloadThePackage(bool testMockBehaviorIsInSync) { var uniqueTempProjectPath = GetUniqueTempProjectPathEachTest(); var tempProjectDirectory = uniqueTempProjectPath.GetDirectoryPath(); @@ -137,14 +161,22 @@ namespace Microsoft.DotNet.ToolPackage.Tests Directory.SetCurrentDirectory(nugetConfigPath.GetDirectoryPath().Value); - var packageObtainer = - new ToolPackageObtainer( + IToolPackageObtainer packageObtainer; + if (testMockBehaviorIsInSync) + { + packageObtainer = new ToolPackageObtainerMock(); + } + else + { + packageObtainer = new ToolPackageObtainer( new DirectoryPath(toolsPath), new DirectoryPath("no such path"), () => uniqueTempProjectPath, new Lazy(), new PackageToProjectFileAdder(), new ProjectRestorer()); + } + ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = packageObtainer.ObtainAndReturnExecutablePath( packageId: TestPackageId, @@ -156,37 +188,46 @@ namespace Microsoft.DotNet.ToolPackage.Tests File.Exists(executable.Value) .Should() .BeTrue(executable + " should have the executable"); + + File.Delete(executable.Value); } - [Fact] - public void GivenAllButNoPackageVersionItCanDownloadThePackage() + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAllButNoPackageVersionItCanDownloadThePackage(bool testMockBehaviorIsInSync) { var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); var packageObtainer = - ConstructDefaultPackageObtainer(toolsPath); - ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - nugetconfig: nugetConfigPath, - targetframework: _testTargetframework); + ConstructDefaultPackageObtainer(toolsPath, testMockBehaviorIsInSync, nugetConfigPath.Value); + + ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = + packageObtainer.ObtainAndReturnExecutablePath( + packageId: TestPackageId, + nugetconfig: nugetConfigPath, + targetframework: _testTargetframework); var executable = toolConfigurationAndExecutablePath.Executable; File.Exists(executable.Value) .Should() .BeTrue(executable + " should have the executable"); + + File.Delete(executable.Value); } - [Fact] - public void GivenAllButNoPackageVersionAndInvokeTwiceItShouldNotThrow() + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAllButNoPackageVersionAndInvokeTwiceItShouldNotThrow(bool testMockBehaviorIsInSync) { var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); var packageObtainer = - ConstructDefaultPackageObtainer(toolsPath); + ConstructDefaultPackageObtainer(toolsPath, testMockBehaviorIsInSync, nugetConfigPath.Value); packageObtainer.ObtainAndReturnExecutablePath( packageId: TestPackageId, @@ -201,21 +242,45 @@ namespace Microsoft.DotNet.ToolPackage.Tests secondCall.ShouldNotThrow(); } - - [Fact] - public void GivenAllButNoTargetFrameworkItCanDownloadThePackage() + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAllButNoTargetFrameworkItCanDownloadThePackage(bool testMockBehaviorIsInSync) { var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); - var packageObtainer = - new ToolPackageObtainer( + IToolPackageObtainer packageObtainer; + if (testMockBehaviorIsInSync) + { + packageObtainer = new ToolPackageObtainerMock(additionalFeeds: + new List + { + new MockFeed + { + Type = MockFeedType.ExplicitNugetConfig, + Uri = nugetConfigPath.Value, + Packages = new List + { + new MockFeedPackage + { + PackageId = "global.tool.console.demo", + Version = "1.0.4" + } + } + } + }); + } + else + { + packageObtainer = new ToolPackageObtainer( new DirectoryPath(toolsPath), new DirectoryPath("no such path"), GetUniqueTempProjectPathEachTest, new Lazy(() => BundledTargetFramework.GetTargetFrameworkMoniker()), new PackageToProjectFileAdder(), new ProjectRestorer()); + } ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = packageObtainer.ObtainAndReturnExecutablePath( packageId: TestPackageId, @@ -227,28 +292,41 @@ namespace Microsoft.DotNet.ToolPackage.Tests File.Exists(executable.Value) .Should() .BeTrue(executable + " should have the executable"); + + File.Delete(executable.Value); } - [Fact] - public void GivenNonExistentNugetConfigFileItThrows() + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenNonExistentNugetConfigFileItThrows(bool testMockBehaviorIsInSync) { var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); var packageObtainer = - ConstructDefaultPackageObtainer(toolsPath); - Action a = () => packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - nugetconfig: new FilePath("NonExistent.file"), - targetframework: _testTargetframework); + ConstructDefaultPackageObtainer(toolsPath, testMockBehaviorIsInSync); + + var nonExistNugetConfigFile = new FilePath("NonExistent.file"); + Action a = () => + { + packageObtainer.ObtainAndReturnExecutablePath( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + nugetconfig: nonExistNugetConfigFile, + targetframework: _testTargetframework); + }; a.ShouldThrow() .And - .Message.Should().Contain("does not exist"); + .Message.Should().Contain(string.Format( + CommonLocalizableStrings.NuGetConfigurationFileDoesNotExist, + Path.GetFullPath(nonExistNugetConfigFile.Value))); } - [Fact] - public void GivenASourceItCanObtainThePackageFromThatSource() + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenASourceItCanObtainThePackageFromThatSource(bool testMockBehaviorIsInSync) { var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); @@ -257,13 +335,15 @@ namespace Microsoft.DotNet.ToolPackage.Tests packageId: TestPackageId, packageVersion: TestPackageVersion, targetframework: _testTargetframework, - source: GetTestLocalFeedPath()); + source:GetTestLocalFeedPath()); var executable = toolConfigurationAndExecutableDirectory.Executable; File.Exists(executable.Value) .Should() .BeTrue(executable + " should have the executable"); + + File.Delete(executable.Value); } private static readonly Func GetUniqueTempProjectPathEachTest = () => @@ -275,8 +355,59 @@ namespace Microsoft.DotNet.ToolPackage.Tests return tempProjectPath; }; - private static ToolPackageObtainer ConstructDefaultPackageObtainer(string toolsPath) + private static IToolPackageObtainer ConstructDefaultPackageObtainer( + string toolsPath, + bool testMockBehaviorIsInSync = false, + string addNugetConfigFeedWithFilePath = null, + string addSourceFeedWithFilePath = null) { + if (testMockBehaviorIsInSync) + { + if (addNugetConfigFeedWithFilePath != null) + { + return new ToolPackageObtainerMock(additionalFeeds: + new List + { + new MockFeed + { + Type = MockFeedType.ExplicitNugetConfig, + Uri = addNugetConfigFeedWithFilePath, + Packages = new List + { + new MockFeedPackage + { + PackageId = "global.tool.console.demo", + Version = "1.0.4" + } + } + } + }); + } + + if (addSourceFeedWithFilePath != null) + { + return new ToolPackageObtainerMock(additionalFeeds: + new List + { + new MockFeed + { + Type = MockFeedType.ExplicitNugetConfig, + Uri = addSourceFeedWithFilePath, + Packages = new List + { + new MockFeedPackage + { + PackageId = "global.tool.console.demo", + Version = "1.0.4" + } + } + } + }); + } + + return new ToolPackageObtainerMock(); + } + return new ToolPackageObtainer( new DirectoryPath(toolsPath), new DirectoryPath("no such path"), @@ -292,7 +423,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests var tempPathForNugetConfigWithWhiteSpace = Path.Combine(Path.GetTempPath(), - Path.GetRandomFileName() + " " + Path.GetRandomFileName()); + Path.GetRandomFileName() + " " + Path.GetRandomFileName()); Directory.CreateDirectory(tempPathForNugetConfigWithWhiteSpace); NuGetConfig.Write( diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/EnvironmentPathInstructionMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/EnvironmentPathInstructionMock.cs new file mode 100644 index 000000000..c07f5ad1b --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/EnvironmentPathInstructionMock.cs @@ -0,0 +1,39 @@ +// 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.Tools.Tests.ComponentMocks +{ + internal class EnvironmentPathInstructionMock : IEnvironmentPathInstruction + { + private readonly string _packageExecutablePath; + private readonly bool _packageExecutablePathExists; + private readonly IReporter _reporter; + + public EnvironmentPathInstructionMock( + IReporter reporter, + string packageExecutablePath, + bool packageExecutablePathExists = false) + { + _packageExecutablePath = + packageExecutablePath ?? throw new ArgumentNullException(nameof(packageExecutablePath)); + _reporter = reporter ?? throw new ArgumentNullException(nameof(reporter)); + _packageExecutablePathExists = packageExecutablePathExists; + } + + public void PrintAddPathInstructionIfPathDoesNotExist() + { + if (!PackageExecutablePathExists()) + { + _reporter.WriteLine("INSTRUCTION"); + } + } + + private bool PackageExecutablePathExists() + { + return _packageExecutablePathExists; + } + } +} diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/Microsoft.DotNet.Tools.Tests.ComponentMocks.csproj b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/Microsoft.DotNet.Tools.Tests.ComponentMocks.csproj new file mode 100644 index 000000000..bd29dccd9 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/Microsoft.DotNet.Tools.Tests.ComponentMocks.csproj @@ -0,0 +1,16 @@ + + + $(CliTargetFramework) + $(MicrosoftNETCoreAppPackageVersion) + Microsoft.DotNet.Tools.Tests.ComponentMocks + ../../tools/Key.snk + $(AssetTargetFallback);dotnet5.4;portable-net451+win8 + true + true + + + + + + + diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/MockFeed.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/MockFeed.cs new file mode 100644 index 000000000..a2199c75e --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/MockFeed.cs @@ -0,0 +1,14 @@ +// 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; + +namespace Microsoft.DotNet.Tools.Tests.ComponentMocks +{ + public class MockFeed + { + public MockFeedType Type; + public string Uri; + public List Packages; + } +} diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/MockFeedPackage.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/MockFeedPackage.cs new file mode 100644 index 000000000..6bf9fc44a --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/MockFeedPackage.cs @@ -0,0 +1,11 @@ +// 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. + +namespace Microsoft.DotNet.Tools.Tests.ComponentMocks +{ + public class MockFeedPackage + { + public string PackageId; + public string Version; + } +} diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/MockFeedType.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/MockFeedType.cs new file mode 100644 index 000000000..c79dc327e --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/MockFeedType.cs @@ -0,0 +1,12 @@ +// 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. + +namespace Microsoft.DotNet.Tools.Tests.ComponentMocks +{ + public enum MockFeedType + { + FeedFromLookUpNugetConfig, + ExplicitNugetConfig, + Source + } +} diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/Properties/Properties.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/Properties/Properties.cs new file mode 100644 index 000000000..b358c68f3 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/Properties/Properties.cs @@ -0,0 +1,8 @@ +// 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.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("dotnet.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("Microsoft.DotNet.ToolPackage.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("Microsoft.DotNet.ShellShim.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimMakerMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimMakerMock.cs new file mode 100644 index 000000000..3e19da8db --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimMakerMock.cs @@ -0,0 +1,58 @@ +// 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 System.IO; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.ShellShim; +using Microsoft.Extensions.EnvironmentAbstractions; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Tools.Tests.ComponentMocks +{ + internal class ShellShimMakerMock : IShellShimMaker + { + private static IFileSystem _fileSystem; + private readonly string _pathToPlaceShim; + + public ShellShimMakerMock(string pathToPlaceShim, IFileSystem fileSystem = null) + { + _pathToPlaceShim = + pathToPlaceShim ?? throw new ArgumentNullException(nameof(pathToPlaceShim)); + + _fileSystem = fileSystem ?? new FileSystemWrapper(); + } + + public void CreateShim(string packageExecutablePath, string shellCommandName) + { + var packageExecutable = new FilePath(packageExecutablePath); + + + var fakeshim = new FakeShim + { + Runner = "dotnet", + ExecutablePath = packageExecutable.Value + }; + var script = JsonConvert.SerializeObject(fakeshim); + + FilePath scriptPath = new FilePath(Path.Combine(_pathToPlaceShim, shellCommandName)); + _fileSystem.File.WriteAllText(scriptPath.Value, script); + } + + public void EnsureCommandNameUniqueness(string shellCommandName) + { + if (_fileSystem.File.Exists(Path.Combine(_pathToPlaceShim, shellCommandName))) + { + throw new GracefulException( + string.Format(CommonLocalizableStrings.FailInstallToolSameName, + shellCommandName)); + } + } + + public class FakeShim + { + public string Runner { get; set; } + public string ExecutablePath { get; set; } + } + } +} diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageObtainerMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageObtainerMock.cs new file mode 100644 index 000000000..efc42f4e8 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageObtainerMock.cs @@ -0,0 +1,159 @@ +// 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 System.Collections.Generic; +using System.IO; +using System.Linq; +using Microsoft.DotNet.ToolPackage; +using Microsoft.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.Tools.Tests.ComponentMocks +{ + internal class ToolPackageObtainerMock : IToolPackageObtainer + { + private readonly Action _beforeRunObtain; + public const string FakeEntrypointName = "SimulatorEntryPoint.dll"; + public const string FakeCommandName = "SimulatorCommand"; + private static IFileSystem _fileSystem; + private string _fakeExecutableDirectory; + private List _mockFeeds; + + public ToolPackageObtainerMock( + IFileSystem fileSystemWrapper = null, + bool useDefaultFeed = true, + IEnumerable additionalFeeds = null, + Action beforeRunObtain = null) + { + _beforeRunObtain = beforeRunObtain ?? (() => { }); + _fileSystem = fileSystemWrapper ?? new FileSystemWrapper(); + _mockFeeds = new List(); + + if (useDefaultFeed) + { + _mockFeeds.Add(new MockFeed + { + Type = MockFeedType.FeedFromLookUpNugetConfig, + Packages = new List + { + new MockFeedPackage + { + PackageId = "global.tool.console.demo", + Version = "1.0.4" + } + } + }); + } + + if (additionalFeeds != null) + { + _mockFeeds.AddRange(additionalFeeds); + } + } + + public ToolConfigurationAndExecutablePath ObtainAndReturnExecutablePath( + string packageId, + string packageVersion = null, + FilePath? nugetconfig = null, + string targetframework = null, + string source = null) + { + _beforeRunObtain(); + + PickFeedByNugetConfig(nugetconfig); + PickFeedBySource(source); + + MockFeedPackage package = _mockFeeds + .SelectMany(f => f.Packages) + .Where(p => MatchPackageVersion(p, packageId, packageVersion)).OrderByDescending(p => p.Version) + .FirstOrDefault(); + + if (package == null) + { + throw new PackageObtainException("simulated cannot find package"); + } + + packageVersion = package.Version; + targetframework = targetframework ?? "targetframework"; + + var packageIdVersionDirectory = Path.Combine("toolPath", packageId, packageVersion); + + _fakeExecutableDirectory = Path.Combine(packageIdVersionDirectory, + packageId, packageVersion, "morefolders", "tools", + targetframework); + var fakeExecutable = Path.Combine(_fakeExecutableDirectory, FakeEntrypointName); + + if (!_fileSystem.Directory.Exists(_fakeExecutableDirectory)) + { + _fileSystem.Directory.CreateDirectory(_fakeExecutableDirectory); + } + + _fileSystem.File.CreateEmptyFile(Path.Combine(packageIdVersionDirectory, "project.assets.json")); + _fileSystem.File.CreateEmptyFile(fakeExecutable); + + return new ToolConfigurationAndExecutablePath( + toolConfiguration: new ToolConfiguration(FakeCommandName, FakeEntrypointName), + executable: new FilePath(fakeExecutable)); + } + + private void PickFeedBySource(string source) + { + if (source != null) + { + var feed = _mockFeeds.SingleOrDefault( + f => f.Type == MockFeedType.Source + && f.Uri == source); + + if (feed != null) + { + _mockFeeds = new List + { + feed + }; + } + else + { + _mockFeeds = new List(); + } + } + } + + private void PickFeedByNugetConfig(FilePath? nugetconfig) + { + if (nugetconfig != null) + { + if (!_fileSystem.File.Exists(nugetconfig.Value.Value)) + { + throw new PackageObtainException( + string.Format(CommonLocalizableStrings.NuGetConfigurationFileDoesNotExist, + Path.GetFullPath(nugetconfig.Value.Value))); + } + + var feed = _mockFeeds.SingleOrDefault( + f => f.Type == MockFeedType.ExplicitNugetConfig + && f.Uri == nugetconfig.Value.Value); + + if (feed != null) + { + _mockFeeds = new List + { + feed + }; + } + else + { + _mockFeeds = new List(); + } + } + } + + private static bool MatchPackageVersion(MockFeedPackage p, string packageId, string packageVersion) + { + if (packageVersion == null) + { + return p.PackageId == packageId; + } + return p.PackageId == packageId && p.Version == packageVersion; + } + } +} diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Properties/Properties.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Properties/Properties.cs index 98bfc776e..be0d4944b 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Properties/Properties.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Properties/Properties.cs @@ -3,5 +3,8 @@ using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("Microsoft.Extensions.DependencyModel.Tests , PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.DotNet.Configurer.UnitTests , PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("Microsoft.Extensions.DependencyModel.Tests , PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("Microsoft.DotNet.Configurer.UnitTests , PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("dotnet.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("Microsoft.DotNet.ToolPackage.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("Microsoft.DotNet.ShellShim.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] diff --git a/test/dotnet.Tests/InstallToolCommandTests/InstallToolCommandTests.cs b/test/dotnet.Tests/InstallToolCommandTests/InstallToolCommandTests.cs new file mode 100644 index 000000000..118db746b --- /dev/null +++ b/test/dotnet.Tests/InstallToolCommandTests/InstallToolCommandTests.cs @@ -0,0 +1,211 @@ +// 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 System.Collections.Generic; +using System.IO; +using System.Linq; +using FluentAssertions; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.CommandLine; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.ToolPackage; +using Microsoft.DotNet.Tools.Install.Tool; +using Microsoft.DotNet.Tools.Tests.ComponentMocks; +using Microsoft.Extensions.DependencyModel.Tests; +using Microsoft.Extensions.EnvironmentAbstractions; +using Newtonsoft.Json; +using Xunit; +using Parser = Microsoft.DotNet.Cli.Parser; +using LocalizableStrings = Microsoft.DotNet.Tools.Install.Tool.LocalizableStrings; + +namespace Microsoft.DotNet.Tests.InstallToolCommandTests +{ + public class InstallToolCommandTests + { + private readonly IFileSystem _fileSystemWrapper; + private readonly ToolPackageObtainerMock _toolPackageObtainerMock; + private readonly ShellShimMakerMock _shellShimMakerMock; + private readonly EnvironmentPathInstructionMock _environmentPathInstructionMock; + private readonly AppliedOption _appliedCommand; + private readonly ParseResult _parseResult; + private readonly FakeReporter _fakeReporter; + private const string PathToPlaceShim = "pathToPlace"; + + public InstallToolCommandTests() + { + _fileSystemWrapper = new FileSystemMockBuilder().Build(); + _toolPackageObtainerMock = new ToolPackageObtainerMock(_fileSystemWrapper); + _shellShimMakerMock = new ShellShimMakerMock(PathToPlaceShim, _fileSystemWrapper); + _fakeReporter = new FakeReporter(); + _environmentPathInstructionMock = + new EnvironmentPathInstructionMock(_fakeReporter, PathToPlaceShim); + + ParseResult result = Parser.Instance.Parse("dotnet install tool -g global.tool.console.demo"); + _appliedCommand = result["dotnet"]["install"]["tool"]; + var parser = Parser.Instance; + _parseResult = parser.ParseFrom("dotnet install", new[] {"tool", "global.tool.console.demo"}); + } + + [Fact] + public void WhenRunWithPackageIdItShouldCreateValidShim() + { + var installToolCommand = new InstallToolCommand(_appliedCommand, + _parseResult, + _toolPackageObtainerMock, + _shellShimMakerMock, + _environmentPathInstructionMock); + + installToolCommand.Execute(); + + // It is hard to simulate shell behavior. Only Assert shim can point to executable dll + _fileSystemWrapper.File.Exists(Path.Combine("pathToPlace", ToolPackageObtainerMock.FakeCommandName)) + .Should().BeTrue(); + var deserializedFakeShim = JsonConvert.DeserializeObject( + _fileSystemWrapper.File.ReadAllText( + Path.Combine("pathToPlace", + ToolPackageObtainerMock.FakeCommandName))); + _fileSystemWrapper.File.Exists(deserializedFakeShim.ExecutablePath).Should().BeTrue(); + } + + [Fact] + public void WhenRunWithPackageIdWithSourceItShouldCreateValidShim() + { + const string sourcePath = "http://mysouce.com"; + ParseResult result = Parser.Instance.Parse($"dotnet install tool -g global.tool.console.demo --source {sourcePath}"); + AppliedOption appliedCommand = result["dotnet"]["install"]["tool"]; + const string packageId = "global.tool.console.demo"; + ParseResult parseResult = + Parser.Instance.ParseFrom("dotnet install", new[] {"tool", packageId, "--source", sourcePath}); + + var installToolCommand = new InstallToolCommand(appliedCommand, + parseResult, + new ToolPackageObtainerMock(_fileSystemWrapper, additionalFeeds: new List + { + new MockFeed + { + Type = MockFeedType.Source, + Uri = sourcePath, + Packages = new List + { + new MockFeedPackage + { + PackageId = packageId, + Version = "1.0.4" + } + } + } + }), + _shellShimMakerMock, + _environmentPathInstructionMock); + + installToolCommand.Execute(); + + // It is hard to simulate shell behavior. Only Assert shim can point to executable dll + _fileSystemWrapper.File.Exists(Path.Combine("pathToPlace", ToolPackageObtainerMock.FakeCommandName)) + .Should().BeTrue(); + ShellShimMakerMock.FakeShim deserializedFakeShim = + JsonConvert.DeserializeObject( + _fileSystemWrapper.File.ReadAllText( + Path.Combine("pathToPlace", + ToolPackageObtainerMock.FakeCommandName))); + _fileSystemWrapper.File.Exists(deserializedFakeShim.ExecutablePath).Should().BeTrue(); + } + + [Fact] + public void WhenRunWithPackageIdItShouldShowPathInstruction() + { + var installToolCommand = new InstallToolCommand(_appliedCommand, + _parseResult, + _toolPackageObtainerMock, + _shellShimMakerMock, + _environmentPathInstructionMock); + + installToolCommand.Execute(); + + _fakeReporter.Message.Single().Should().NotBeEmpty(); + } + + [Fact] + public void GivenFailedPackageObtainWhenRunWithPackageIdItShouldThrow() + { + var toolPackageObtainerSimulatorThatThrows + = new ToolPackageObtainerMock( + _fileSystemWrapper, true, null, + () => throw new PackageObtainException("Simulated error")); + var installToolCommand = new InstallToolCommand( + _appliedCommand, + _parseResult, + toolPackageObtainerSimulatorThatThrows, + _shellShimMakerMock, + _environmentPathInstructionMock, + _fakeReporter); + + Action a = () => installToolCommand.Execute(); + + a.ShouldThrow() + .And.Message.Should() + .Contain(string.Format(LocalizableStrings.InstallFailedNuget, "Simulated error")); + } + + [Fact] + public void GivenInCorrectToolConfigurationWhenRunWithPackageIdItShouldThrow() + { + var toolPackageObtainerSimulatorThatThrows + = new ToolPackageObtainerMock( + _fileSystemWrapper, true, null, + () => throw new ToolConfigurationException("Simulated error")); + var installToolCommand = new InstallToolCommand( + _appliedCommand, + _parseResult, + toolPackageObtainerSimulatorThatThrows, + _shellShimMakerMock, + _environmentPathInstructionMock, + _fakeReporter); + + Action a = () => installToolCommand.Execute(); + a.ShouldThrow() + .And.Message.Should() + .Contain(string.Format(LocalizableStrings.InstallFailedPackage, "Simulated error")); + } + + [Fact] + public void WhenRunWithPackageIdItShouldShowSuccessMessage() + { + var installToolCommand = new InstallToolCommand( + _appliedCommand, + _parseResult, + _toolPackageObtainerMock, + _shellShimMakerMock, + new EnvironmentPathInstructionMock(_fakeReporter, PathToPlaceShim, true), + _fakeReporter); + + installToolCommand.Execute(); + + _fakeReporter + .Message + .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/dotnet.Tests.csproj b/test/dotnet.Tests/dotnet.Tests.csproj index 6095d1a0e..561d03b72 100644 --- a/test/dotnet.Tests/dotnet.Tests.csproj +++ b/test/dotnet.Tests/dotnet.Tests.csproj @@ -71,6 +71,7 @@ + From 9e535a867a40011d34a0e6d3383bc4f15ca80cd1 Mon Sep 17 00:00:00 2001 From: William Lee Date: Wed, 24 Jan 2018 17:55:26 -0800 Subject: [PATCH 012/103] Remove PackageToProjectFileAdder (#8468) Add reference to project with version * is doing the same thing --- .../ToolPackage/IPackageToProjectFileAdder.cs | 12 ----- src/dotnet/ToolPackage/ToolPackageObtainer.cs | 44 +++-------------- .../dotnet-install-tool/InstallToolCommand.cs | 1 - .../PackageToProjectFileAdder.cs | 47 ------------------- .../ToolPackageObtainerTests.cs | 5 -- 5 files changed, 6 insertions(+), 103 deletions(-) delete mode 100644 src/dotnet/ToolPackage/IPackageToProjectFileAdder.cs delete mode 100644 src/dotnet/commands/dotnet-install/dotnet-install-tool/PackageToProjectFileAdder.cs diff --git a/src/dotnet/ToolPackage/IPackageToProjectFileAdder.cs b/src/dotnet/ToolPackage/IPackageToProjectFileAdder.cs deleted file mode 100644 index cdde79c06..000000000 --- a/src/dotnet/ToolPackage/IPackageToProjectFileAdder.cs +++ /dev/null @@ -1,12 +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 Microsoft.Extensions.EnvironmentAbstractions; - -namespace Microsoft.DotNet.ToolPackage -{ - internal interface IPackageToProjectFileAdder - { - void Add(FilePath projectPath, string packageId); - } -} diff --git a/src/dotnet/ToolPackage/ToolPackageObtainer.cs b/src/dotnet/ToolPackage/ToolPackageObtainer.cs index 3ef3597b0..3066c7e00 100644 --- a/src/dotnet/ToolPackage/ToolPackageObtainer.cs +++ b/src/dotnet/ToolPackage/ToolPackageObtainer.cs @@ -14,7 +14,6 @@ namespace Microsoft.DotNet.ToolPackage { private readonly Lazy _bundledTargetFrameworkMoniker; private readonly Func _getTempProjectPath; - private readonly IPackageToProjectFileAdder _packageToProjectFileAdder; private readonly IProjectRestorer _projectRestorer; private readonly DirectoryPath _toolsPath; private readonly DirectoryPath _offlineFeedPath; @@ -24,15 +23,12 @@ namespace Microsoft.DotNet.ToolPackage DirectoryPath offlineFeedPath, Func getTempProjectPath, Lazy bundledTargetFrameworkMoniker, - IPackageToProjectFileAdder packageToProjectFileAdder, IProjectRestorer projectRestorer ) { _getTempProjectPath = getTempProjectPath; _bundledTargetFrameworkMoniker = bundledTargetFrameworkMoniker; _projectRestorer = projectRestorer ?? throw new ArgumentNullException(nameof(projectRestorer)); - _packageToProjectFileAdder = packageToProjectFileAdder ?? - throw new ArgumentNullException(nameof(packageToProjectFileAdder)); _toolsPath = toolsPath; _offlineFeedPath = offlineFeedPath; } @@ -75,14 +71,6 @@ namespace Microsoft.DotNet.ToolPackage targetframework, toolDirectory); - if (packageVersionOrPlaceHolder.IsPlaceholder) - { - InvokeAddPackageRestore( - nugetconfig, - tempProjectPath, - packageId); - } - _projectRestorer.Restore(tempProjectPath, toolDirectory, nugetconfig, source); if (packageVersionOrPlaceHolder.IsPlaceholder) @@ -187,15 +175,13 @@ namespace Microsoft.DotNet.ToolPackage Directory.Exists(_offlineFeedPath.Value) ? _offlineFeedPath.Value : string.Empty), new XElement("RestoreAdditionalProjectFallbackFolders", string.Empty), // block other new XElement("RestoreAdditionalProjectFallbackFoldersExcludes", string.Empty), // block other - new XElement("DisableImplicitNuGetFallbackFolder","true") // disable SDK side implicit NuGetFallbackFolder - ), - packageVersion.IsConcreteValue - ? new XElement("ItemGroup", - new XElement("PackageReference", - new XAttribute("Include", packageId), - new XAttribute("Version", packageVersion.Value) + new XElement("DisableImplicitNuGetFallbackFolder", "true")), // disable SDK side implicit NuGetFallbackFolder + new XElement("ItemGroup", + new XElement("PackageReference", + new XAttribute("Include", packageId), + new XAttribute("Version", packageVersion.IsConcreteValue ? packageVersion.Value : "*") // nuget will restore * for latest )) - : null)); + )); File.WriteAllText(tempProjectPath.Value, tempProjectContent.ToString()); @@ -203,24 +189,6 @@ namespace Microsoft.DotNet.ToolPackage return tempProjectPath; } - private void InvokeAddPackageRestore( - FilePath? nugetconfig, - FilePath tempProjectPath, - string packageId) - { - if (nugetconfig != null) - { - File.Copy( - nugetconfig.Value.Value, - tempProjectPath - .GetDirectoryPath() - .WithFile("nuget.config") - .Value); - } - - _packageToProjectFileAdder.Add(tempProjectPath, packageId); - } - private DirectoryPath CreateIndividualToolVersionDirectory( string packageId, PackageVersion packageVersion) 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 783666939..9138239e4 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs @@ -59,7 +59,6 @@ namespace Microsoft.DotNet.Tools.Install.Tool .WithSubDirectories(Path.GetRandomFileName()) .WithFile(Path.GetRandomFileName() + ".csproj"), new Lazy(BundledTargetFramework.GetTargetFrameworkMoniker), - new PackageToProjectFileAdder(), new ProjectRestorer()); _environmentPathInstruction = environmentPathInstruction diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/PackageToProjectFileAdder.cs b/src/dotnet/commands/dotnet-install/dotnet-install-tool/PackageToProjectFileAdder.cs deleted file mode 100644 index d66061a81..000000000 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/PackageToProjectFileAdder.cs +++ /dev/null @@ -1,47 +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 System.Collections.Generic; -using Microsoft.DotNet.Cli; -using Microsoft.DotNet.ToolPackage; -using Microsoft.DotNet.Tools; -using Microsoft.Extensions.EnvironmentAbstractions; - -namespace Microsoft.DotNet.Tools.Install.Tool -{ - internal class PackageToProjectFileAdder : IPackageToProjectFileAdder - { - public void Add(FilePath projectPath, string packageId) - { - if (packageId == null) - { - throw new ArgumentNullException(nameof(packageId)); - } - - var argsToPassToRestore = new List - { - projectPath.Value, - "package", - packageId, - "--no-restore" - }; - - var command = new DotNetCommandFactory(alwaysRunOutOfProc: true) - .Create( - "add", - argsToPassToRestore) - .CaptureStdOut() - .CaptureStdErr(); - - var result = command.Execute(); - if (result.ExitCode != 0) - { - throw new PackageObtainException( - string.Format( - LocalizableStrings.FailedToAddPackage, - result.StartInfo.WorkingDirectory, result.StartInfo.Arguments, result.StdErr, result.StdOut)); - } - } - } -} diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs index 8b60baef3..08a8d14c9 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs +++ b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs @@ -29,7 +29,6 @@ namespace Microsoft.DotNet.ToolPackage.Tests new DirectoryPath("no such path"), GetUniqueTempProjectPathEachTest, new Lazy(), - new PackageToProjectFileAdder(), new ProjectRestorer()); Action a = () => packageObtainer.ObtainAndReturnExecutablePath( @@ -51,7 +50,6 @@ namespace Microsoft.DotNet.ToolPackage.Tests offlineFeedPath: new DirectoryPath(GetTestLocalFeedPath()), getTempProjectPath: GetUniqueTempProjectPathEachTest, bundledTargetFrameworkMoniker: new Lazy(), - packageToProjectFileAdder: new PackageToProjectFileAdder(), projectRestorer: new ProjectRestorer()); ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = @@ -173,7 +171,6 @@ namespace Microsoft.DotNet.ToolPackage.Tests new DirectoryPath("no such path"), () => uniqueTempProjectPath, new Lazy(), - new PackageToProjectFileAdder(), new ProjectRestorer()); } @@ -278,7 +275,6 @@ namespace Microsoft.DotNet.ToolPackage.Tests new DirectoryPath("no such path"), GetUniqueTempProjectPathEachTest, new Lazy(() => BundledTargetFramework.GetTargetFrameworkMoniker()), - new PackageToProjectFileAdder(), new ProjectRestorer()); } ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = @@ -413,7 +409,6 @@ namespace Microsoft.DotNet.ToolPackage.Tests new DirectoryPath("no such path"), GetUniqueTempProjectPathEachTest, new Lazy(), - new PackageToProjectFileAdder(), new ProjectRestorer()); } From 78904831f9e23774c3ee2a29646ab09b46e6a50f Mon Sep 17 00:00:00 2001 From: William Lee Date: Thu, 25 Jan 2018 20:17:33 -0800 Subject: [PATCH 013/103] Fix test folder cannot delete and missing test (#8480) --- test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs b/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs index 3bf4ff3d0..804288f3e 100644 --- a/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs +++ b/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs @@ -93,6 +93,7 @@ namespace Microsoft.DotNet.ShellShim.Tests } } + [Theory] [InlineData(false)] [InlineData(true)] public void GivenAnExecutablePathWithExistingSameNameShimItThrows(bool testMockBehaviorIsInSync) @@ -184,7 +185,7 @@ namespace Microsoft.DotNet.ShellShim.Tests const string testAppName = "TestAppSimple"; const string emptySpaceToTestSpaceInPath = " "; TestAssetInstance testInstance = TestAssets.Get(testAppName) - .CreateInstance(testAppName + emptySpaceToTestSpaceInPath) + .CreateInstance(testAppName + emptySpaceToTestSpaceInPath + "test") .UseCurrentRuntimeFrameworkVersion() .WithRestoreFiles() .WithBuildFiles(); From 3e35517ce89c77b5e3a9bf9ac22c4490f665f0e7 Mon Sep 17 00:00:00 2001 From: John Beisner Date: Mon, 29 Jan 2018 11:48:26 -0800 Subject: [PATCH 014/103] Repairing the first pass call to 'dotnet msbuild'; CLI:master (#8488) * '$ExtraParametersNoTargets', which is used on the first pass call to 'dotnet msbuild', currently is of type 'string' not 'List'1' as is '$ExtraParameters'. This results in the non-honoring of any parameter other than parameter one. Solution: Make a copy of '$ExtraParameters' to '$ExtraParametersNoTargets' of type 'List'1' and remove the targets from the list. * Swallow the boolean output from '$ExtraParametersNoTargets.Remove' * Specifically capture "/t:" or "/target:" only. --- run-build.ps1 | 11 +++++++---- run-build.sh | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/run-build.ps1 b/run-build.ps1 index 254da25d2..c92b91b6d 100644 --- a/run-build.ps1 +++ b/run-build.ps1 @@ -29,12 +29,15 @@ if($Help) # The first 'pass' call to "dotnet msbuild build.proj" has a hard-coded "WriteDynamicPropsToStaticPropsFiles" target # therefore, this call should not have other targets defined. Remove all targets passed in as 'extra parameters'. -$ExtraParametersNoTargets = "" -foreach ($param in $ExtraParameters.split()) +if ($ExtraParameters) { - if((-not $param.StartsWith("/t")) -and (-not $param.StartsWith("/T"))) + $ExtraParametersNoTargets = $ExtraParameters.GetRange(0,$ExtraParameters.Count) + foreach ($param in $ExtraParameters) { - $ExtraParametersNoTargets += "{0} " -f $param + if(($param.StartsWith("/t:", [StringComparison]::OrdinalIgnoreCase)) -or ($param.StartsWith("/target:", [StringComparison]::OrdinalIgnoreCase))) + { + $ExtraParametersNoTargets.Remove("$param") | Out-Null + } } } diff --git a/run-build.sh b/run-build.sh index cce2ed49f..45b49428a 100755 --- a/run-build.sh +++ b/run-build.sh @@ -130,8 +130,8 @@ done argsnotargets=( ) for arg in ${args[@]} do - if [[ $arg != '/t'* ]] && [[ $arg != '/T'* ]]; then - argsnotargets+=($arg) + if [[ ${arg,,} != '/t:'* ]] && [[ ${arg,,} != '/target:'* ]]; then + argsnotargets+=($arg) fi done From 71f22a9f374740fc25e273381cc6328acb283c4b Mon Sep 17 00:00:00 2001 From: John Beisner Date: Mon, 29 Jan 2018 13:26:45 -0800 Subject: [PATCH 015/103] The "${arg,,}" syntax works well on dev and Jenkins OSX machines but does not work correctly on VSO build machines [likely a lower version of bash on VSO machines]. Therefore, using 'awk' to transforming to lower case. (#8497) --- run-build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/run-build.sh b/run-build.sh index 45b49428a..7d383f86f 100755 --- a/run-build.sh +++ b/run-build.sh @@ -130,7 +130,8 @@ done argsnotargets=( ) for arg in ${args[@]} do - if [[ ${arg,,} != '/t:'* ]] && [[ ${arg,,} != '/target:'* ]]; then + arglower="$(echo $arg | awk '{print tolower($0)}')" + if [[ $arglower != '/t:'* ]] && [[ $arglower != '/target:'* ]]; then argsnotargets+=($arg) fi done From 7bee59fe14f1ae5f6e3d8a733d684c76ef7e01b7 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Mon, 29 Jan 2018 21:20:07 -0800 Subject: [PATCH 016/103] Fixing update dependency by using the new APIs. We broke this when we updated the version of VersionTools. --- build/DependencyVersions.props | 2 +- build_projects/update-dependencies/Program.cs | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 22bc3d9cf..5bc4fadee 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -66,7 +66,7 @@ - 2.1.0-prerelease-02411-04 + 2.1.0-prerelease-02430-04 2.0.0-preview2-25331-01 2.1.0-prerelease-02411-04 diff --git a/build_projects/update-dependencies/Program.cs b/build_projects/update-dependencies/Program.cs index 27926a77c..ae39b89aa 100644 --- a/build_projects/update-dependencies/Program.cs +++ b/build_projects/update-dependencies/Program.cs @@ -4,6 +4,7 @@ using Microsoft.DotNet.VersionTools; using Microsoft.DotNet.VersionTools.Automation; using Microsoft.DotNet.VersionTools.Dependencies; +using Microsoft.DotNet.VersionTools.Dependencies.BuildOutput; using System; using System.Collections.Generic; using System.Diagnostics; @@ -29,7 +30,7 @@ namespace Microsoft.DotNet.Scripts IEnumerable updaters = GetUpdaters(); var dependencyBuildInfos = buildInfos.Select(buildInfo => - new DependencyBuildInfo( + new BuildDependencyInfo( buildInfo, upgradeStableVersions: true, disabledPackages: Enumerable.Empty())); @@ -50,11 +51,14 @@ namespace Microsoft.DotNet.Scripts body += PullRequestCreator.NotificationString(s_config.GitHubPullRequestNotifications); } - new PullRequestCreator(gitHubAuth, origin, upstreamBranch) + new PullRequestCreator(gitHubAuth) .CreateOrUpdateAsync( suggestedMessage, suggestedMessage + $" ({upstreamBranch.Name})", - body) + body, + upstreamBranch, + origin, + new PullRequestOptions()) .Wait(); } } From 0228229c1c0a45e22f03315129297d5b357285d3 Mon Sep 17 00:00:00 2001 From: dotnet-bot Date: Tue, 30 Jan 2018 22:49:53 +0000 Subject: [PATCH 017/103] Update CoreSetup, CoreSetup, CoreSetup to preview2-26130-06, preview2-26130-06, preview2-26130-06, respectively --- build/DependencyVersions.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 5bc4fadee..b3770e03f 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -2,7 +2,7 @@ 2.1.0-preview1-28124 - 2.1.0-preview1-26116-04 + 2.1.0-preview2-26130-06 $(MicrosoftNETCoreAppPackageVersion) 15.6.0-preview-000054-1286830 $(MicrosoftBuildPackageVersion) @@ -27,8 +27,8 @@ $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) - 2.1.0-preview1-26116-04 - 2.1.0-preview1-26116-04 + 2.1.0-preview2-26130-06 + 2.1.0-preview2-26130-06 0.1.1-alpha-174 1.2.1-alpha-002133 $(MicrosoftDotNetProjectJsonMigrationPackageVersion) From 8649a5c6c279e196ef3ed999787e909291ea6887 Mon Sep 17 00:00:00 2001 From: John Beisner Date: Tue, 30 Jan 2018 15:22:32 -0800 Subject: [PATCH 018/103] Orchestrated final publish; CLI:master (#8504) * Orchestrated final publish: https://github.com/dotnet/core-eng/issues/2407 * Changes per code review... --- build/AzureInfo.props | 5 +++-- build/DependencyVersions.props | 2 +- build/Publish.targets | 1 + build/publish/PublishContent.targets | 2 ++ build/publish/PublishNupkgToBlobFeed.targets | 1 + 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/build/AzureInfo.props b/build/AzureInfo.props index c5dc4a579..6e1739c62 100644 --- a/build/AzureInfo.props +++ b/build/AzureInfo.props @@ -1,9 +1,10 @@ + Sdk true false - Sdk - assets/$(BlobStoragePartialRelativePath) + $(Product) + assets/$(Product) https://dotnetcli.azureedge.net/dotnet/ diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 5bc4fadee..3aa2d1520 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -68,7 +68,7 @@ 2.1.0-prerelease-02430-04 2.0.0-preview2-25331-01 - 2.1.0-prerelease-02411-04 + 2.1.0-prerelease-02430-04 diff --git a/build/Publish.targets b/build/Publish.targets index a98d7171f..d64388410 100644 --- a/build/Publish.targets +++ b/build/Publish.targets @@ -84,6 +84,7 @@ ManifestBuildId="$(FullNugetVersion)" ManifestCommit="$(CommitHash)" ManifestName="$(BuildName)" + ManifestBuildData="ProductVersion=$(FullNugetVersion)" Overwrite="false" PublishFlatContainer="true" SkipCreateManifest="$(IsNotOrchestratedPublish)" /> diff --git a/build/publish/PublishContent.targets b/build/publish/PublishContent.targets index d18d57238..41b7886a8 100644 --- a/build/publish/PublishContent.targets +++ b/build/publish/PublishContent.targets @@ -33,6 +33,7 @@ ManifestBuildId="$(FullNugetVersion)" ManifestCommit="$(CommitHash)" ManifestName="$(BuildName)" + ManifestBuildData="ProductVersion=$(FullNugetVersion)" Overwrite="$(OverwriteOnPublish)" PublishFlatContainer="true" SkipCreateManifest="$(IsNotOrchestratedPublish)" /> @@ -51,6 +52,7 @@ ManifestBuildId="$(FullNugetVersion)" ManifestCommit="$(CommitHash)" ManifestName="$(BuildName)" + ManifestBuildData="ProductVersion=$(FullNugetVersion)" Overwrite="$(OverwriteOnPublish)" PublishFlatContainer="true" SkipCreateManifest="$(IsNotOrchestratedPublish)" /> diff --git a/build/publish/PublishNupkgToBlobFeed.targets b/build/publish/PublishNupkgToBlobFeed.targets index a214c3b52..23fddc46d 100644 --- a/build/publish/PublishNupkgToBlobFeed.targets +++ b/build/publish/PublishNupkgToBlobFeed.targets @@ -17,6 +17,7 @@ ManifestBuildId="$(FullNugetVersion)" ManifestCommit="$(CommitHash)" ManifestName="$(BuildName)" + ManifestBuildData="ProductVersion=$(FullNugetVersion)" Overwrite="true" PublishFlatContainer="false" SkipCreateManifest="$(IsNotOrchestratedPublish)" /> From 55eb8bb7fc0b9f174a3e17b8cfa20f30606e9d0a Mon Sep 17 00:00:00 2001 From: William Lee Date: Tue, 30 Jan 2018 15:41:39 -0800 Subject: [PATCH 019/103] replace string with FilePath (#8494) --- src/dotnet/ShellShim/IShellShimMaker.cs | 6 ++++-- src/dotnet/ShellShim/ShellShimMaker.cs | 10 ++++------ .../dotnet-install-tool/InstallToolCommand.cs | 2 +- .../Microsoft.DotNet.Cli.Msi.Tests.csproj | 4 ++++ .../ShellShimMakerTests.cs | 10 ++++++---- .../ShellShimMakerMock.cs | 5 +---- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/dotnet/ShellShim/IShellShimMaker.cs b/src/dotnet/ShellShim/IShellShimMaker.cs index 35ff02493..443285ddd 100644 --- a/src/dotnet/ShellShim/IShellShimMaker.cs +++ b/src/dotnet/ShellShim/IShellShimMaker.cs @@ -1,8 +1,10 @@ -namespace Microsoft.DotNet.ShellShim +using Microsoft.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.ShellShim { public interface IShellShimMaker { - void CreateShim(string packageExecutablePath, string shellCommandName); + void CreateShim(FilePath packageExecutable, string shellCommandName); void EnsureCommandNameUniqueness(string shellCommandName); } } diff --git a/src/dotnet/ShellShim/ShellShimMaker.cs b/src/dotnet/ShellShim/ShellShimMaker.cs index f3247c620..6121cfd2a 100644 --- a/src/dotnet/ShellShim/ShellShimMaker.cs +++ b/src/dotnet/ShellShim/ShellShimMaker.cs @@ -26,13 +26,13 @@ namespace Microsoft.DotNet.ShellShim pathToPlaceShim ?? throw new ArgumentNullException(nameof(pathToPlaceShim)); } - public void CreateShim(string packageExecutablePath, string shellCommandName) + public void CreateShim(FilePath packageExecutable, string shellCommandName) { FilePath shimPath = GetShimPath(shellCommandName); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - CreateConfigFile(shimPath.Value + ".config", entryPoint: packageExecutablePath, runner: "dotnet"); + CreateConfigFile(shimPath.Value + ".config", entryPoint: packageExecutable, runner: "dotnet"); using (var shim = File.Create(shimPath.Value)) using (var exe = typeof(ShellShimMaker).Assembly.GetManifestResourceStream(LauncherExeResourceName)) { @@ -41,8 +41,6 @@ namespace Microsoft.DotNet.ShellShim } else { - var packageExecutable = new FilePath(packageExecutablePath); - var script = new StringBuilder(); script.AppendLine("#!/bin/sh"); script.AppendLine($"dotnet {packageExecutable.ToQuotedString()} \"$@\""); @@ -63,7 +61,7 @@ namespace Microsoft.DotNet.ShellShim } } - internal void CreateConfigFile(string outputPath, string entryPoint, string runner) + internal void CreateConfigFile(string outputPath, FilePath entryPoint, string runner) { XDocument config; using (var resource = typeof(ShellShimMaker).Assembly.GetManifestResourceStream(LauncherConfigResourceName)) @@ -72,7 +70,7 @@ namespace Microsoft.DotNet.ShellShim } var appSettings = config.Descendants("appSettings").First(); - appSettings.Add(new XElement("add", new XAttribute("key", "entryPoint"), new XAttribute("value", entryPoint))); + appSettings.Add(new XElement("add", new XAttribute("key", "entryPoint"), new XAttribute("value", entryPoint.Value))); appSettings.Add(new XElement("add", new XAttribute("key", "runner"), new XAttribute("value", runner ?? string.Empty))); config.Save(outputPath); } 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 9138239e4..f3041a12a 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs @@ -83,7 +83,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool _shellShimMaker.EnsureCommandNameUniqueness(commandName); _shellShimMaker.CreateShim( - toolConfigurationAndExecutablePath.Executable.Value, + toolConfigurationAndExecutablePath.Executable, commandName); _environmentPathInstruction diff --git a/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/Microsoft.DotNet.Cli.Msi.Tests.csproj b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/Microsoft.DotNet.Cli.Msi.Tests.csproj index 17220aaf1..28ccae43e 100644 --- a/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/Microsoft.DotNet.Cli.Msi.Tests.csproj +++ b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/Microsoft.DotNet.Cli.Msi.Tests.csproj @@ -25,4 +25,8 @@ + + + + diff --git a/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs b/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs index 804288f3e..956523926 100644 --- a/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs +++ b/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs @@ -13,6 +13,7 @@ using Microsoft.DotNet.TestFramework; using Microsoft.DotNet.Tools.Test.Utilities; using Microsoft.DotNet.Tools.Test.Utilities.Mock; using Microsoft.DotNet.Tools.Tests.ComponentMocks; +using Microsoft.Extensions.EnvironmentAbstractions; using Xunit; using Xunit.Abstractions; @@ -31,8 +32,9 @@ namespace Microsoft.DotNet.ShellShim.Tests [InlineData("my_native_app.exe", null)] [InlineData("./my_native_app.js", "nodejs")] [InlineData(@"C:\tools\my_native_app.dll", "dotnet")] - public void GivenAnRunnerOrEntryPointItCanCreateConfig(string entryPoint, string runner) + public void GivenAnRunnerOrEntryPointItCanCreateConfig(string entryPointPath, string runner) { + var entryPoint = new FilePath(entryPointPath); if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) return; @@ -51,7 +53,7 @@ namespace Microsoft.DotNet.ShellShim.Tests .Should() .Contain(e => e.Attribute("key").Value == "runner" && e.Attribute("value").Value == (runner ?? string.Empty)) .And - .Contain(e => e.Attribute("key").Value == "entryPoint" && e.Attribute("value").Value == entryPoint); + .Contain(e => e.Attribute("key").Value == "entryPoint" && e.Attribute("value").Value == entryPoint.Value); } [Fact] @@ -63,7 +65,7 @@ namespace Microsoft.DotNet.ShellShim.Tests var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); shellShimMaker.CreateShim( - outputDll.FullName, + new FilePath(outputDll.FullName), shellCommandName); var stdOut = ExecuteInShell(shellCommandName); @@ -82,7 +84,7 @@ namespace Microsoft.DotNet.ShellShim.Tests var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); shellShimMaker.CreateShim( - outputDll.FullName, + new FilePath(outputDll.FullName), shellCommandName); var stdOut = ExecuteInShell(shellCommandName, arguments); diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimMakerMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimMakerMock.cs index 3e19da8db..50d123d09 100644 --- a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimMakerMock.cs +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimMakerMock.cs @@ -23,11 +23,8 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks _fileSystem = fileSystem ?? new FileSystemWrapper(); } - public void CreateShim(string packageExecutablePath, string shellCommandName) + public void CreateShim(FilePath packageExecutable, string shellCommandName) { - var packageExecutable = new FilePath(packageExecutablePath); - - var fakeshim = new FakeShim { Runner = "dotnet", From b72335271aaaa6d736c311112c8230a5e9498d33 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Tue, 30 Jan 2018 15:43:41 -0800 Subject: [PATCH 020/103] Adding roslyn to automatic dependency flow through maestro. --- build_projects/update-dependencies/Config.cs | 5 +++++ build_projects/update-dependencies/Program.cs | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/build_projects/update-dependencies/Config.cs b/build_projects/update-dependencies/Config.cs index 9ba4b41ea..88c47ee94 100644 --- a/build_projects/update-dependencies/Config.cs +++ b/build_projects/update-dependencies/Config.cs @@ -39,12 +39,15 @@ namespace Microsoft.DotNet.Scripts private Lazy _dotNetVersionUrl = new Lazy(() => GetEnvironmentVariable("DOTNET_VERSION_URL", "https://raw.githubusercontent.com/dotnet/versions/master/build-info")); private Lazy _coreSetupVersionFragment = new Lazy(() => GetEnvironmentVariable("CORESETUP_VERSION_FRAGMENT", GetDefaultCoreSetupVersionFragment())); + + private Lazy _roslynVersionFragment = new Lazy(() => GetEnvironmentVariable("ROSLYN_VERSION_FRAGMENT")); private Lazy _gitHubUpstreamOwner = new Lazy(() => GetEnvironmentVariable("GITHUB_UPSTREAM_OWNER", "dotnet")); private Lazy _gitHubProject = new Lazy(() => GetEnvironmentVariable("GITHUB_PROJECT", "cli")); private Lazy _gitHubUpstreamBranch = new Lazy(() => GetEnvironmentVariable("GITHUB_UPSTREAM_BRANCH", GetDefaultUpstreamBranch())); private Lazy _gitHubPullRequestNotifications = new Lazy(() => GetEnvironmentVariable("GITHUB_PULL_REQUEST_NOTIFICATIONS", "") .Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)); + private Config() { } @@ -54,6 +57,8 @@ namespace Microsoft.DotNet.Scripts public string Password => _password.Value; public string DotNetVersionUrl => _dotNetVersionUrl.Value; public string CoreSetupVersionFragment => _coreSetupVersionFragment.Value; + public string RoslynVersionFragment => _roslynVersionFragment.Value; + public bool HasRoslynVersionFragment => !string.IsNullOrEmpty(RoslynVersionFragment); public string GitHubUpstreamOwner => _gitHubUpstreamOwner.Value; public string GitHubProject => _gitHubProject.Value; public string GitHubUpstreamBranch => _gitHubUpstreamBranch.Value; diff --git a/build_projects/update-dependencies/Program.cs b/build_projects/update-dependencies/Program.cs index ae39b89aa..99b77691e 100644 --- a/build_projects/update-dependencies/Program.cs +++ b/build_projects/update-dependencies/Program.cs @@ -28,6 +28,11 @@ namespace Microsoft.DotNet.Scripts buildInfos.Add(GetBuildInfo("CoreSetup", s_config.CoreSetupVersionFragment, fetchLatestReleaseFile: false)); + if (s_config.HasRoslynVersionFragment) + { + buildInfos.Add(GetBuildInfo("Roslyn", s_config.RoslynVersionFragment, fetchLatestReleaseFile: false)); + } + IEnumerable updaters = GetUpdaters(); var dependencyBuildInfos = buildInfos.Select(buildInfo => new BuildDependencyInfo( @@ -88,6 +93,11 @@ namespace Microsoft.DotNet.Scripts yield return CreateRegexUpdater(dependencyVersionsPath, "MicrosoftNETCoreAppPackageVersion", "Microsoft.NETCore.App"); yield return CreateRegexUpdater(dependencyVersionsPath, "MicrosoftDotNetPlatformAbstractionsPackageVersion", "Microsoft.DotNet.PlatformAbstractions"); yield return CreateRegexUpdater(dependencyVersionsPath, "MicrosoftExtensionsDependencyModelPackageVersion", "Microsoft.Extensions.DependencyModel"); + + if (s_config.HasRoslynVersionFragment) + { + yield return CreateRegexUpdater(dependencyVersionsPath, "MicrosoftCodeAnalysisCSharpPackageVersion", "Microsoft.CodeAnalysis.CSharp"); + } } private static IDependencyUpdater CreateRegexUpdater(string repoRelativePath, string propertyName, string packageId) From 55b9d8d7a971a69991423dc1903b7c82b42e04b1 Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Wed, 31 Jan 2018 15:10:13 -0800 Subject: [PATCH 021/103] Insert latest dotnet/sdk --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 43da89724..2031e8b26 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -14,7 +14,7 @@ $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) - 2.1.0-preview1-62516-03 + 2.1.300-preview2-62530-05 $(MicrosoftNETSdkPackageVersion) 2.1.0-release21-20180126-1326543 $(MicrosoftNETSdkWebPackageVersion) From 7ebfdde749013d56fe81aaa072d82f5cf0b49cf3 Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Wed, 17 Jan 2018 19:26:52 -0800 Subject: [PATCH 022/103] 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); + } } } From f0be5cc1ef35bb05be5625b9d868b1dbe643d2f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbyn=C4=9Bk=20Sailer?= Date: Fri, 2 Feb 2018 12:31:06 +0100 Subject: [PATCH 023/103] LOC CHECKIN | cli master | 20180202 --- .../dotnet-help/xlf/LocalizableStrings.cs.xlf | 2 +- .../dotnet-help/xlf/LocalizableStrings.de.xlf | 2 +- .../dotnet-help/xlf/LocalizableStrings.es.xlf | 2 +- .../dotnet-help/xlf/LocalizableStrings.fr.xlf | 2 +- .../dotnet-help/xlf/LocalizableStrings.it.xlf | 2 +- .../dotnet-help/xlf/LocalizableStrings.ja.xlf | 2 +- .../dotnet-help/xlf/LocalizableStrings.ko.xlf | 2 +- .../dotnet-help/xlf/LocalizableStrings.pl.xlf | 2 +- .../xlf/LocalizableStrings.pt-BR.xlf | 2 +- .../dotnet-help/xlf/LocalizableStrings.ru.xlf | 2 +- .../dotnet-help/xlf/LocalizableStrings.tr.xlf | 2 +- .../xlf/LocalizableStrings.zh-Hans.xlf | 2 +- .../xlf/LocalizableStrings.zh-Hant.xlf | 2 +- .../xlf/LocalizableStrings.cs.xlf | 48 ++++++++--------- .../xlf/LocalizableStrings.de.xlf | 48 ++++++++--------- .../xlf/LocalizableStrings.es.xlf | 52 +++++++++---------- .../xlf/LocalizableStrings.fr.xlf | 52 +++++++++---------- .../xlf/LocalizableStrings.it.xlf | 48 ++++++++--------- .../xlf/LocalizableStrings.ja.xlf | 52 +++++++++---------- .../xlf/LocalizableStrings.ko.xlf | 52 +++++++++---------- .../xlf/LocalizableStrings.pl.xlf | 52 +++++++++---------- .../xlf/LocalizableStrings.pt-BR.xlf | 40 +++++++------- .../xlf/LocalizableStrings.ru.xlf | 52 +++++++++---------- .../xlf/LocalizableStrings.tr.xlf | 48 ++++++++--------- .../xlf/LocalizableStrings.zh-Hans.xlf | 48 ++++++++--------- .../xlf/LocalizableStrings.zh-Hant.xlf | 48 ++++++++--------- .../xlf/LocalizableStrings.cs.xlf | 4 +- .../xlf/LocalizableStrings.de.xlf | 4 +- .../xlf/LocalizableStrings.es.xlf | 4 +- .../xlf/LocalizableStrings.fr.xlf | 4 +- .../xlf/LocalizableStrings.it.xlf | 4 +- .../xlf/LocalizableStrings.ja.xlf | 4 +- .../xlf/LocalizableStrings.ko.xlf | 4 +- .../xlf/LocalizableStrings.pl.xlf | 4 +- .../xlf/LocalizableStrings.pt-BR.xlf | 4 +- .../xlf/LocalizableStrings.ru.xlf | 4 +- .../xlf/LocalizableStrings.tr.xlf | 4 +- .../xlf/LocalizableStrings.zh-Hans.xlf | 4 +- .../xlf/LocalizableStrings.zh-Hant.xlf | 4 +- .../xlf/CommonLocalizableStrings.cs.xlf | 44 ++++++++-------- .../xlf/CommonLocalizableStrings.de.xlf | 44 ++++++++-------- .../xlf/CommonLocalizableStrings.es.xlf | 42 +++++++-------- .../xlf/CommonLocalizableStrings.fr.xlf | 48 ++++++++--------- .../xlf/CommonLocalizableStrings.it.xlf | 42 +++++++-------- .../xlf/CommonLocalizableStrings.ja.xlf | 44 ++++++++-------- .../xlf/CommonLocalizableStrings.ko.xlf | 44 ++++++++-------- .../xlf/CommonLocalizableStrings.pl.xlf | 44 ++++++++-------- .../xlf/CommonLocalizableStrings.pt-BR.xlf | 40 +++++++------- .../xlf/CommonLocalizableStrings.ru.xlf | 44 ++++++++-------- .../xlf/CommonLocalizableStrings.tr.xlf | 48 ++++++++--------- .../xlf/CommonLocalizableStrings.zh-Hans.xlf | 44 ++++++++-------- .../xlf/CommonLocalizableStrings.zh-Hant.xlf | 44 ++++++++-------- 52 files changed, 645 insertions(+), 645 deletions(-) diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf index 60c3f06c0..31b6a6293 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf @@ -254,7 +254,7 @@ Installs an item into the development environment. - Installs an item into the development environment. + Nainstaluje položku do vývojového prostředí. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf index 626ac712d..c7d6ce3f0 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf @@ -254,7 +254,7 @@ Installs an item into the development environment. - Installs an item into the development environment. + Installiert ein Element in der Entwicklungsumgebung. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf index be6b957d5..84d72d556 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf @@ -254,7 +254,7 @@ Installs an item into the development environment. - Installs an item into the development environment. + Instala un elemento en el entorno de desarrollo. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf index 4bc43827b..0cfb2d136 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf @@ -254,7 +254,7 @@ Installs an item into the development environment. - Installs an item into the development environment. + Installe un élément dans l'environnement de développement. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf index 02ce8040d..86c18a6cc 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf @@ -254,7 +254,7 @@ Installs an item into the development environment. - Installs an item into the development environment. + Installa un elemento nell'ambiente di sviluppo. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf index db469af6d..d65d68b4f 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf @@ -254,7 +254,7 @@ Installs an item into the development environment. - Installs an item into the development environment. + 項目を開発環境にインストールします。 diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf index a1f5caf5f..04844d4b5 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf @@ -254,7 +254,7 @@ Installs an item into the development environment. - Installs an item into the development environment. + 개발 환경에 항목을 설치합니다. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf index dedb2d7a8..59b34f3f8 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf @@ -254,7 +254,7 @@ Installs an item into the development environment. - Installs an item into the development environment. + Instaluje element w środowisku deweloperskim. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf index c6bff9d2e..49d800c64 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf @@ -254,7 +254,7 @@ Installs an item into the development environment. - Installs an item into the development environment. + Instala um item no ambiente de desenvolvimento. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf index 8cba3d0b4..4a4285f98 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf @@ -254,7 +254,7 @@ Installs an item into the development environment. - Installs an item into the development environment. + Устанавливает элемент в среде разработки. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf index 66f2b8431..be0b5c71b 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf @@ -254,7 +254,7 @@ Installs an item into the development environment. - Installs an item into the development environment. + Bir öğeyi geliştirme ortamına yükler. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf index f885412c5..56d6cd5cf 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf @@ -254,7 +254,7 @@ Installs an item into the development environment. - Installs an item into the development environment. + 将项目安装到开发环境中。 diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf index 571d32f19..9f60a5996 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf @@ -254,7 +254,7 @@ Installs an item into the development environment. - Installs an item into the development environment. + 將項目安裝至部署環境。 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..98414aaa8 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 @@ -4,19 +4,19 @@ Specifies a NuGet package source to use during installation. - Specifies a NuGet package source to use during installation. + Určuje zdroj balíčku NuGet, který se použije při instalaci. SOURCE - SOURCE + SOURCE The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} + +Instalace byla úspěšná. Pokud nejsou další pokyny, můžete přímo do jádra napsat následující příkaz k vyvolání: {0} @@ -24,10 +24,10 @@ The installation succeeded. If there are no further instructions, you can type t WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to add package. + Nepovedlo se přidat balíček. WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} +Argumenty: {1} +Výstup: {2}{3} @@ -35,10 +35,10 @@ Output: {2}{3} WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to restore package. + Nepovedlo se obnovit balíček. WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} +Argumenty: {1} +Výstup: {2}{3} @@ -46,8 +46,8 @@ Output: {2}{3} NuGet returned: {0} - Install failed. Failed to download package: -NuGet returned: + Instalace byla neúspěšná. Nepovedlo se stáhnout balíček: +Vrácený NuGet: {0} @@ -57,60 +57,60 @@ NuGet returned: 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: + Instalace byla neúspěšná. Soubor s nastavením v balíčku NuGet nástroje není platný. Kontaktujte prosím vlastníka balíčku NuGet. +Chyba byla následující: {0} NuGet Package Id of the tool to install. - NuGet Package Id of the tool to install. + ID balíčku NuGet nástroje, který se má nainstalovat Installs a tool for use on the command line. - Installs a tool for use on the command line. + Nainstaluje nástroj, který se bude používat na příkazovém řádku. The NuGet configuration file to use. - The NuGet configuration file to use. + Konfigurační soubor NuGet, který se použije. The target framework to install the tool for. - The target framework to install the tool for. + Cílová architektura, pro kterou se má nástroj nainstalovat Version of the tool package in NuGet. - Version of the tool package in NuGet. + Verze balíčku nástroje v NuGetu PACKAGE_ID - PACKAGE_ID + PACKAGE_ID Please specify one tool Package Id to install. - Please specify one tool Package Id to install. + Zadejte prosím jedno ID balíčku nástroje, který se má nainstalovat. Install user wide. - Install user wide. + Instalovat pro všechny uživatele .NET Install Command - .NET Install Command + Příkaz Instalovat rozhraní .NET The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. + Přepínač --global (-g) se aktuálně vyžaduje, protože se podporují jenom nástroje pro všechny uživatele. 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..4ff2adbe8 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 @@ -4,19 +4,19 @@ Specifies a NuGet package source to use during installation. - Specifies a NuGet package source to use during installation. + Gibt eine NuGet-Paketquelle für die Installation an. SOURCE - SOURCE + SOURCE The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} + +Die Installation war erfolgreich. Sofern keine weiteren Anweisungen vorliegen, können Sie für den Aufruf den folgenden Befehl direkt in der Shell eingeben: {0} @@ -24,10 +24,10 @@ The installation succeeded. If there are no further instructions, you can type t WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to add package. + Fehler beim Hinzufügen des Pakets. WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} +Argumente: {1} +Ausgabe: {2}{3} @@ -35,10 +35,10 @@ Output: {2}{3} WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to restore package. + Fehler beim Wiederherstellen des Pakets. WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} +Argumente: {1} +Ausgabe: {2}{3} @@ -46,8 +46,8 @@ Output: {2}{3} NuGet returned: {0} - Install failed. Failed to download package: -NuGet returned: + Fehler bei der Installation. Fehler beim Herunterladen des Pakets: +NuGet hat Folgendes zurückgegeben: {0} @@ -57,60 +57,60 @@ NuGet returned: 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: + Fehler bei der Installation. Die Einstellungsdatei im NuGet-Paket des Tools ist ungültig. Wenden Sie sich an den Besitzer des NuGet-Pakets. +Folgender Fehler wurde gemeldet: {0} NuGet Package Id of the tool to install. - NuGet Package Id of the tool to install. + NuGet-Paket-ID des zu installierenden Tools. Installs a tool for use on the command line. - Installs a tool for use on the command line. + Installiert ein Tool zur Verwendung über die Befehlszeile. The NuGet configuration file to use. - The NuGet configuration file to use. + Die zu verwendende NuGet-Konfigurationsdatei. The target framework to install the tool for. - The target framework to install the tool for. + Das Zielframework, für das das Tool installiert wird. Version of the tool package in NuGet. - Version of the tool package in NuGet. + Die Version des Toolpakets in NuGet. PACKAGE_ID - PACKAGE_ID + PACKAGE_ID Please specify one tool Package Id to install. - Please specify one tool Package Id to install. + Geben Sie eine Toolpaket-ID für die Installation an. Install user wide. - Install user wide. + Benutzerweite Installation. .NET Install Command - .NET Install Command + .NET-Installationsbefehl The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. + Die Option --global (-g) ist aktuell erforderlich, weil nur benutzerweite Tools unterstützt werden. 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..a709a3f30 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 @@ -4,19 +4,19 @@ Specifies a NuGet package source to use during installation. - Specifies a NuGet package source to use during installation. + Especifica el origen de un paquete NuGet para usarlo durante la instalación. SOURCE - SOURCE + ORIGEN The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} + +La instalación se completó correctamente. Si no hay más instrucciones, puede escribir el comando siguiente en el shell directamente para invocar: {0} @@ -24,10 +24,10 @@ The installation succeeded. If there are no further instructions, you can type t WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} + No se pudo agregar el paquete. +Directorio de trabajo: {0} +Argumentos: {1} +Salida: {2}{3} @@ -35,10 +35,10 @@ Output: {2}{3} WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} + No se pudo restaurar el paquete. +Directorio de trabajo: {0} +Argumentos: {1} +Salida: {2}{3} @@ -46,8 +46,8 @@ Output: {2}{3} NuGet returned: {0} - Install failed. Failed to download package: -NuGet returned: + Error en la instalación. No se pudo completar el paquete: +NuGet devuelto: {0} @@ -57,60 +57,60 @@ NuGet returned: 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: + Error en la instalación. El archivo de configuración del paquete NuGet de la herramienta no es válido. Póngase en contacto con el propietario del paquete NuGet. +El error fue: {0} NuGet Package Id of the tool to install. - NuGet Package Id of the tool to install. + Id. del paquete de NuGet que se instalará. Installs a tool for use on the command line. - Installs a tool for use on the command line. + Instala una herramienta para usarla en la línea de comandos. The NuGet configuration file to use. - The NuGet configuration file to use. + Archivo de configuración de NuGet que debe usarse. The target framework to install the tool for. - The target framework to install the tool for. + La plataforma de destino para la que se instala la herramienta. Version of the tool package in NuGet. - Version of the tool package in NuGet. + Versión del paquete de la herramienta en NuGet. PACKAGE_ID - PACKAGE_ID + PACKAGE_ID Please specify one tool Package Id to install. - Please specify one tool Package Id to install. + Especifique un id. de paquete para instalar. Install user wide. - Install user wide. + Instale para todos los usuarios. .NET Install Command - .NET Install Command + Comando para la instalación de .NET The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. + El conmutador --global (g) se requiere actualmente porque solo se admiten herramientas para todos los usuarios. 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..f7dc08d30 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 @@ -4,19 +4,19 @@ Specifies a NuGet package source to use during installation. - Specifies a NuGet package source to use during installation. + Spécifie un package NuGet source à utiliser durant l'installation. SOURCE - SOURCE + SOURCE The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} + +L'installation a réussi. En l'absence d'instructions supplémentaires, vous pouvez taper directement la commande suivante dans l'interpréteur de commandes pour appeler : {0} @@ -24,10 +24,10 @@ The installation succeeded. If there are no further instructions, you can type t WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} + Échec de l'ajout du package. +WorkingDirectory : {0} +Arguments : {1} +Sortie : {2}{3} @@ -35,10 +35,10 @@ Output: {2}{3} WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} + Échec de la restauration du package. +WorkingDirectory : {0} +Arguments : {1} +Sortie : {2}{3} @@ -46,8 +46,8 @@ Output: {2}{3} NuGet returned: {0} - Install failed. Failed to download package: -NuGet returned: + Échec de l'installation. Échec du téléchargement du package : +NuGet a retourné : {0} @@ -57,60 +57,60 @@ NuGet returned: 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: + Échec de l'installation. Le fichier de paramètres du package NuGet de l'outil est non valide. Contactez le propriétaire du package NuGet. +Erreur : {0} NuGet Package Id of the tool to install. - NuGet Package Id of the tool to install. + ID de package NuGet de l'outil à installer. Installs a tool for use on the command line. - Installs a tool for use on the command line. + Installe un outil à utiliser sur la ligne de commande. The NuGet configuration file to use. - The NuGet configuration file to use. + Fichier de configuration NuGet à utiliser. The target framework to install the tool for. - The target framework to install the tool for. + Framework cible pour lequel l'outil doit être installé. Version of the tool package in NuGet. - Version of the tool package in NuGet. + Version du package d'outils dans NuGet. PACKAGE_ID - PACKAGE_ID + PACKAGE_ID Please specify one tool Package Id to install. - Please specify one tool Package Id to install. + Spécifiez un ID de package d'outil à installer. Install user wide. - Install user wide. + Effectuez l'installation à l'échelle des utilisateurs. .NET Install Command - .NET Install Command + Commande d'installation .NET The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. + Le commutateur --global (-g) est obligatoire, car seuls les outils à l'échelle des utilisateurs sont pris en charge. 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..bb1677869 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 @@ -4,19 +4,19 @@ Specifies a NuGet package source to use during installation. - Specifies a NuGet package source to use during installation. + Consente di specificare un'origine pacchetto NuGet da usare durante l'installazione. SOURCE - SOURCE + ORIGINE The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} + +L'installazione è riuscita. Se non ci sono altre istruzioni, è possibile digitare direttamente nella shell il comando seguente da richiamare: {0} @@ -24,9 +24,9 @@ The installation succeeded. If there are no further instructions, you can type t WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} + Non è stato possibile aggiungere il pacchetto. +Directory di lavoro: {0} +Argomenti: {1} Output: {2}{3} @@ -35,9 +35,9 @@ Output: {2}{3} WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} + Non è stato possibile ripristinare il pacchetto. +Directory di lavoro: {0} +Argomenti: {1} Output: {2}{3} @@ -46,8 +46,8 @@ Output: {2}{3} NuGet returned: {0} - Install failed. Failed to download package: -NuGet returned: + L'installazione non è riuscita. Non è stato possibile caricare il pacchetto: +NuGet ha restituito: {0} @@ -57,60 +57,60 @@ NuGet returned: 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: + L'installazione non è riuscita. Il file di impostazioni nel pacchetto NuGet dello strumento non è valido. Contattare il proprietario del pacchetto NuGet. +Errore: {0} NuGet Package Id of the tool to install. - NuGet Package Id of the tool to install. + ID pacchetto NuGet dello strumento da installare. Installs a tool for use on the command line. - Installs a tool for use on the command line. + Installa uno strumento da usare sulla riga di comando. The NuGet configuration file to use. - The NuGet configuration file to use. + File di configurazione NuGet da usare. The target framework to install the tool for. - The target framework to install the tool for. + Framework di destinazione per cui installare lo strumento. Version of the tool package in NuGet. - Version of the tool package in NuGet. + Versione del pacchetto dello strumento in NuGet. PACKAGE_ID - PACKAGE_ID + PACKAGE_ID Please specify one tool Package Id to install. - Please specify one tool Package Id to install. + Specificare un ID pacchetto dello strumento da installare. Install user wide. - Install user wide. + Esegue l'installazione a livello di utente. .NET Install Command - .NET Install Command + Comando di installazione .NET The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. + L'opzione --global (-g) è attualmente obbligatoria perché sono supportati solo gli strumenti a livello di utente. 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..f4a54ceae 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 @@ -4,19 +4,19 @@ Specifies a NuGet package source to use during installation. - Specifies a NuGet package source to use during installation. + インストール中に使用する NuGet パッケージを指定します。 SOURCE - SOURCE + SOURCE The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} + +インストールは成功しました。追加の指示がなければ、シェルに次のコマンドを直接入力して呼び出すことができます: {0} @@ -24,10 +24,10 @@ The installation succeeded. If there are no further instructions, you can type t WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} + パッケージを追加できませんでした。 +作業ディレクトリ: {0} +引数: {1} +出力: {2}{3} @@ -35,10 +35,10 @@ Output: {2}{3} WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} + パッケージを復元できませんでした。 +作業ディレクトリ: {0} +引数: {1} +出力: {2}{3} @@ -46,8 +46,8 @@ Output: {2}{3} NuGet returned: {0} - Install failed. Failed to download package: -NuGet returned: + インストールに失敗しました。パッケージをダウンロードできませんでした: +NuGet によって次のものが返されました: {0} @@ -57,60 +57,60 @@ NuGet returned: 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: + インストールできませんでした。ツールの NuGet パッケージの設定ファイルが無効です。NuGet パッケージの所有者に問い合わせてください。 +エラーの内容: {0} NuGet Package Id of the tool to install. - NuGet Package Id of the tool to install. + インストールするツールの NuGet パッケージ ID。 Installs a tool for use on the command line. - Installs a tool for use on the command line. + コマンド ラインで使用するツールをインストールします。 The NuGet configuration file to use. - The NuGet configuration file to use. + 使用する NuGet 構成ファイル。 The target framework to install the tool for. - The target framework to install the tool for. + ツールをインストールするターゲット フレームワーク。 Version of the tool package in NuGet. - Version of the tool package in NuGet. + NuGet のツール パッケージのバージョン。 PACKAGE_ID - PACKAGE_ID + PACKAGE_ID Please specify one tool Package Id to install. - Please specify one tool Package Id to install. + インストールするツール パッケージの ID を指定してください。 Install user wide. - Install user wide. + ユーザー全体をインストールします。 .NET Install Command - .NET Install Command + .NET インストール コマンド The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. + サポートされているのはユーザー全体のツールだけなので、現在 --global スイッチ (-g) が必要です。 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..b79b65361 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 @@ -4,19 +4,19 @@ Specifies a NuGet package source to use during installation. - Specifies a NuGet package source to use during installation. + 설치 중 사용할 NuGet 패키지 소스를 지정합니다. SOURCE - SOURCE + SOURCE The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} + +설치했습니다. 추가 지침이 없는 경우 셸에 다음 명령을 직접 입력하여 {0}을(를) 호출할 수 있습니다. @@ -24,10 +24,10 @@ The installation succeeded. If there are no further instructions, you can type t WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} + 패키지를 추가하지 못했습니다. +작업 디렉터리: {0} +인수: {1} +출력: {2}{3} @@ -35,10 +35,10 @@ Output: {2}{3} WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} + 패키지를 복원하지 못했습니다. +작업 디렉터리: {0} +인수: {1} +출력: {2}{3} @@ -46,8 +46,8 @@ Output: {2}{3} NuGet returned: {0} - Install failed. Failed to download package: -NuGet returned: + 설치하지 못했습니다. 패키지를 다운로드하지 못했습니다. +반환된 NuGet: {0} @@ -57,60 +57,60 @@ NuGet returned: 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: + 설치하지 못했습니다. 도구의 NuGet 패키지에 있는 설정 파일이 잘못되었습니다. NuGet 패키지의 소유자에게 문의하세요. +오류: {0} NuGet Package Id of the tool to install. - NuGet Package Id of the tool to install. + 설치할 도구의 NuGet 패키지 ID입니다. Installs a tool for use on the command line. - Installs a tool for use on the command line. + 명령줄에서 사용할 도구를 설치합니다. The NuGet configuration file to use. - The NuGet configuration file to use. + 사용할 NuGet 구성 파일입니다. The target framework to install the tool for. - The target framework to install the tool for. + 도구를 설치할 대상 프레임워크입니다. Version of the tool package in NuGet. - Version of the tool package in NuGet. + NuGet의 도구 패키지 버전입니다. PACKAGE_ID - PACKAGE_ID + PACKAGE_ID Please specify one tool Package Id to install. - Please specify one tool Package Id to install. + 설치할 도구 패키지 ID를 하나 지정하세요. Install user wide. - Install user wide. + 사용자 전체 도구를 설치합니다. .NET Install Command - .NET Install Command + .NET 설치 명령 The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. + 사용자 전체 도구만 지원되므로 -global 스위치(-g)가 필요합니다. 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..53b4ed02d 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 @@ -4,19 +4,19 @@ Specifies a NuGet package source to use during installation. - Specifies a NuGet package source to use during installation. + Określa źródło pakietu NuGet do użycia podczas instalacji. SOURCE - SOURCE + ŹRÓDŁO The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} + +Instalacja powiodła się. Jeśli nie ma dodatkowych instrukcji, możesz wpisać następujące polecenie bezpośrednio w powłoce, aby wywołać: {0} @@ -24,10 +24,10 @@ The installation succeeded. If there are no further instructions, you can type t WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} + Nie można dodać pakietu. +Katalog roboczy: {0} +Argumenty: {1} +Dane wyjściowe: {2}{3} @@ -35,10 +35,10 @@ Output: {2}{3} WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} + Nie można przywrócić pakietu. +Katalog roboczy: {0} +Argumenty: {1} +Dane wyjściowe: {2}{3} @@ -46,8 +46,8 @@ Output: {2}{3} NuGet returned: {0} - Install failed. Failed to download package: -NuGet returned: + Instalacja nie powiodła się. Nie można pobrać pakietu: +Zwrócony pakiet NuGet: {0} @@ -57,60 +57,60 @@ NuGet returned: 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: + Instalacja nie powiodła się. Plik ustawień w pakiecie NuGet narzędzia jest nieprawidłowy. Skontaktuj się z właścicielem pakietu NuGet. +Błąd: {0} NuGet Package Id of the tool to install. - NuGet Package Id of the tool to install. + Identyfikator pakietu NuGet narzędzia do zainstalowania. Installs a tool for use on the command line. - Installs a tool for use on the command line. + Instaluje narzędzie do użytku w wierszu polecenia. The NuGet configuration file to use. - The NuGet configuration file to use. + Plik konfiguracji programu NuGet do użycia. The target framework to install the tool for. - The target framework to install the tool for. + Docelowa platforma, dla której ma zostać zainstalowane narzędzie. Version of the tool package in NuGet. - Version of the tool package in NuGet. + Wersja pakietu narzędzia w pakiecie NuGet. PACKAGE_ID - PACKAGE_ID + PACKAGE_ID Please specify one tool Package Id to install. - Please specify one tool Package Id to install. + Określ jeden identyfikator pakietu narzędzia do zainstalowania. Install user wide. - Install user wide. + Zainstaluj dla użytkownika. .NET Install Command - .NET Install Command + Polecenie instalacji platformy .NET The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. + Obecnie jest wymagany przełącznik --global (-g), ponieważ obsługiwane są tylko narzędzia użytkownika. 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..da111d844 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 @@ -4,19 +4,19 @@ Specifies a NuGet package source to use during installation. - Specifies a NuGet package source to use during installation. + Especifica uma origem do pacote NuGet a ser usada durante a instalação. SOURCE - SOURCE + ORIGEM The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} + +A instalação foi bem-sucedida. Se não houver outras instruções, digite o seguinte comando no shell diretamente para invocar: {0} @@ -24,7 +24,7 @@ The installation succeeded. If there are no further instructions, you can type t WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to add package. + Falha ao adicionar pacote. WorkingDirectory: {0} Arguments: {1} Output: {2}{3} @@ -35,7 +35,7 @@ Output: {2}{3} WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to restore package. + Falha ao restaurar pacote. WorkingDirectory: {0} Arguments: {1} Output: {2}{3} @@ -46,8 +46,8 @@ Output: {2}{3} NuGet returned: {0} - Install failed. Failed to download package: -NuGet returned: + Falha na instalação. Falha ao baixar o pacote: +o NuGet retornou: {0} @@ -57,60 +57,60 @@ NuGet returned: 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: + Falha na instalação. O arquivo de configuração no pacote NuGet da ferramenta não é válido. Contate o proprietário do pacote NuGet. +O erro foi o seguinte: {0} NuGet Package Id of the tool to install. - NuGet Package Id of the tool to install. + A ID do pacote NuGet da ferramenta a ser instalada. Installs a tool for use on the command line. - Installs a tool for use on the command line. + Instala uma ferramenta para uso na linha de comando. The NuGet configuration file to use. - The NuGet configuration file to use. + O arquivo de configuração do NuGet a ser usado. The target framework to install the tool for. - The target framework to install the tool for. + A estrutura de destino para a qual instalar a ferramenta. Version of the tool package in NuGet. - Version of the tool package in NuGet. + Versão do pacote da ferramenta no NuGet. PACKAGE_ID - PACKAGE_ID + PACKAGE_ID Please specify one tool Package Id to install. - Please specify one tool Package Id to install. + Especifique uma ID de Pacote da ferramenta a ser instalada. Install user wide. - Install user wide. + Instale para todo o usuário. .NET Install Command - .NET Install Command + Comando de instalação do .NET The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. + A opção --global (-g) é obrigatória, pois somente ferramentas para todo o usuário são compatíveis. 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..fe1db101a 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 @@ -4,19 +4,19 @@ Specifies a NuGet package source to use during installation. - Specifies a NuGet package source to use during installation. + Задает источник пакета NuGet, используемый во время установки. SOURCE - SOURCE + SOURCE The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} + +Установка завершена. Если других действий не требуется, вы можете непосредственно в оболочке ввести для вызова следующую команду: {0}. @@ -24,10 +24,10 @@ The installation succeeded. If there are no further instructions, you can type t WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} + Не удалось добавить пакет. +Рабочий каталог: {0} +Аргументы: {1} +Выходные данные: {2}{3} @@ -35,10 +35,10 @@ Output: {2}{3} WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to restore package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} + Не удалось восстановить пакет. +Рабочий каталог: {0} +Аргументы: {1} +Выходные данные: {2}{3} @@ -46,8 +46,8 @@ Output: {2}{3} NuGet returned: {0} - Install failed. Failed to download package: -NuGet returned: + Выполнить установку не удалось. Не удалось скачать пакет. +Возвращаемые данные NuGet: {0} @@ -57,60 +57,60 @@ NuGet returned: 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: + Выполнить установку не удалось. Файл параметров в пакете NuGet инструмента недопустим. Обратитесь к владельцу пакета NuGet. +Ошибка: {0} NuGet Package Id of the tool to install. - NuGet Package Id of the tool to install. + Идентификатор пакета NuGet устанавливаемого инструмента. Installs a tool for use on the command line. - Installs a tool for use on the command line. + Устанавливает инструмент для использования в командной строке. The NuGet configuration file to use. - The NuGet configuration file to use. + Используемый файл конфигурации NuGet. The target framework to install the tool for. - The target framework to install the tool for. + Целевая платформа для установки инструмента. Version of the tool package in NuGet. - Version of the tool package in NuGet. + Версия пакета инструмента в NuGet. PACKAGE_ID - PACKAGE_ID + PACKAGE_ID Please specify one tool Package Id to install. - Please specify one tool Package Id to install. + Укажите один идентификатор пакета устанавливаемого инструмента. Install user wide. - Install user wide. + Установка на уровне пользователя. .NET Install Command - .NET Install Command + Команда установки .NET The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. + Параметр "--global switch (-g)" сейчас обязателен, так как поддерживаются только инструменты уровня пользователя. 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..65121c960 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 @@ -4,19 +4,19 @@ Specifies a NuGet package source to use during installation. - Specifies a NuGet package source to use during installation. + Yükleme sırasında kullanılacak bir NuGet paket kaynağı belirtir. SOURCE - SOURCE + SOURCE The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} + +Yükleme başarılı oldu. Daha fazla yönerge yoksa, çağırmak için şu komutu doğrudan kabuğa yazabilirsiniz: {0} @@ -24,10 +24,10 @@ The installation succeeded. If there are no further instructions, you can type t WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to add package. + Paket eklenemedi. WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} +Bağımsız değişkenler: {1} +Çıkış: {2}{3} @@ -35,10 +35,10 @@ Output: {2}{3} WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to restore package. + Paket geri yüklenemedi. WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} +Bağımsız değişkenler: {1} +Çıkış: {2}{3} @@ -46,8 +46,8 @@ Output: {2}{3} NuGet returned: {0} - Install failed. Failed to download package: -NuGet returned: + Yükleme başarısız oldu. Paket indirilemedi: +NuGet şunu döndürdü: {0} @@ -57,60 +57,60 @@ NuGet returned: 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: + Yükleme başarısız oldu. Aracın NuGet paketindeki ayarlar dosyası geçerli değil. Lütfen NuGet paketinin sahibine başvurun. +Hata: {0} NuGet Package Id of the tool to install. - NuGet Package Id of the tool to install. + Yüklenecek aracın NuGet Paket Kimliği. Installs a tool for use on the command line. - Installs a tool for use on the command line. + Komut satırında kullanılacak bir araç yükler. The NuGet configuration file to use. - The NuGet configuration file to use. + Kullanılacak NuGet yapılandırma dosyası. The target framework to install the tool for. - The target framework to install the tool for. + Aracın yükleneceği hedef çerçeve. Version of the tool package in NuGet. - Version of the tool package in NuGet. + NuGet’teki araç paketinin sürümü. PACKAGE_ID - PACKAGE_ID + PACKAGE_ID Please specify one tool Package Id to install. - Please specify one tool Package Id to install. + Lütfen yüklenecek araç Paketi Kimliğini belirtin. Install user wide. - Install user wide. + Kullanıcı için yükleyin. .NET Install Command - .NET Install Command + .NET Yükleme Komutu The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. + Yalnızca kullanıcı için araçlar desteklendiğinden --global anahtarı (-g) şu anda gereklidir. 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..5a0f9be55 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 @@ -4,19 +4,19 @@ Specifies a NuGet package source to use during installation. - Specifies a NuGet package source to use during installation. + 指定安装期间使用的 NuGet 包源。 SOURCE - SOURCE + SOURCE The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} + +安装成功。如果没有进一步的说明,则可直接在 shell 中键入以下命令进行调用: {0} @@ -24,10 +24,10 @@ The installation succeeded. If there are no further instructions, you can type t WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to add package. + 未能添加包。 WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} +参数: {1} +输出: {2}{3} @@ -35,10 +35,10 @@ Output: {2}{3} WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to restore package. + 未能还原包。 WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} +参数: {1} +输出: {2}{3} @@ -46,8 +46,8 @@ Output: {2}{3} NuGet returned: {0} - Install failed. Failed to download package: -NuGet returned: + 安装失败。未能下载包: +NuGet 已返回: {0} @@ -57,60 +57,60 @@ NuGet returned: 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: + 安装失败。工具的 NuGet 包中的设置文件无效。请联系 NuGet 包的所有者。 +错误: {0} NuGet Package Id of the tool to install. - NuGet Package Id of the tool to install. + 要安装的工具的 NuGet 包 ID。 Installs a tool for use on the command line. - Installs a tool for use on the command line. + 安装在命令行上使用的工具。 The NuGet configuration file to use. - The NuGet configuration file to use. + 要使用的 NuGet 配置文件。 The target framework to install the tool for. - The target framework to install the tool for. + 要安装工具的目标框架。 Version of the tool package in NuGet. - Version of the tool package in NuGet. + NuGet 中工具包的版本。 PACKAGE_ID - PACKAGE_ID + PACKAGE_ID Please specify one tool Package Id to install. - Please specify one tool Package Id to install. + 请指定一个要安装的工具包 ID。 Install user wide. - Install user wide. + 安装用户范围。 .NET Install Command - .NET Install Command + .NET 安装命令 The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. + 目前需要 --global 开关 (-g),因为仅支持用户范围工具。 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..32c579688 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 @@ -4,19 +4,19 @@ Specifies a NuGet package source to use during installation. - Specifies a NuGet package source to use during installation. + 指定於安裝期間要使用的 NuGet 套件來源。 SOURCE - SOURCE + SOURCE The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} + +安裝已成功。如果沒有進一步指示,您可以直接在命令介面中鍵入下列命令,以叫用: {0} @@ -24,10 +24,10 @@ The installation succeeded. If there are no further instructions, you can type t WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to add package. + 無法新增套件。 WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} +引數: {1} +輸出: {2}{3} @@ -35,10 +35,10 @@ Output: {2}{3} WorkingDirectory: {0} Arguments: {1} Output: {2}{3} - Failed to restore package. + 無法還原套件。 WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} +引數: {1} +輸出: {2}{3} @@ -46,8 +46,8 @@ Output: {2}{3} NuGet returned: {0} - Install failed. Failed to download package: -NuGet returned: + 安裝失敗。無法下載套件: +傳回的 NuGet: {0} @@ -57,60 +57,60 @@ NuGet returned: 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: + 安裝失敗。工具 NuGet 套件中的設定檔無效。請連絡 NuGet 套件的擁有者。 +錯誤為: {0} NuGet Package Id of the tool to install. - NuGet Package Id of the tool to install. + 要安裝之工具的 NuGet 套件識別碼。 Installs a tool for use on the command line. - Installs a tool for use on the command line. + 安裝工具以用於命令列。 The NuGet configuration file to use. - The NuGet configuration file to use. + 要使用的 NuGet 組態檔。 The target framework to install the tool for. - The target framework to install the tool for. + 要為工具安裝的目標 Framework。 Version of the tool package in NuGet. - Version of the tool package in NuGet. + NuGet 中的工具套件版本。 PACKAGE_ID - PACKAGE_ID + PACKAGE_ID Please specify one tool Package Id to install. - Please specify one tool Package Id to install. + 請指定一個要安裝的工具套件識別碼。 Install user wide. - Install user wide. + 為全部使用者安裝。 .NET Install Command - .NET Install Command + .NET 安裝命令 The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. + 因為只支援適用於全體使用者的工具,所以目前必須有 --global 參數 (-g)。 diff --git a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.cs.xlf index bb384516d..6ea7bd20c 100644 --- a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.cs.xlf +++ b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.cs.xlf @@ -4,12 +4,12 @@ .NET Install Command - .NET Install Command + Příkaz Instalovat rozhraní .NET Installs an item into the development environment. - Installs an item into the development environment. + Nainstaluje položku do vývojového prostředí. diff --git a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.de.xlf index f8ec0ecae..7d871b47e 100644 --- a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.de.xlf +++ b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.de.xlf @@ -4,12 +4,12 @@ .NET Install Command - .NET Install Command + .NET-Installationsbefehl Installs an item into the development environment. - Installs an item into the development environment. + Installiert ein Element in der Entwicklungsumgebung. diff --git a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.es.xlf index 3fc8d1535..91724fd74 100644 --- a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.es.xlf +++ b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.es.xlf @@ -4,12 +4,12 @@ .NET Install Command - .NET Install Command + Comando para la instalación de .NET Installs an item into the development environment. - Installs an item into the development environment. + Instala un elemento en el entorno de desarrollo. diff --git a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.fr.xlf index ab8c7f1ed..54b608a2b 100644 --- a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.fr.xlf +++ b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.fr.xlf @@ -4,12 +4,12 @@ .NET Install Command - .NET Install Command + Commande d'installation .NET Installs an item into the development environment. - Installs an item into the development environment. + Installe un élément dans l'environnement de développement. diff --git a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.it.xlf index 9177f06f6..2b3e4b41a 100644 --- a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.it.xlf +++ b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.it.xlf @@ -4,12 +4,12 @@ .NET Install Command - .NET Install Command + Comando di installazione .NET Installs an item into the development environment. - Installs an item into the development environment. + Installa un elemento nell'ambiente di sviluppo. diff --git a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.ja.xlf index ed919e45f..d02cab060 100644 --- a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.ja.xlf +++ b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.ja.xlf @@ -4,12 +4,12 @@ .NET Install Command - .NET Install Command + .NET インストール コマンド Installs an item into the development environment. - Installs an item into the development environment. + 項目を開発環境にインストールします。 diff --git a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.ko.xlf index 5cb49a7d2..d21a653d2 100644 --- a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.ko.xlf +++ b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.ko.xlf @@ -4,12 +4,12 @@ .NET Install Command - .NET Install Command + .NET 설치 명령 Installs an item into the development environment. - Installs an item into the development environment. + 개발 환경에 항목을 설치합니다. diff --git a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.pl.xlf index 0901ecbb6..e10cbde25 100644 --- a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.pl.xlf +++ b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.pl.xlf @@ -4,12 +4,12 @@ .NET Install Command - .NET Install Command + Polecenie instalacji .NET Installs an item into the development environment. - Installs an item into the development environment. + Instaluje element w środowisku deweloperskim. diff --git a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.pt-BR.xlf index 4470800f4..6ff812be4 100644 --- a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.pt-BR.xlf @@ -4,12 +4,12 @@ .NET Install Command - .NET Install Command + Comando de instalação do .NET Installs an item into the development environment. - Installs an item into the development environment. + Instala um item no ambiente de desenvolvimento. diff --git a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.ru.xlf index 7513958c2..82fced65c 100644 --- a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.ru.xlf +++ b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.ru.xlf @@ -4,12 +4,12 @@ .NET Install Command - .NET Install Command + Команда установки .NET Installs an item into the development environment. - Installs an item into the development environment. + Устанавливает элемент в среде разработки. diff --git a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.tr.xlf index 1c365d715..6ac5ab4a6 100644 --- a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.tr.xlf +++ b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.tr.xlf @@ -4,12 +4,12 @@ .NET Install Command - .NET Install Command + .NET Yükleme Komutu Installs an item into the development environment. - Installs an item into the development environment. + Bir öğeyi geliştirme ortamına yükler. diff --git a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.zh-Hans.xlf index 425012172..b6cbdbe49 100644 --- a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.zh-Hans.xlf @@ -4,12 +4,12 @@ .NET Install Command - .NET Install Command + .NET 安装命令 Installs an item into the development environment. - Installs an item into the development environment. + 将项目安装到开发环境中。 diff --git a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.zh-Hant.xlf index 61c3b4237..4addd8206 100644 --- a/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/commands/dotnet-install/xlf/LocalizableStrings.zh-Hant.xlf @@ -4,12 +4,12 @@ .NET Install Command - .NET Install Command + .NET 安裝命令 Installs an item into the development environment. - Installs an item into the development environment. + 將項目安裝至部署環境。 diff --git a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf index fcff78d2f..5088f7014 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf @@ -676,46 +676,46 @@ Cannot be null or whitespace. - Cannot be null or whitespace. + Nemůže být null nebo prázdný znak. Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} + Obsahuje nejméně jeden neplatný znak: {0} The tool's settings file is invalid xml. {0} - The tool's settings file is invalid xml. + Soubor nastavení nástroje je neplatný soubor xml. {0} The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. + Soubor nastavení nástroje má jiný spouštěč než dotnet. The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. + Soubor nastavení nástroje má definovaný více než jeden příkaz. The tool's settings file contains error. {0} - The tool's settings file contains error. + Soubor nastavení nástroje obsahuje chybu. {0} NuGet configuration file {0} does not exist. - NuGet configuration file {0} does not exist. + Konfigurační soubor NuGet {0} neexistuje. Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. + Právě jste nainstalovali sadu .NET Core SDK, bude proto nutné před spuštěním nainstalovaného nástroje se odhlásit nebo restartovat relaci. @@ -726,8 +726,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: + Nejde najít cestu ke spustitelnému souboru nástrojů. Zkontrolujte, jestli v cestě (PATH) máte přidaný {0}. +Pokud používáte bash, můžete to provést spuštěním následujícího příkazu: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -737,7 +737,7 @@ EOF Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. + Právě jste nainstalovali sadu .NET Core SDK, bude proto nutné před spuštěním nainstalovaného nástroje znovu otevřít terminál. @@ -748,8 +748,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: + Nejde najít cestu ke spustitelnému souboru nástrojů. Zkontrolujte, jestli v cestě (PATH) máte přidaný {0}. +Pokud používáte bash, můžete to provést spuštěním následujícího příkazu: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -759,21 +759,21 @@ EOF Failed to install tool {0}. A command with the same name already exists. - Failed to install tool {0}. A command with the same name already exists. + Instalace nástroje {0} byla neúspěšná. Už existuje příkaz se stejným názvem. Failed to change permission: Error: {0} Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + Změna oprávnění byla neúspěšná: +Chyba: {0} +Výstup: {1} Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. + Právě jste nainstalovali sadu .NET Core SDK, bude proto nutné před spuštěním nainstalovaného nástroje znovu otevřít okno příkazového řádku. @@ -781,20 +781,20 @@ Output: {1} You can do this by running the following command: setx PATH "%PATH%;{1}" - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + Nejde najít cestu ke spustitelnému souboru nástrojů. Zkontrolujte, jestli v cestě (PATH) máte přidaný {0}. +Můžete to provést spuštěním následujícího příkazu: setx PATH "%PATH%;{1}" Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {1}. + V balíčku {0} chybí soubor vstupního bodu {1}. Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + V balíčku {0} chybí soubor nastavení nástroje DotnetToolSettings.xml. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf index 2ef360050..8003c92d3 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf @@ -676,46 +676,46 @@ Cannot be null or whitespace. - Cannot be null or whitespace. + Darf nicht NULL sein oder Leerraum enthalten. Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} + Enthält mindestens ein ungültiges Zeichen: {0} The tool's settings file is invalid xml. {0} - The tool's settings file is invalid xml. + Die Datei mit den Tooleinstellungen ist eine ungültige XML. {0} The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. + Die Datei mit den Tooleinstellungen verwendet nicht "dotnet" als Runner. The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. + In der Datei mit den Tooleinstellungen ist mehr als ein Befehl definiert. The tool's settings file contains error. {0} - The tool's settings file contains error. + Die Datei mit den Tooleinstellungen enthält einen Fehler. {0} NuGet configuration file {0} does not exist. - NuGet configuration file {0} does not exist. + Die NuGet-Konfigurationsdatei "{0}" ist nicht vorhanden. Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. + Da Sie gerade das .NET Core SDK installiert haben, müssen Sie sich abmelden oder Ihre Sitzung neu starten, bevor Sie das installierte Tool ausführen. @@ -726,8 +726,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: + Der Pfad für die Toolausführung wurde nicht gefunden. Stellen Sie sicher, dass "{0}" zu PATH hinzugefügt wurde. +Bei Verwendung von Bash können Sie hierzu den folgenden Befehl ausführen: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -737,7 +737,7 @@ EOF Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. + Da Sie gerade das .NET Core SDK installiert haben, müssen Sie das Terminal neu öffnen, bevor Sie das installierte Tool ausführen. @@ -748,8 +748,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: + Der Pfad für die Toolausführung wurde nicht gefunden. Stellen Sie sicher, dass "{0}" zu PATH hinzugefügt wurde. +Bei Verwendung von Bash können Sie hierzu den folgenden Befehl ausführen: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -759,21 +759,21 @@ EOF Failed to install tool {0}. A command with the same name already exists. - Failed to install tool {0}. A command with the same name already exists. + Fehler beim Installieren von Tool "{0}". Es ist bereits ein Befehl mit diesem Namen vorhanden. Failed to change permission: Error: {0} Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + Fehler beim Ändern der Berechtigung: +Fehler: {0} +Ausgabe: {1} Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. + Da Sie gerade das .NET Core SDK installiert haben, müssen Sie das Eingabeaufforderungsfenster neu öffnen, bevor Sie das installierte Tool ausführen. @@ -781,20 +781,20 @@ Output: {1} You can do this by running the following command: setx PATH "%PATH%;{1}" - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + Der Pfad für die Toolausführung wurde nicht gefunden. Stellen Sie sicher, dass "{0}" zu PATH hinzugefügt wurde. +Sie können hierzu den folgenden Befehl ausführen: setx PATH "%PATH%;{1}" Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {1}. + Im Paket "{0}" fehlt die Einstiegspunktdatei "{1}". Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + Im Paket "{0}" fehlt die Datei mit den Tooleinstellungen "DotnetToolSettings.xml". diff --git a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf index 082d2d6d0..9c599a3ca 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf @@ -676,46 +676,46 @@ Cannot be null or whitespace. - Cannot be null or whitespace. + No puede ser nulo ni un espacio en blanco. Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} + Contiene uno o varios caracteres no válidos: {0} The tool's settings file is invalid xml. {0} - The tool's settings file is invalid xml. + El archivo de configuración de la herramienta es un xml no válido. {0} The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. + El archivo de configuración de la herramienta tiene un ejecutor diferente de "dotnet". The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. + El archivo de configuración de la herramienta tiene más de un comando definido. The tool's settings file contains error. {0} - The tool's settings file contains error. + El archivo de configuración de la herramienta contiene un error. {0} NuGet configuration file {0} does not exist. - NuGet configuration file {0} does not exist. + El archivo de configuración de NuGet {0} no existe. Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. + Dado que acaba de instalar el SDK de .Net Core, tendrá que cerrar sesión o reiniciarla antes de ejecutar la herramienta instalada. @@ -726,8 +726,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: + No se encuentra la ruta de acceso del ejecutable de las herramientas. Compruebe que se ha agregado {0} a su valor PATH. +Si usa bash, puede hacerlo con la ejecución del comando siguiente: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -737,7 +737,7 @@ EOF Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. + Dado que acaba de instalar el SDK de .Net Core, tendrá que volver a abrir la terminal antes de ejecutar la herramienta instalada. @@ -748,8 +748,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: + No se encuentra la ruta de acceso del ejecutable de las herramientas. Compruebe que se ha agregado {0} a su valor PATH. +Si usa bash, puede hacerlo con la ejecución del comando siguiente: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -759,21 +759,21 @@ EOF Failed to install tool {0}. A command with the same name already exists. - Failed to install tool {0}. A command with the same name already exists. + No se pudo instalar la herramienta {0}. Ya existe un comando con el mismo nombre. Failed to change permission: Error: {0} Output: {1} - Failed to change permission: + No se pudo cambiar el permiso: Error: {0} -Output: {1} +Salida: {1} Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. + Dado que acaba de instalar el SDK de .Net Core, tendrá que volver a abrir la ventana del símbolo del sistema antes de ejecutar la herramienta instalada. @@ -781,20 +781,20 @@ Output: {1} You can do this by running the following command: setx PATH "%PATH%;{1}" - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + No se encuentra la ruta de acceso del ejecutable de las herramientas. Compruebe que se ha agregado {0} a su valor PATH. +Para ello, puede ejecutar el comando siguiente: setx PATH "%PATH%;{1}" Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {1}. + Al paquete "{0}" le falta el archivo de punto de entrada {1}. Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + Al paquete "{0}" le falta el archivo de configuración de herramientas DotnetToolSettings.xml. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf index 04790f3aa..6fcd3f34a 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf @@ -676,46 +676,46 @@ Cannot be null or whitespace. - Cannot be null or whitespace. + Ne peut pas avoir une valeur null ou être un espace blanc Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} + Contient un ou plusieurs caractères non valides : {0} The tool's settings file is invalid xml. {0} - The tool's settings file is invalid xml. + Le fichier de paramètres de l'outil est un fichier xml non valide. {0} The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. + Le fichier de paramètres de l'outil n'a pas "dotnet" comme exécuteur. The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. + Plusieurs commandes sont définies pour le fichier de paramètres de l'outil. The tool's settings file contains error. {0} - The tool's settings file contains error. + Le fichier de paramètres de l'outil contient une erreur. {0} NuGet configuration file {0} does not exist. - NuGet configuration file {0} does not exist. + Le fichier config NuGet {0} n'existe pas. Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. + Dans la mesure où vous venez d'installer le kit SDK .NET Core, vous devez vous déconnecter ou redémarrer votre session avant d'exécuter l'outil que vous avez installé. @@ -726,18 +726,18 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: + Le chemin des exécutables des outils est introuvable. Vérifiez que {0} est ajouté à PATH. +Si vous utilisez Bash, utilisez la commande suivante : cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools +# Ajouter les outils du kit SDK .NET Core export PATH="$PATH:{1}" EOF Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. + Dans la mesure où vous venez d'installer le kit SDK .NET Core, vous devez rouvrir le terminal avant d'exécuter l'outil que vous avez installé. @@ -748,32 +748,32 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: + Le chemin des exécutables des outils est introuvable. Vérifiez que {0} est ajouté à PATH. +Si vous utilisez Bash, utilisez la commande suivante : cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools +# Ajouter les outils du kit SDK .NET Core export PATH="$PATH:{1}" EOF Failed to install tool {0}. A command with the same name already exists. - Failed to install tool {0}. A command with the same name already exists. + Échec de l'installation de l'outil {0}. Une commande portant le même nom existe déjà. Failed to change permission: Error: {0} Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + Échec du changement de l'autorisation : +Erreur : {0} +Sortie : {1} Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. + Dans la mesure où vous venez d'installer le kit SDK .NET Core, vous devez rouvrir la fenêtre d'invite de commandes avant d'exécuter l'outil que vous avez installé. @@ -781,20 +781,20 @@ Output: {1} You can do this by running the following command: setx PATH "%PATH%;{1}" - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + Le chemin des exécutables des outils est introuvable. Vérifiez que {0} est ajouté à PATH. +Utilisez la commande suivante : setx PATH "%PATH%;{1}" Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {1}. + Le package '{0}' ne contient pas le fichier de point d'entrée {1}. Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + Le package '{0}' ne contient pas le fichier de paramètres d'outils DotnetToolSettings.xml. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf index 2f43ff640..51eea9a5d 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf @@ -676,46 +676,46 @@ Cannot be null or whitespace. - Cannot be null or whitespace. + Non può essere Null o costituito da spazi vuoti. Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} + Contiene uno o più caratteri non validi: {0} The tool's settings file is invalid xml. {0} - The tool's settings file is invalid xml. + Il file di impostazioni dello strumento è costituito da codice XML non valido. {0} The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. + Lo strumento di esecuzione del file di impostazioni dello strumento non è "dotnet". The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. + Per il file di impostazioni dello strumento è definito più di un comando. The tool's settings file contains error. {0} - The tool's settings file contains error. + Il file di impostazioni dello strumento contiene un errore. {0} NuGet configuration file {0} does not exist. - NuGet configuration file {0} does not exist. + Il file di configurazione NuGet {0} non esiste. Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. + Dal momento che è stato appena installato .NET Core SDK, è necessario disconnettersi o riavviare la sessione prima di eseguire lo strumento installato. @@ -726,8 +726,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: + Il percorso dell'eseguibile degli strumenti non è stato trovato. Assicurarsi che {0} sia stato aggiunto a PATH. +Se si usa bash, è possibile verificarlo eseguendo il comando seguente: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -737,7 +737,7 @@ EOF Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. + Dal momento che è stato appena installato .NET Core SDK, è necessario riaprire il terminale prima di eseguire lo strumento installato. @@ -748,8 +748,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: + Il percorso dell'eseguibile degli strumenti non è stato trovato. Assicurarsi che {0} sia stato aggiunto a PATH. +Se si usa bash, è possibile verificarlo eseguendo il comando seguente: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -759,21 +759,21 @@ EOF Failed to install tool {0}. A command with the same name already exists. - Failed to install tool {0}. A command with the same name already exists. + Non è stato possibile installare lo strumento {0}. Esiste già un comando con lo stesso nome. Failed to change permission: Error: {0} Output: {1} - Failed to change permission: -Error: {0} + Non è stato possibile cambiare l'autorizzazione: +Errore: {0} Output: {1} Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. + Dal momento che è stato appena installato .NET Core SDK, è necessario riaprire la finestra del prompt dei comandi prima di eseguire lo strumento installato. @@ -781,20 +781,20 @@ Output: {1} You can do this by running the following command: setx PATH "%PATH%;{1}" - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + Il percorso dell'eseguibile degli strumenti non è stato trovato. Assicurarsi che {0} sia stato aggiunto a PATH. +Per verificarlo, eseguire il comando seguente: setx PATH "%PATH%;{1}" Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {1}. + Nel pacchetto '{0}' manca il file del punto di ingresso {1}. Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + Nel pacchetto '{0}' manca il file di impostazioni dello strumento DotnetToolSettings.xml. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf index b2648f41d..b576b0557 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf @@ -676,46 +676,46 @@ Cannot be null or whitespace. - Cannot be null or whitespace. + null または空白文字にすることはできません。 Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} + 1 つ以上の無効な文字が含まれています: {0} The tool's settings file is invalid xml. {0} - The tool's settings file is invalid xml. + ツールの設定ファイルは無効な xml です。 {0} The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. + ツールの設定ファイルにはランナーとしての非 "dotnet" があります。 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. + NuGet 構成ファイル {0} は存在しません。 Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. + .NET Core SDK をインストールしたばかりなので、インストールしたツールを実行する前に、ログアウトするか、セッションを再起動する必要があります。 @@ -726,8 +726,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: + ツールの実行可能パスが見つかりません。{0} が PATH に追加されていることを確認してください。 +bash を使用している場合、次のコマンドを実行してこれを行えます: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -737,7 +737,7 @@ EOF Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. + .NET Core SDK をインストールしたばかりなので、インストールしたツールを実行する前に、端末を再び開く必要があります。 @@ -748,8 +748,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: + ツールの実行可能パスが見つかりません。{0} が PATH に追加されていることを確認してください。 +bash を使用している場合、次のコマンドを実行してこれを行えます: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -759,21 +759,21 @@ EOF Failed to install tool {0}. A command with the same name already exists. - Failed to install tool {0}. A command with the same name already exists. + ツール {0} をインストールできませんでした。同じ名前のコマンドが既に存在しています。 Failed to change permission: Error: {0} Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + アクセス許可を変更できませんでした: +エラー: {0} +出力: {1} Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. + .NET Core SDK をインストールしたばかりなので、インストールしたツールを実行する前に、コマンド プロンプト ウィンドウを再び開く必要があります。 @@ -781,20 +781,20 @@ Output: {1} You can do this by running the following command: setx PATH "%PATH%;{1}" - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + ツールの実行可能パスが見つかりません。{0} が PATH に追加されていることを確認してください。 +次のコマンドを実行してこれを行えます: setx PATH "%PATH%;{1}" Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {1}. + パッケージ '{0}' にエントリ ポイント ファイル {1} がありません。 Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + パッケージ '{0}' にツール設定ファイル DotnetToolSettings.xml がありません。 diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf index c8e626ebc..6d90b0e60 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf @@ -676,46 +676,46 @@ Cannot be null or whitespace. - Cannot be null or whitespace. + null 또는 공백일 수 없습니다. Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} + 잘못된 문자가 하나 이상 포함되어 있습니다. {0} The tool's settings file is invalid xml. {0} - The tool's settings file is invalid xml. + 도구의 설정 파일이 잘못된 xml입니다. {0} The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. + 도구의 설정 파일에 실행기로서 “dotnet”이 없습니다. 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. + NuGet 구성 파일 {0}이(가) 없습니다. Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. + .NET Core SDK를 방금 설치했기 때문에 설치한 도구를 실행하기 전에 로그아웃하거나 세션을 다시 시작해야 합니다. @@ -726,8 +726,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: + 도구 실행 파일 경로를 찾을 수 없습니다. {0}이(가) 경로에 추가되었는지 확인하세요. +Bash를 사용하는 경우 다음 명령을 실행하여 이 작업을 수행할 수 있습니다. cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -737,7 +737,7 @@ EOF Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. + .NET Core SDK를 방금 설치했기 때문에 설치한 도구를 실행하기 전에 터미널을 다시 열어야 합니다. @@ -748,8 +748,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: + 도구 실행 파일 경로를 찾을 수 없습니다. {0}이(가) 경로에 추가되었는지 확인하세요. +Bash를 사용하는 경우 다음 명령을 실행하여 이 작업을 수행할 수 있습니다. cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -759,21 +759,21 @@ EOF Failed to install tool {0}. A command with the same name already exists. - Failed to install tool {0}. A command with the same name already exists. + {0} 도구를 설치하지 못했습니다. 이름이 같은 명령이 이미 존재합니다. Failed to change permission: Error: {0} Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + 권한을 변경하지 못했습니다. +오류: {0} +출력: {1} Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. + .NET Core SDK를 방금 설치했기 때문에 설치한 도구를 실행하기 전에 명령 프롬프트 창을 다시 열어야 합니다. @@ -781,20 +781,20 @@ Output: {1} You can do this by running the following command: setx PATH "%PATH%;{1}" - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + 도구 실행 파일 경로를 찾을 수 없습니다. {0}이(가) 경로에 추가되었는지 확인하세요. +다음 명령을 실행하여 이 작업을 수행할 수 있습니다. setx PATH "%PATH%;{1}" Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {1}. + 패키지 '{0}'이(가) 누락된 진입점 파일 {1}입니다. Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + 패키지 '{0}'이(가) 누락된 도구 설정 파일 DotnetToolSettings.xml입니다. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf index 866502ed7..0ab1a6112 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf @@ -676,46 +676,46 @@ Cannot be null or whitespace. - Cannot be null or whitespace. + Nie może być wartością null ani białym znakiem. Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} + Zawiera co najmniej jeden niedozwolony znak: {0} The tool's settings file is invalid xml. {0} - The tool's settings file is invalid xml. + Plik ustawień narzędzia nie jest prawidłowym plikiem xml. {0} The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. + Plik ustawień narzędzia zawiera wartość modułu uruchamiającego inną niż „dotnet”. The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. + Plik ustawień narzędzia zawiera więcej niż jedno zdefiniowane polecenie. The tool's settings file contains error. {0} - The tool's settings file contains error. + Plik ustawień narzędzia zawiera błąd. {0} NuGet configuration file {0} does not exist. - NuGet configuration file {0} does not exist. + Plik konfiguracji pakietu NuGet {0} nie istnieje. Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. + Właśnie zainstalowano zestaw .NET Core SDK, dlatego należy wylogować się lub uruchomić ponownie sesję przed uruchomieniem zainstalowanego narzędzia. @@ -726,8 +726,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: + Nie można odnaleźć ścieżki do pliku wykonywalnego narzędzi. Upewnij się, że dodano wartość {0} do zmiennej środowiskowej PATH. +W powłoce bash można to zrobić, wykonując następujące polecenie: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -737,7 +737,7 @@ EOF Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. + Właśnie zainstalowano zestaw .NET Core SDK, dlatego należy ponownie otworzyć terminal przed uruchomieniem zainstalowanego narzędzia. @@ -748,8 +748,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: + Nie można odnaleźć ścieżki do pliku wykonywalnego narzędzi. Upewnij się, że dodano wartość {0} do zmiennej środowiskowej PATH. +W powłoce bash można to zrobić, wykonując następujące polecenie: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -759,21 +759,21 @@ EOF Failed to install tool {0}. A command with the same name already exists. - Failed to install tool {0}. A command with the same name already exists. + Nie można zainstalować narzędzia {0}. Polecenie o tej samej nazwie już istnieje. Failed to change permission: Error: {0} Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + Nie można zmienić uprawnienia: +Błąd: {0} +Dane wyjściowe: {1} Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. + Właśnie zainstalowano zestaw .NET Core SDK, dlatego należy ponownie otworzyć okno wiersza polecenia przed uruchomieniem zainstalowanego narzędzia. @@ -781,20 +781,20 @@ Output: {1} You can do this by running the following command: setx PATH "%PATH%;{1}" - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + Nie można odnaleźć ścieżki do pliku wykonywalnego narzędzi. Upewnij się, że dodano wartość {0} do zmiennej środowiskowej PATH. +Można to zrobić, uruchamiając następujące polecenie: setx PATH "%PATH%;{1}" Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {1}. + Brak pliku punktu wejściowego {1} w pakiecie „{0}”. Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + Brak pliku ustawień narzędzia DotnetToolSettings.xml w pakiecie „{0}”. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf b/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf index d6590ff13..a2cda2332 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf @@ -676,46 +676,46 @@ Cannot be null or whitespace. - Cannot be null or whitespace. + Não pode ser nulo nem espaço em branco. Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} + Contém um ou mais caracteres inválidos: {0} The tool's settings file is invalid xml. {0} - The tool's settings file is invalid xml. + O arquivo de configuração da ferramenta é um XML inválido. {0} The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. + O arquivo de configuração da ferramenta contém um executor não "dotnet". The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. + O arquivo de configuração da ferramenta contém mais de um comando definido. The tool's settings file contains error. {0} - The tool's settings file contains error. + O arquivo de configuração da ferramenta contém um erro. {0} NuGet configuration file {0} does not exist. - NuGet configuration file {0} does not exist. + O arquivo de configuração {0} do NuGet não existe. Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. + Já que você acabou de instalar o SDK do .NET Core, você ainda precisará fazer logoff ou reiniciar a sessão antes de executar a ferramenta instalada. @@ -726,8 +726,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: + Não é possível encontrar o caminho do executável da ferramenta. Verifique se {0} foi adicionado ao PATH. +Se estiver usando o Bash, faça isso executando o seguinte comando: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -737,7 +737,7 @@ EOF Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. + Já que você acabou de instalar o SDK do .NET Core, você ainda precisará reabrir o terminal antes de executar a ferramenta instalada. @@ -748,8 +748,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: + Não é possível encontrar o caminho do executável da ferramenta. Verifique se {0} foi adicionado ao PATH. +Se estiver usando o Bash, faça isso executando o seguinte comando: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -759,21 +759,21 @@ EOF Failed to install tool {0}. A command with the same name already exists. - Failed to install tool {0}. A command with the same name already exists. + Falha ao instalar a ferramenta {0}. Já existe um comando com o mesmo nome. Failed to change permission: Error: {0} Output: {1} - Failed to change permission: + Falha ao alterar permissão: Error: {0} Output: {1} Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. + Já que você acabou de instalar o SDK do .NET Core, você ainda precisará reabrir a janela do Prompt de Comando antes de executar a ferramenta instalada. @@ -781,20 +781,20 @@ Output: {1} You can do this by running the following command: setx PATH "%PATH%;{1}" - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + Não é possível encontrar o caminho do executável da ferramenta. Verifique se {0} foi adicionado ao PATH. +Faça isso executando o seguinte comando: setx PATH "%PATH%;{1}" Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {1}. + O arquivo de ponto de entrada {1} está ausente do pacote '{0}'. Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + O arquivo de configuração DotnetToolSettings.xml da ferramenta está ausente do pacote '{0}'. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf index 0c8083046..117daa0dc 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf @@ -676,46 +676,46 @@ Cannot be null or whitespace. - Cannot be null or whitespace. + Не может быть пустым или равным NULL. Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} + Содержит недопустимые символы: {0} The tool's settings file is invalid xml. {0} - The tool's settings file is invalid xml. + Файл параметров инструмента является недопустимым XML. {0} The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. + Средство запуска в файле параметров инструмента не является "dotnet". 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. + Файл конфигурации NuGet {0} не существует. Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. + Так как вы только что установили пакет SDK для .NET Core, перед его запуском нужно выйти из системы или перезапустить сеанс. @@ -726,8 +726,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: + Не удается найти путь к исполняемому файлу инструмента. Проверьте, что PATH содержит {0}. +Если вы используете Bash, выполните для этого следующую команду: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -737,7 +737,7 @@ EOF Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. + Так как вы только что установили пакет SDK для .NET Core, перед его запуском нужно заново открыть терминал. @@ -748,8 +748,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: + Не удается найти путь к исполняемому файлу инструмента. Проверьте, что PATH содержит {0}. +Если вы используете Bash, выполните для этого следующую команду: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -759,21 +759,21 @@ EOF Failed to install tool {0}. A command with the same name already exists. - Failed to install tool {0}. A command with the same name already exists. + Не удалось установить инструмент {0}. Команда с таким именем уже существует. Failed to change permission: Error: {0} Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + Не удалось изменить разрешение: +Ошибка: {0} +Выходные данные: {1} Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. + Так как вы только что установили пакет SDK для .NET Core, перед его запуском нужно заново открыть окно командной строки. @@ -781,20 +781,20 @@ Output: {1} You can do this by running the following command: setx PATH "%PATH%;{1}" - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + Не удается найти путь к исполняемому файлу инструмента. Проверьте, что PATH содержит {0}. +Для этого выполните следующую команду: setx PATH "%PATH%;{1}" Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {1}. + В пакете "{0}" отсутствует файл точки входа {1}. Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + В пакете "{0}" отсутствует файл параметров инструмента DotnetToolSettings.xml. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf index f1ff54bfb..2110753b9 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf @@ -676,46 +676,46 @@ Cannot be null or whitespace. - Cannot be null or whitespace. + Null veya boşluk olamaz. Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} + Bir veya daha fazla geçersiz karakter içeriyor: {0} The tool's settings file is invalid xml. {0} - The tool's settings file is invalid xml. + Aracın ayarlar dosyası geçersiz xml içeriyor. {0} The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. + Aracın ayarlar dosyası çalıştırıcı olarak "dotnet" dışında bir öğe içeriyor. The tool's settings file has more than one command defined. - The tool's settings file has more than one command defined. + Aracın ayarlar dosyasında birden çok komut tanımlanmış. The tool's settings file contains error. {0} - The tool's settings file contains error. + Aracın ayarlar dosyası hata içeriyor. {0} NuGet configuration file {0} does not exist. - NuGet configuration file {0} does not exist. + NuGet yapılandırma dosyası {0} yok. Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. + .NET Core SDK’sını yüklediğinizden, yüklediğiniz aracı çalıştırmadan önce oturumunuzu kapatmanız veya oturumu yeniden başlatmanız gerekiyor. @@ -726,18 +726,18 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: + Aracın yürütülebilir yolu bulunamıyor. Lütfen {0} öğesinin PATH’e eklendiğinden emin olun. +Bash kullanıyorsanız, bunu şu komutu çalıştırarak gerçekleştirebilirsiniz: cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools +# .NET Core SDK araçlarını ekle export PATH="$PATH:{1}" EOF Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. + .NET Core SDK’sını yüklediğinizden, yüklediğiniz aracı çalıştırmadan önce terminali yeniden açmanız gerekiyor. @@ -748,32 +748,32 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: + Aracın yürütülebilir yolu bulunamıyor. Lütfen {0} öğesinin PATH’e eklendiğinden emin olun. +Bash kullanıyorsanız, bunu şu komutu çalıştırarak gerçekleştirebilirsiniz: cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools +# .NET Core SDK araçlarını ekle export PATH="$PATH:{1}" EOF Failed to install tool {0}. A command with the same name already exists. - Failed to install tool {0}. A command with the same name already exists. + {0} aracı yüklenemedi. Aynı ada sahip bir komut zaten var. Failed to change permission: Error: {0} Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + İzin değiştirilemedi: +Hata: {0} +Çıkış: {1} Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. + .NET Core SDK’sını yüklediğinizden, yüklediğiniz aracı çalıştırmadan önce Komut İstemi penceresini yeniden açmanız gerekiyor. @@ -781,20 +781,20 @@ Output: {1} You can do this by running the following command: setx PATH "%PATH%;{1}" - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + Aracın yürütülebilir yolu bulunamıyor. Lütfen {0} öğesinin PATH’e eklendiğinden emin olun. +Bunu şu komutu çalıştırarak gerçekleştirebilirsiniz: setx PATH "%PATH%;{1}" Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {1}. + '{0}' paketinde {1} giriş noktası dosyası eksik. Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + '{0}' paketinde DotnetToolSettings.xml araç ayarları dosyası eksik. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf index bbe34189e..8ab7b4bde 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf @@ -676,46 +676,46 @@ Cannot be null or whitespace. - Cannot be null or whitespace. + 不能为 NULL 或空白。 Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} + 包含一个或多个无效字符: {0} The tool's settings file is invalid xml. {0} - The tool's settings file is invalid xml. + 工具的设置文件为无效 xml。 {0} The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. + 工具的设置文件不具有作为运行程序的 "dotnet"。 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. + NuGet 配置文件 {0} 不存在。 Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. + 由于刚安装了 .NET Core SDK,因此在运行安装的工具之前,需要注销或重新启动会话。 @@ -726,8 +726,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: + 找不到工具可执行文件路径。请确保已将 {0} 添加到 PATH。 +如果使用 bash,可通过运行以下命令来执行此操作: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -737,7 +737,7 @@ EOF Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. + 由于刚安装了 .NET Core SDK,因此在运行安装的工具之前,需要重新打开终端。 @@ -748,8 +748,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: + 找不到工具可执行文件路径。请确保已将 {0} 添加到 PATH。 +如果使用 bash,可通过运行以下命令来执行此操作: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -759,21 +759,21 @@ EOF Failed to install tool {0}. A command with the same name already exists. - Failed to install tool {0}. A command with the same name already exists. + 未能安装工具 {0}。已存在同名的命令。 Failed to change permission: Error: {0} Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + 未能更改权限: +错误: {0} +输出: {1} Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. + 由于刚安装了 .NET Core SDK,因此在运行安装的工具之前,需要重新打开命令提示符窗口。 @@ -781,20 +781,20 @@ Output: {1} You can do this by running the following command: setx PATH "%PATH%;{1}" - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + 找不到工具可执行文件路径。请确保已将 {0} 添加到 PATH。 +可通过运行以下命令来执行此操作: setx PATH "%PATH%;{1}" Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {1}. + 包“{0}”缺少入口点文件 {1}。 Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + 包“{0}”缺少工具设置文件 DotnetToolSettings.xml。 diff --git a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf index 314f986c0..1d883fc37 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf @@ -676,46 +676,46 @@ Cannot be null or whitespace. - Cannot be null or whitespace. + 不得為 null 或空白字元。 Contains one or more invalid characters: {0} - Contains one or more invalid characters: {0} + 內含一或多個無效字元: {0} The tool's settings file is invalid xml. {0} - The tool's settings file is invalid xml. + 工具設定檔為無效的 XML。 {0} The tool's settings file has non "dotnet" as runner. - The tool's settings file has non "dotnet" as runner. + 工具設定檔的執行器並非 "dotnet"。 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. + NuGet 組態檔 {0} 不存在。 Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. + 因為您剛才安裝了 .NET Core SDK,您必須先登出或重新啟動,才能執行您安裝的工具。 @@ -726,8 +726,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: + 找不到工具的可執行路徑。請確定已將 {0} 新增到您的 PATH。 +如果您正在使用 Bash,可執行下列命令以完成上述動作: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -737,7 +737,7 @@ EOF Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. + 因為您剛才安裝了 .NET Core SDK,您必須先重新開啟終端機,才能執行您安裝的工具。 @@ -748,8 +748,8 @@ cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools export PATH="$PATH:{1}" EOF - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: + 找不到工具的可執行路徑。請確定已將 {0} 新增到您的 PATH。 +如果您正在使用 Bash,可執行下列命令以完成上述動作: cat << EOF >> ~/.bash_profile # Add .NET Core SDK tools @@ -759,21 +759,21 @@ EOF Failed to install tool {0}. A command with the same name already exists. - Failed to install tool {0}. A command with the same name already exists. + 無法安裝工具 {0}。相同名稱的命令已經存在。 Failed to change permission: Error: {0} Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + 無法變更權限: +錯誤: {0} +輸出: {1} Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. + 因為您剛才安裝了 .NET Core SDK,您必須先重新開啟 [命令提示字元] 視窗,才能執行您安裝的工具。 @@ -781,20 +781,20 @@ Output: {1} You can do this by running the following command: setx PATH "%PATH%;{1}" - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + 找不到工具的可執行路徑。請確定已將 {0} 新增到您的 PATH。 +您可執行下列命令以完成上述動作: setx PATH "%PATH%;{1}" Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {1}. + 套件 '{0}' 缺少進入點檔案 {1}。 Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + 套件 '{0}' 缺少工具設定檔 DotnetToolSettings.xml。 From 52c2f25e67c35d8f56373a830a4583146eef8ece Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 5 Feb 2018 10:28:44 -0800 Subject: [PATCH 024/103] Add Microsoft.NET.Sdk.Razor to the CLI --- build/BundledSdks.props | 1 + build/DependencyVersions.props | 1 + build/sdks/sdks.csproj | 1 + 3 files changed, 3 insertions(+) diff --git a/build/BundledSdks.props b/build/BundledSdks.props index d665ef7f3..e7dde28e6 100644 --- a/build/BundledSdks.props +++ b/build/BundledSdks.props @@ -2,6 +2,7 @@ + diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 2031e8b26..2109d968f 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -16,6 +16,7 @@ $(MicrosoftCodeAnalysisCSharpPackageVersion) 2.1.300-preview2-62530-05 $(MicrosoftNETSdkPackageVersion) + 2.1.0-preview2-30028 2.1.0-release21-20180126-1326543 $(MicrosoftNETSdkWebPackageVersion) $(MicrosoftNETSdkWebPackageVersion) diff --git a/build/sdks/sdks.csproj b/build/sdks/sdks.csproj index 496599e4f..2f9a7bb65 100755 --- a/build/sdks/sdks.csproj +++ b/build/sdks/sdks.csproj @@ -10,6 +10,7 @@ + From c9cfa933c8b7180907d56c9893591dbdf96c468d Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Mon, 5 Feb 2018 15:57:49 -0800 Subject: [PATCH 025/103] Reverting the channel and branchname to master. --- build/BranchInfo.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/BranchInfo.props b/build/BranchInfo.props index 0879a9028..f62c8fd00 100644 --- a/build/BranchInfo.props +++ b/build/BranchInfo.props @@ -1,6 +1,6 @@ - release/2.1 - release/2.1.3xx + master + master From 9c72bbd74bcd1d36a47c27b0e2ef872ab939202e Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Mon, 5 Feb 2018 16:52:03 -0800 Subject: [PATCH 026/103] Update Microsoft.DotNet.Archive version. This commit updates Microsoft.DotNet.Archive version number to include a fix for #8288. --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 2109d968f..f57f1a263 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -33,7 +33,7 @@ 0.1.1-alpha-174 1.2.1-alpha-002133 $(MicrosoftDotNetProjectJsonMigrationPackageVersion) - 0.2.0-beta-000059 + 0.2.0-beta-62606-02 1.6.0-beta2-25304 4.7.0-preview1-4846 $(NuGetBuildTasksPackageVersion) From 5fa558a2ed60104d8e21434b99ee757135d5aadb Mon Sep 17 00:00:00 2001 From: William Lee Date: Tue, 6 Feb 2018 13:38:06 -0800 Subject: [PATCH 027/103] Atomic install tool (#8518) * Make dotnet install tool atomic Apply TransactionScope to tool install. It can handle the correct timing of roll back and commit. Convert existing ToolPackageObtainer and ShellShimMaker by passing logic via lambda to an object that has IEnlistmentNotification interface. It turns out the very clean. Use .stage as staging place to verify of package content, and shim. It should roll back when something is wrong. When there is ctrl-c, there will be garbage in .stage folder but not the root of the package folder. --- .../DirectoryWrapper.cs | 5 + .../FileWrapper.cs | 5 + .../IDirectory.cs | 2 + .../IFile.cs | 2 + src/dotnet/CommonLocalizableStrings.resx | 5 +- src/dotnet/ShellShim/CreateShimTransaction.cs | 52 ++++ src/dotnet/ShellShim/ShellShimMaker.cs | 62 ++++- .../ToolPackageObtainTransaction.cs | 52 ++++ src/dotnet/ToolPackage/ToolPackageObtainer.cs | 111 ++++++-- .../dotnet-install-tool/InstallToolCommand.cs | 68 ++--- .../xlf/CommonLocalizableStrings.cs.xlf | 5 + .../xlf/CommonLocalizableStrings.de.xlf | 5 + .../xlf/CommonLocalizableStrings.es.xlf | 5 + .../xlf/CommonLocalizableStrings.fr.xlf | 5 + .../xlf/CommonLocalizableStrings.it.xlf | 5 + .../xlf/CommonLocalizableStrings.ja.xlf | 5 + .../xlf/CommonLocalizableStrings.ko.xlf | 5 + .../xlf/CommonLocalizableStrings.pl.xlf | 5 + .../xlf/CommonLocalizableStrings.pt-BR.xlf | 5 + .../xlf/CommonLocalizableStrings.ru.xlf | 5 + .../xlf/CommonLocalizableStrings.tr.xlf | 5 + .../xlf/CommonLocalizableStrings.zh-Hans.xlf | 5 + .../xlf/CommonLocalizableStrings.zh-Hant.xlf | 5 + .../GivenAFirstTimeUseNoticeSentinel.cs | 7 +- ...nAFunctionReturnStringAndFakeFileSystem.cs | 10 + .../GivenANuGetCacheSentinel.cs | 10 + .../FakeFile.cs | 5 + .../ShellShimMakerTests.cs | 164 +++++++++-- .../ToolPackageObtainerTests.cs | 263 ++++++++++++++---- .../ShellShimMakerMock.cs | 64 ++++- .../ToolPackageObtainerMock.cs | 142 +++++++--- .../Mock/FileSystemMockBuilder.cs | 26 ++ .../InstallToolCommandTests.cs | 82 ++++-- 33 files changed, 995 insertions(+), 207 deletions(-) create mode 100644 src/dotnet/ShellShim/CreateShimTransaction.cs create mode 100644 src/dotnet/ToolPackage/ToolPackageObtainTransaction.cs diff --git a/src/Microsoft.DotNet.InternalAbstractions/DirectoryWrapper.cs b/src/Microsoft.DotNet.InternalAbstractions/DirectoryWrapper.cs index d0c26bd70..1e0371cad 100644 --- a/src/Microsoft.DotNet.InternalAbstractions/DirectoryWrapper.cs +++ b/src/Microsoft.DotNet.InternalAbstractions/DirectoryWrapper.cs @@ -47,5 +47,10 @@ namespace Microsoft.Extensions.EnvironmentAbstractions { Directory.CreateDirectory(path); } + + public void Delete(string path, bool recursive) + { + Directory.Delete(path, recursive); + } } } diff --git a/src/Microsoft.DotNet.InternalAbstractions/FileWrapper.cs b/src/Microsoft.DotNet.InternalAbstractions/FileWrapper.cs index 385c2deb8..c134cca0a 100644 --- a/src/Microsoft.DotNet.InternalAbstractions/FileWrapper.cs +++ b/src/Microsoft.DotNet.InternalAbstractions/FileWrapper.cs @@ -45,5 +45,10 @@ namespace Microsoft.Extensions.EnvironmentAbstractions { File.WriteAllText(path, content); } + + public void Delete(string path) + { + File.Delete(path); + } } } diff --git a/src/Microsoft.DotNet.InternalAbstractions/IDirectory.cs b/src/Microsoft.DotNet.InternalAbstractions/IDirectory.cs index 8590bab5a..c92db0160 100644 --- a/src/Microsoft.DotNet.InternalAbstractions/IDirectory.cs +++ b/src/Microsoft.DotNet.InternalAbstractions/IDirectory.cs @@ -16,5 +16,7 @@ namespace Microsoft.Extensions.EnvironmentAbstractions string GetDirectoryFullName(string path); void CreateDirectory(string path); + + void Delete(string path, bool recursive); } } diff --git a/src/Microsoft.DotNet.InternalAbstractions/IFile.cs b/src/Microsoft.DotNet.InternalAbstractions/IFile.cs index 1feb4b481..39b43312a 100644 --- a/src/Microsoft.DotNet.InternalAbstractions/IFile.cs +++ b/src/Microsoft.DotNet.InternalAbstractions/IFile.cs @@ -24,5 +24,7 @@ namespace Microsoft.Extensions.EnvironmentAbstractions void CreateEmptyFile(string path); void WriteAllText(string path, string content); + + void Delete(string path); } } diff --git a/src/dotnet/CommonLocalizableStrings.resx b/src/dotnet/CommonLocalizableStrings.resx index 7a5b6d6f1..46c5fbd23 100644 --- a/src/dotnet/CommonLocalizableStrings.resx +++ b/src/dotnet/CommonLocalizableStrings.resx @@ -588,4 +588,7 @@ Output: {1} Package '{0}' is missing tool settings file DotnetToolSettings.xml. - \ No newline at end of file + + Tool '{0}' is already installed. + + diff --git a/src/dotnet/ShellShim/CreateShimTransaction.cs b/src/dotnet/ShellShim/CreateShimTransaction.cs new file mode 100644 index 000000000..f071c78a5 --- /dev/null +++ b/src/dotnet/ShellShim/CreateShimTransaction.cs @@ -0,0 +1,52 @@ +// 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 System.Collections.Generic; +using System.Transactions; +using Microsoft.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.ShellShim +{ + internal class CreateShimTransaction : IEnlistmentNotification + { + private readonly Action> _createShim; + private readonly Action> _rollback; + private List _locationOfShimDuringTransaction = new List(); + + public CreateShimTransaction( + Action> createShim, + Action> rollback) + { + _createShim = createShim ?? throw new ArgumentNullException(nameof(createShim)); + _rollback = rollback ?? throw new ArgumentNullException(nameof(rollback)); + } + + public void CreateShim() + { + _createShim(_locationOfShimDuringTransaction); + } + + public void Commit(Enlistment enlistment) + { + enlistment.Done(); + } + + public void InDoubt(Enlistment enlistment) + { + Rollback(enlistment); + } + + public void Prepare(PreparingEnlistment preparingEnlistment) + { + preparingEnlistment.Done(); + } + + public void Rollback(Enlistment enlistment) + { + _rollback(_locationOfShimDuringTransaction); + + enlistment.Done(); + } + } +} diff --git a/src/dotnet/ShellShim/ShellShimMaker.cs b/src/dotnet/ShellShim/ShellShimMaker.cs index 41c21537a..dbe95371e 100644 --- a/src/dotnet/ShellShim/ShellShimMaker.cs +++ b/src/dotnet/ShellShim/ShellShimMaker.cs @@ -2,10 +2,12 @@ // 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 System.Runtime.InteropServices; using System.Text; +using System.Transactions; using System.Xml.Linq; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Tools; @@ -22,11 +24,38 @@ namespace Microsoft.DotNet.ShellShim public ShellShimMaker(string pathToPlaceShim) { - _pathToPlaceShim = - pathToPlaceShim ?? throw new ArgumentNullException(nameof(pathToPlaceShim)); + _pathToPlaceShim = pathToPlaceShim ?? throw new ArgumentNullException(nameof(pathToPlaceShim)); } public void CreateShim(FilePath packageExecutable, string shellCommandName) + { + var createShimTransaction = new CreateShimTransaction( + createShim: locationOfShimDuringTransaction => + { + EnsureCommandNameUniqueness(shellCommandName); + PlaceShim(packageExecutable, shellCommandName, locationOfShimDuringTransaction); + }, + rollback: locationOfShimDuringTransaction => + { + foreach (FilePath f in locationOfShimDuringTransaction) + { + if (File.Exists(f.Value)) + { + File.Delete(f.Value); + } + } + }); + + using (var transactionScope = new TransactionScope()) + { + Transaction.Current.EnlistVolatile(createShimTransaction, EnlistmentOptions.None); + createShimTransaction.CreateShim(); + + transactionScope.Complete(); + } + } + + private void PlaceShim(FilePath packageExecutable, string shellCommandName, List locationOfShimDuringTransaction) { FilePath shimPath = GetShimPath(shellCommandName); @@ -37,12 +66,20 @@ namespace Microsoft.DotNet.ShellShim if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - CreateConfigFile(shimPath.Value + ".config", entryPoint: packageExecutable, runner: "dotnet"); + FilePath windowsConfig = GetWindowsConfigPath(shellCommandName); + CreateConfigFile( + windowsConfig, + entryPoint: packageExecutable, + runner: "dotnet"); + + locationOfShimDuringTransaction.Add(windowsConfig); + using (var shim = File.Create(shimPath.Value)) using (var exe = typeof(ShellShimMaker).Assembly.GetManifestResourceStream(LauncherExeResourceName)) { exe.CopyTo(shim); } + locationOfShimDuringTransaction.Add(shimPath); } else { @@ -51,6 +88,7 @@ namespace Microsoft.DotNet.ShellShim script.AppendLine($"dotnet {packageExecutable.ToQuotedString()} \"$@\""); File.WriteAllText(shimPath.Value, script.ToString()); + locationOfShimDuringTransaction.Add(shimPath); SetUserExecutionPermissionToShimFile(shimPath); } @@ -58,7 +96,7 @@ namespace Microsoft.DotNet.ShellShim public void EnsureCommandNameUniqueness(string shellCommandName) { - if (File.Exists(Path.Combine(_pathToPlaceShim, shellCommandName))) + if (File.Exists(GetShimPath(shellCommandName).Value)) { throw new GracefulException( string.Format(CommonLocalizableStrings.FailInstallToolSameName, @@ -66,10 +104,10 @@ namespace Microsoft.DotNet.ShellShim } } - internal void CreateConfigFile(string outputPath, FilePath entryPoint, string runner) + internal void CreateConfigFile(FilePath outputPath, FilePath entryPoint, string runner) { XDocument config; - using (var resource = typeof(ShellShimMaker).Assembly.GetManifestResourceStream(LauncherConfigResourceName)) + using(var resource = typeof(ShellShimMaker).Assembly.GetManifestResourceStream(LauncherConfigResourceName)) { config = XDocument.Load(resource); } @@ -77,11 +115,16 @@ namespace Microsoft.DotNet.ShellShim var appSettings = config.Descendants("appSettings").First(); appSettings.Add(new XElement("add", new XAttribute("key", "entryPoint"), new XAttribute("value", entryPoint.Value))); appSettings.Add(new XElement("add", new XAttribute("key", "runner"), new XAttribute("value", runner ?? string.Empty))); - config.Save(outputPath); + config.Save(outputPath.Value); } public void Remove(string shellCommandName) { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + File.Delete(GetWindowsConfigPath(shellCommandName).Value); + } + File.Delete(GetShimPath(shellCommandName).Value); } @@ -96,6 +139,11 @@ namespace Microsoft.DotNet.ShellShim return new FilePath(scriptPath); } + private FilePath GetWindowsConfigPath(string shellCommandName) + { + return new FilePath(GetShimPath(shellCommandName).Value + ".config"); + } + private static void SetUserExecutionPermissionToShimFile(FilePath scriptPath) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) diff --git a/src/dotnet/ToolPackage/ToolPackageObtainTransaction.cs b/src/dotnet/ToolPackage/ToolPackageObtainTransaction.cs new file mode 100644 index 000000000..3a161669e --- /dev/null +++ b/src/dotnet/ToolPackage/ToolPackageObtainTransaction.cs @@ -0,0 +1,52 @@ +// 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 System.Collections.Generic; +using System.Transactions; +using Microsoft.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.ToolPackage +{ + internal class ToolPackageObtainTransaction : IEnlistmentNotification + { + private readonly Func, ToolConfigurationAndExecutablePath> _obtainAndReturnExecutablePath; + private readonly Action> _rollback; + private List _locationOfPackageDuringTransaction = new List(); + + public ToolPackageObtainTransaction( + Func, ToolConfigurationAndExecutablePath> obtainAndReturnExecutablePath, + Action> rollback) + { + _obtainAndReturnExecutablePath = obtainAndReturnExecutablePath ?? throw new ArgumentNullException(nameof(obtainAndReturnExecutablePath)); + _rollback = rollback ?? throw new ArgumentNullException(nameof(rollback)); + } + + public ToolConfigurationAndExecutablePath ObtainAndReturnExecutablePath() + { + return _obtainAndReturnExecutablePath(_locationOfPackageDuringTransaction); + } + + public void Commit(Enlistment enlistment) + { + enlistment.Done(); + } + + public void InDoubt(Enlistment enlistment) + { + Rollback(enlistment); + } + + public void Prepare(PreparingEnlistment preparingEnlistment) + { + preparingEnlistment.Done(); + } + + public void Rollback(Enlistment enlistment) + { + _rollback(_locationOfPackageDuringTransaction); + + enlistment.Done(); + } + } +} diff --git a/src/dotnet/ToolPackage/ToolPackageObtainer.cs b/src/dotnet/ToolPackage/ToolPackageObtainer.cs index bd44fc1c4..ae78b94f4 100644 --- a/src/dotnet/ToolPackage/ToolPackageObtainer.cs +++ b/src/dotnet/ToolPackage/ToolPackageObtainer.cs @@ -1,12 +1,11 @@ using System; -using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; +using System.Transactions; using System.Xml.Linq; -using Microsoft.DotNet.Tools; +using Microsoft.DotNet.Cli; using Microsoft.DotNet.Cli.Utils; -using Microsoft.DotNet.Configurer; +using Microsoft.DotNet.Tools; using Microsoft.Extensions.EnvironmentAbstractions; using NuGet.ProjectModel; @@ -42,6 +41,69 @@ namespace Microsoft.DotNet.ToolPackage string targetframework = null, string source = null, string verbosity = null) + { + var stageDirectory = _toolsPath.WithSubDirectories(".stage", Path.GetRandomFileName()); + + var toolPackageObtainTransaction = new ToolPackageObtainTransaction( + obtainAndReturnExecutablePath: (locationOfPackageDuringTransaction) => + { + if (Directory.Exists(_toolsPath.WithSubDirectories(packageId).Value)) + { + throw new PackageObtainException( + string.Format(CommonLocalizableStrings.ToolPackageConflictPackageId, packageId)); + } + + locationOfPackageDuringTransaction.Add(stageDirectory); + var toolConfigurationAndExecutablePath = ObtainAndReturnExecutablePathInStageFolder( + packageId, + stageDirectory, + packageVersion, + nugetconfig, + targetframework, + source, + verbosity); + + DirectoryPath destinationDirectory = _toolsPath.WithSubDirectories(packageId); + + Directory.Move( + stageDirectory.Value, + destinationDirectory.Value); + + locationOfPackageDuringTransaction.Clear(); + locationOfPackageDuringTransaction.Add(destinationDirectory); + + return toolConfigurationAndExecutablePath; + }, + rollback: (locationOfPackageDuringTransaction) => + { + foreach (DirectoryPath l in locationOfPackageDuringTransaction) + { + if (Directory.Exists(l.Value)) + { + Directory.Delete(l.Value, recursive: true); + } + } + } + ); + + using (var transactionScope = new TransactionScope()) + { + Transaction.Current.EnlistVolatile(toolPackageObtainTransaction, EnlistmentOptions.None); + var toolConfigurationAndExecutablePath = toolPackageObtainTransaction.ObtainAndReturnExecutablePath(); + + transactionScope.Complete(); + return toolConfigurationAndExecutablePath; + } + } + + private ToolConfigurationAndExecutablePath ObtainAndReturnExecutablePathInStageFolder( + string packageId, + DirectoryPath stageDirectory, + string packageVersion = null, + FilePath? nugetconfig = null, + string targetframework = null, + string source = null, + string verbosity = null) { if (packageId == null) { @@ -65,34 +127,34 @@ namespace Microsoft.DotNet.ToolPackage var packageVersionOrPlaceHolder = new PackageVersion(packageVersion); - DirectoryPath toolDirectory = - CreateIndividualToolVersionDirectory(packageId, packageVersionOrPlaceHolder); + DirectoryPath nugetSandboxDirectory = + CreateNugetSandboxDirectory(packageVersionOrPlaceHolder, stageDirectory); FilePath tempProjectPath = CreateTempProject( packageId, packageVersionOrPlaceHolder, targetframework, - toolDirectory); + nugetSandboxDirectory); - _projectRestorer.Restore(tempProjectPath, toolDirectory, nugetconfig, source, verbosity); + _projectRestorer.Restore(tempProjectPath, nugetSandboxDirectory, nugetconfig, source, verbosity); if (packageVersionOrPlaceHolder.IsPlaceholder) { var concreteVersion = new DirectoryInfo( Directory.GetDirectories( - toolDirectory.WithSubDirectories(packageId).Value).Single()).Name; + nugetSandboxDirectory.WithSubDirectories(packageId).Value).Single()).Name; DirectoryPath versioned = - toolDirectory.GetParentPath().WithSubDirectories(concreteVersion); + nugetSandboxDirectory.GetParentPath().WithSubDirectories(concreteVersion); - MoveToVersionedDirectory(versioned, toolDirectory); + MoveToVersionedDirectory(versioned, nugetSandboxDirectory); - toolDirectory = versioned; + nugetSandboxDirectory = versioned; packageVersion = concreteVersion; } LockFile lockFile = new LockFileFormat() - .ReadWithLock(toolDirectory.WithFile("project.assets.json").Value) + .ReadWithLock(nugetSandboxDirectory.WithFile("project.assets.json").Value) .Result; LockFileItem dotnetToolSettings = FindAssetInLockFile(lockFile, "DotnetToolSettings.xml", packageId); @@ -104,7 +166,7 @@ namespace Microsoft.DotNet.ToolPackage } FilePath toolConfigurationPath = - toolDirectory + nugetSandboxDirectory .WithSubDirectories(packageId, packageVersion) .WithFile(dotnetToolSettings.Path); @@ -122,7 +184,9 @@ namespace Microsoft.DotNet.ToolPackage return new ToolConfigurationAndExecutablePath( toolConfiguration, - toolDirectory.WithSubDirectories( + _toolsPath.WithSubDirectories( + packageId, + packageVersion, packageId, packageVersion) .WithFile(entryPointFromLockFile.Path)); @@ -179,12 +243,13 @@ namespace Microsoft.DotNet.ToolPackage new XElement("RestoreAdditionalProjectFallbackFolders", string.Empty), // block other new XElement("RestoreAdditionalProjectFallbackFoldersExcludes", string.Empty), // block other new XElement("DisableImplicitNuGetFallbackFolder", "true")), // disable SDK side implicit NuGetFallbackFolder - new XElement("ItemGroup", + new XElement("ItemGroup", new XElement("PackageReference", new XAttribute("Include", packageId), new XAttribute("Version", packageVersion.IsConcreteValue ? packageVersion.Value : "*") // nuget will restore * for latest - )) - )); + )) + )); + File.WriteAllText(tempProjectPath.Value, tempProjectContent.ToString()); @@ -192,12 +257,12 @@ namespace Microsoft.DotNet.ToolPackage return tempProjectPath; } - private DirectoryPath CreateIndividualToolVersionDirectory( - string packageId, - PackageVersion packageVersion) + private DirectoryPath CreateNugetSandboxDirectory( + PackageVersion packageVersion, + DirectoryPath stageDirectory + ) { - DirectoryPath individualTool = _toolsPath.WithSubDirectories(packageId); - DirectoryPath individualToolVersion = individualTool.WithSubDirectories(packageVersion.Value); + DirectoryPath individualToolVersion = stageDirectory.WithSubDirectories(packageVersion.Value); EnsureDirectoryExists(individualToolVersion); return individualToolVersion; } 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 d19fc880c..0001d460c 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Transactions; using Microsoft.DotNet.Cli; using Microsoft.DotNet.Cli.CommandLine; using Microsoft.DotNet.Cli.Utils; @@ -21,6 +22,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool private readonly IEnvironmentPathInstruction _environmentPathInstruction; private readonly IShellShimMaker _shellShimMaker; private readonly IReporter _reporter; + private readonly IReporter _errorReporter; private readonly string _packageId; private readonly string _packageVersion; @@ -69,13 +71,12 @@ namespace Microsoft.DotNet.Tools.Install.Tool _shellShimMaker = shellShimMaker ?? new ShellShimMaker(cliFolderPathCalculator.ToolsShimPath); - _reporter = reporter; + _reporter = (reporter ?? Reporter.Output); + _errorReporter = (reporter ?? Reporter.Error); } public override int Execute() { - var reporter = (_reporter ?? Reporter.Output); - var errorReporter = (_reporter ?? Reporter.Error); if (!_global) { throw new GracefulException(LocalizableStrings.InstallToolCommandOnlySupportGlobal); @@ -83,54 +84,53 @@ namespace Microsoft.DotNet.Tools.Install.Tool try { - var toolConfigurationAndExecutablePath = ObtainPackage(); + FilePath? configFile = null; + if (_configFilePath != null) + { + configFile = new FilePath(_configFilePath); + } - var commandName = toolConfigurationAndExecutablePath.Configuration.CommandName; - _shellShimMaker.EnsureCommandNameUniqueness(commandName); + using (var transactionScope = new TransactionScope()) + { + var toolConfigurationAndExecutablePath = _toolPackageObtainer.ObtainAndReturnExecutablePath( + packageId: _packageId, + packageVersion: _packageVersion, + nugetconfig: configFile, + targetframework: _framework, + source: _source, + verbosity: _verbosity); - _shellShimMaker.CreateShim( - toolConfigurationAndExecutablePath.Executable, - commandName); + var commandName = toolConfigurationAndExecutablePath.Configuration.CommandName; - _environmentPathInstruction - .PrintAddPathInstructionIfPathDoesNotExist(); + _shellShimMaker.CreateShim( + toolConfigurationAndExecutablePath.Executable, + commandName); - reporter.WriteLine( - string.Format(LocalizableStrings.InstallationSucceeded, commandName)); + _environmentPathInstruction + .PrintAddPathInstructionIfPathDoesNotExist(); + + _reporter.WriteLine( + string.Format(LocalizableStrings.InstallationSucceeded, commandName)); + transactionScope.Complete(); + } } catch (PackageObtainException ex) { - errorReporter.WriteLine(ex.Message.Red()); - errorReporter.WriteLine(string.Format(LocalizableStrings.ToolInstallationFailed, _packageId).Red()); + _errorReporter.WriteLine(ex.Message.Red()); + _errorReporter.WriteLine(string.Format(LocalizableStrings.ToolInstallationFailed, _packageId).Red()); return 1; } catch (ToolConfigurationException ex) { - errorReporter.WriteLine( + _errorReporter.WriteLine( string.Format( LocalizableStrings.InvalidToolConfiguration, ex.Message).Red()); - errorReporter.WriteLine(string.Format(LocalizableStrings.ToolInstallationFailedContactAuthor, _packageId).Red()); + _errorReporter.WriteLine(string.Format(LocalizableStrings.ToolInstallationFailedContactAuthor, _packageId).Red()); return 1; } + return 0; } - - private ToolConfigurationAndExecutablePath ObtainPackage() - { - FilePath? configFile = null; - if (_configFilePath != null) - { - configFile = new FilePath(_configFilePath); - } - - return _toolPackageObtainer.ObtainAndReturnExecutablePath( - packageId: _packageId, - packageVersion: _packageVersion, - nugetconfig: configFile, - targetframework: _framework, - source: _source, - verbosity: _verbosity); - } } } diff --git a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf index 2d90f2248..655006da7 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf @@ -793,6 +793,11 @@ setx PATH "%PATH%;{1}" Command '{0}' uses unsupported runner '{1}'." + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf index 31bfc8bde..dc60294ad 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf @@ -793,6 +793,11 @@ setx PATH "%PATH%;{1}" Command '{0}' uses unsupported runner '{1}'." + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf index 55c0b6fed..9605d488e 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf @@ -793,6 +793,11 @@ setx PATH "%PATH%;{1}" Command '{0}' uses unsupported runner '{1}'." + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf index 591b4ec9a..ad41d6871 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf @@ -793,6 +793,11 @@ setx PATH "%PATH%;{1}" Command '{0}' uses unsupported runner '{1}'." + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf index 8d9df7d52..0f532bb34 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf @@ -793,6 +793,11 @@ setx PATH "%PATH%;{1}" Command '{0}' uses unsupported runner '{1}'." + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf index fb91a7f53..ed4d96744 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf @@ -793,6 +793,11 @@ setx PATH "%PATH%;{1}" Command '{0}' uses unsupported runner '{1}'." + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf index 828dd3b03..abcf00315 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf @@ -793,6 +793,11 @@ setx PATH "%PATH%;{1}" Command '{0}' uses unsupported runner '{1}'." + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf index 71096bfac..9bc7447a1 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf @@ -793,6 +793,11 @@ setx PATH "%PATH%;{1}" Command '{0}' uses unsupported runner '{1}'." + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + \ 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 e1450289b..27607aefc 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf @@ -793,6 +793,11 @@ setx PATH "%PATH%;{1}" Command '{0}' uses unsupported runner '{1}'." + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf index 0198396fe..37e3e0e44 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf @@ -793,6 +793,11 @@ setx PATH "%PATH%;{1}" Command '{0}' uses unsupported runner '{1}'." + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf index 58096808a..3e568621f 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf @@ -793,6 +793,11 @@ setx PATH "%PATH%;{1}" Command '{0}' uses unsupported runner '{1}'." + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + \ 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 d950c2c9e..11ebb7efa 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf @@ -793,6 +793,11 @@ setx PATH "%PATH%;{1}" Command '{0}' uses unsupported runner '{1}'." + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + \ 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 3c81ce8ea..95e7e1bde 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf @@ -793,6 +793,11 @@ setx PATH "%PATH%;{1}" Command '{0}' uses unsupported runner '{1}'." + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + \ No newline at end of file diff --git a/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFirstTimeUseNoticeSentinel.cs b/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFirstTimeUseNoticeSentinel.cs index 0957b162d..19bba6c2b 100644 --- a/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFirstTimeUseNoticeSentinel.cs +++ b/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFirstTimeUseNoticeSentinel.cs @@ -170,6 +170,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests _directories.Add(path); CreateDirectoryInvoked = true; } + + public void Delete(string path, bool recursive) + { + throw new NotImplementedException(); + } } } -} \ No newline at end of file +} diff --git a/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFunctionReturnStringAndFakeFileSystem.cs b/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFunctionReturnStringAndFakeFileSystem.cs index 4dfaf9c9d..8062ecb07 100644 --- a/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFunctionReturnStringAndFakeFileSystem.cs +++ b/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFunctionReturnStringAndFakeFileSystem.cs @@ -124,6 +124,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests { throw new UnauthorizedAccessException(); } + + public void Delete(string path) + { + throw new UnauthorizedAccessException(); + } } private class NoPermissionDirectoryFake : IDirectory @@ -153,6 +158,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests { throw new UnauthorizedAccessException(); } + + public void Delete(string path, bool recursive) + { + throw new NotImplementedException(); + } } private class Counter diff --git a/test/Microsoft.DotNet.Configurer.UnitTests/GivenANuGetCacheSentinel.cs b/test/Microsoft.DotNet.Configurer.UnitTests/GivenANuGetCacheSentinel.cs index 23ae45c4a..36800bcd2 100644 --- a/test/Microsoft.DotNet.Configurer.UnitTests/GivenANuGetCacheSentinel.cs +++ b/test/Microsoft.DotNet.Configurer.UnitTests/GivenANuGetCacheSentinel.cs @@ -197,6 +197,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests { throw new UnauthorizedAccessException(); } + + public void Delete(string path, bool recursive) + { + throw new NotImplementedException(); + } } private class FileMock : IFile @@ -256,6 +261,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests { throw new NotImplementedException(); } + + public void Delete(string path) + { + throw new NotImplementedException(); + } } private class MockStream : MemoryStream diff --git a/test/Microsoft.DotNet.ShellShim.Tests/FakeFile.cs b/test/Microsoft.DotNet.ShellShim.Tests/FakeFile.cs index bb9d46d6d..f9d8d414d 100644 --- a/test/Microsoft.DotNet.ShellShim.Tests/FakeFile.cs +++ b/test/Microsoft.DotNet.ShellShim.Tests/FakeFile.cs @@ -50,6 +50,11 @@ namespace Microsoft.DotNet.ShellShim.Tests _files[path] = content; } + public void Delete(string path) + { + throw new NotImplementedException(); + } + public static FakeFile Empty => new FakeFile(new Dictionary()); } } diff --git a/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs b/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs index 6ff0b87f4..1d7fefa3a 100644 --- a/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs +++ b/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs @@ -6,12 +6,13 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices; +using System.Transactions; using System.Xml.Linq; using FluentAssertions; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.TestFramework; +using Microsoft.DotNet.ToolPackage; using Microsoft.DotNet.Tools.Test.Utilities; -using Microsoft.DotNet.Tools.Test.Utilities.Mock; using Microsoft.DotNet.Tools.Tests.ComponentMocks; using Microsoft.Extensions.EnvironmentAbstractions; using Xunit; @@ -38,15 +39,16 @@ namespace Microsoft.DotNet.ShellShim.Tests if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) return; - var shellShimMaker = new ShellShimMaker(TempRoot.Root); + var cleanFolderUnderTempRoot = GetNewCleanFolderUnderTempRoot(); + var shellShimMaker = new ShellShimMaker(cleanFolderUnderTempRoot); - var tmpFile = Path.Combine(TempRoot.Root, Path.GetRandomFileName()); + var tmpFile = new FilePath(Path.Combine(cleanFolderUnderTempRoot, Path.GetRandomFileName())); shellShimMaker.CreateConfigFile(tmpFile, entryPoint, runner); - new FileInfo(tmpFile).Should().Exist(); + new FileInfo(tmpFile.Value).Should().Exist(); - var generated = XDocument.Load(tmpFile); + var generated = XDocument.Load(tmpFile.Value); generated.Descendants("appSettings") .Descendants("add") @@ -61,13 +63,33 @@ namespace Microsoft.DotNet.ShellShim.Tests { var outputDll = MakeHelloWorldExecutableDll(); - var shellShimMaker = new ShellShimMaker(TempRoot.Root); + var cleanFolderUnderTempRoot = GetNewCleanFolderUnderTempRoot(); + var shellShimMaker = new ShellShimMaker(cleanFolderUnderTempRoot); var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); - shellShimMaker.CreateShim( - new FilePath(outputDll.FullName), - shellCommandName); - var stdOut = ExecuteInShell(shellCommandName); + shellShimMaker.CreateShim(outputDll, shellCommandName); + + var stdOut = ExecuteInShell(shellCommandName, cleanFolderUnderTempRoot); + + stdOut.Should().Contain("Hello World"); + } + + [Fact] + public void GivenAnExecutablePathItCanGenerateShimFileInTransaction() + { + var outputDll = MakeHelloWorldExecutableDll(); + + var cleanFolderUnderTempRoot = GetNewCleanFolderUnderTempRoot(); + var shellShimMaker = new ShellShimMaker(cleanFolderUnderTempRoot); + var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); + + using (var transactionScope = new TransactionScope()) + { + shellShimMaker.CreateShim(outputDll, shellCommandName); + transactionScope.Complete(); + } + + var stdOut = ExecuteInShell(shellCommandName, cleanFolderUnderTempRoot); stdOut.Should().Contain("Hello World"); } @@ -80,9 +102,8 @@ namespace Microsoft.DotNet.ShellShim.Tests var shellShimMaker = new ShellShimMaker(Path.Combine(TempRoot.Root, extraNonExistDirectory)); var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); - Action a = () => shellShimMaker.CreateShim( - new FilePath(outputDll.FullName), - shellCommandName); + Action a = () => shellShimMaker.CreateShim(outputDll, shellCommandName); + a.ShouldNotThrow(); } @@ -94,14 +115,13 @@ namespace Microsoft.DotNet.ShellShim.Tests { var outputDll = MakeHelloWorldExecutableDll(); - var shellShimMaker = new ShellShimMaker(TempRoot.Root); + var cleanFolderUnderTempRoot = GetNewCleanFolderUnderTempRoot(); + var shellShimMaker = new ShellShimMaker(cleanFolderUnderTempRoot); var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); - shellShimMaker.CreateShim( - new FilePath(outputDll.FullName), - shellCommandName); + shellShimMaker.CreateShim(outputDll, shellCommandName); - var stdOut = ExecuteInShell(shellCommandName, arguments); + var stdOut = ExecuteInShell(shellCommandName, cleanFolderUnderTempRoot, arguments); for (int i = 0; i < expectedPassThru.Length; i++) { @@ -115,17 +135,17 @@ namespace Microsoft.DotNet.ShellShim.Tests public void GivenAnExecutablePathWithExistingSameNameShimItThrows(bool testMockBehaviorIsInSync) { var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); - - MakeNameConflictingCommand(TempRoot.Root, shellCommandName); + var cleanFolderUnderTempRoot = GetNewCleanFolderUnderTempRoot(); + MakeNameConflictingCommand(cleanFolderUnderTempRoot, shellCommandName); IShellShimMaker shellShimMaker; if (testMockBehaviorIsInSync) { - shellShimMaker = new ShellShimMakerMock(TempRoot.Root); + shellShimMaker = new ShellShimMakerMock(cleanFolderUnderTempRoot); } else { - shellShimMaker = new ShellShimMaker(TempRoot.Root); + shellShimMaker = new ShellShimMaker(cleanFolderUnderTempRoot); } Action a = () => shellShimMaker.EnsureCommandNameUniqueness(shellCommandName); @@ -138,18 +158,89 @@ namespace Microsoft.DotNet.ShellShim.Tests [Theory] [InlineData(false)] [InlineData(true)] - public void GivenAnExecutablePathWithoutExistingSameNameShimItShouldNotThrow(bool testMockBehaviorIsInSync) + public void GivenAnExecutablePathWithExistingSameNameShimItRollsBack(bool testMockBehaviorIsInSync) { var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); + var pathToShim = GetNewCleanFolderUnderTempRoot(); + MakeNameConflictingCommand(pathToShim, shellCommandName); + IShellShimMaker shellShimMaker; if (testMockBehaviorIsInSync) { - shellShimMaker = new ShellShimMakerMock(TempRoot.Root); + shellShimMaker = new ShellShimMakerMock(pathToShim); } else { - shellShimMaker = new ShellShimMaker(TempRoot.Root); + shellShimMaker = new ShellShimMaker(pathToShim); + } + + Action a = () => + { + using (var t = new TransactionScope()) + { + shellShimMaker.CreateShim(new FilePath("dummy.dll"), shellCommandName); + + t.Complete(); + } + }; + a.ShouldThrow(); + + Directory.GetFiles(pathToShim).Should().HaveCount(1, "there is only intent conflicted command"); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAnExecutablePathErrorHappensItRollsBack(bool testMockBehaviorIsInSync) + { + var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); + + var pathToShim = GetNewCleanFolderUnderTempRoot(); + + IShellShimMaker shellShimMaker; + if (testMockBehaviorIsInSync) + { + shellShimMaker = new ShellShimMakerMock(pathToShim); + } + else + { + shellShimMaker = new ShellShimMaker(pathToShim); + } + + Action intendedError = () => throw new PackageObtainException(); + + Action a = () => + { + using (var t = new TransactionScope()) + { + shellShimMaker.CreateShim(new FilePath("dummy.dll"), shellCommandName); + + intendedError(); + t.Complete(); + } + }; + a.ShouldThrow(); + + Directory.GetFiles(pathToShim).Should().BeEmpty(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAnExecutablePathWithoutExistingSameNameShimItShouldNotThrow(bool testMockBehaviorIsInSync) + { + var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); + var cleanFolderUnderTempRoot = GetNewCleanFolderUnderTempRoot(); + + IShellShimMaker shellShimMaker; + if (testMockBehaviorIsInSync) + { + shellShimMaker = new ShellShimMakerMock(cleanFolderUnderTempRoot); + } + else + { + shellShimMaker = new ShellShimMaker(cleanFolderUnderTempRoot); } Action a = () => shellShimMaker.EnsureCommandNameUniqueness(shellCommandName); @@ -158,16 +249,21 @@ namespace Microsoft.DotNet.ShellShim.Tests private static void MakeNameConflictingCommand(string pathToPlaceShim, string shellCommandName) { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + shellCommandName = shellCommandName + ".exe"; + } + File.WriteAllText(Path.Combine(pathToPlaceShim, shellCommandName), string.Empty); } - private string ExecuteInShell(string shellCommandName, string arguments = "") + private string ExecuteInShell(string shellCommandName, string cleanFolderUnderTempRoot, string arguments = "") { ProcessStartInfo processStartInfo; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - var file = Path.Combine(TempRoot.Root, shellCommandName + ".exe"); + var file = Path.Combine(cleanFolderUnderTempRoot, shellCommandName + ".exe"); processStartInfo = new ProcessStartInfo { FileName = file, @@ -186,7 +282,7 @@ namespace Microsoft.DotNet.ShellShim.Tests } _output.WriteLine($"Launching '{processStartInfo.FileName} {processStartInfo.Arguments}'"); - processStartInfo.WorkingDirectory = TempRoot.Root; + processStartInfo.WorkingDirectory = cleanFolderUnderTempRoot; processStartInfo.EnvironmentVariables["PATH"] = Path.GetDirectoryName(new Muxer().MuxerPath); processStartInfo.ExecuteAndCaptureOutput(out var stdOut, out var stdErr); @@ -196,7 +292,7 @@ namespace Microsoft.DotNet.ShellShim.Tests return stdOut ?? ""; } - private static FileInfo MakeHelloWorldExecutableDll() + private static FilePath MakeHelloWorldExecutableDll() { const string testAppName = "TestAppSimple"; const string emptySpaceToTestSpaceInPath = " "; @@ -212,7 +308,15 @@ namespace Microsoft.DotNet.ShellShim.Tests .GetDirectories().Single() .GetFile($"{testAppName}.dll"); - return outputDll; + return new FilePath(outputDll.FullName); + } + + private static string GetNewCleanFolderUnderTempRoot() + { + DirectoryInfo CleanFolderUnderTempRoot = new DirectoryInfo(Path.Combine(TempRoot.Root, "cleanfolder" + Path.GetRandomFileName())); + CleanFolderUnderTempRoot.Create(); + + return CleanFolderUnderTempRoot.FullName; } } } diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs index b57e5cde1..31b8c33b5 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs +++ b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Reflection; +using System.Transactions; using FluentAssertions; using Microsoft.DotNet.Tools.Test.Utilities; using Microsoft.Extensions.EnvironmentAbstractions; @@ -58,8 +59,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests bundledTargetFrameworkMoniker: new Lazy(), projectRestorer: new ProjectRestorer(reporter)); - ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = - packageObtainer.ObtainAndReturnExecutablePath( + ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = packageObtainer.ObtainAndReturnExecutablePath( packageId: TestPackageId, packageVersion: TestPackageVersion, targetframework: _testTargetframework); @@ -109,6 +109,43 @@ namespace Microsoft.DotNet.ToolPackage.Tests File.Delete(executable.Value); } + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenNugetConfigAndPackageNameAndVersionAndTargetFrameworkWhenCallItCanDownloadThePackageInTransaction( + bool testMockBehaviorIsInSync) + { + var reporter = new BufferedReporter(); + FilePath nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); + var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); + + var packageObtainer = + ConstructDefaultPackageObtainer(toolsPath, reporter, testMockBehaviorIsInSync, nugetConfigPath.Value); + + ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath; + + using (var transactionScope = new TransactionScope()) + { + toolConfigurationAndExecutablePath + = packageObtainer.ObtainAndReturnExecutablePath( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + nugetconfig: nugetConfigPath, + targetframework: _testTargetframework); + + transactionScope.Complete(); + } + + reporter.Lines.Should().BeEmpty(); + + FilePath executable = toolConfigurationAndExecutablePath.Executable; + File.Exists(executable.Value) + .Should() + .BeTrue(executable + " should have the executable"); + + File.Delete(executable.Value); + } + [Theory] [InlineData(false)] [InlineData(true)] @@ -122,7 +159,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests var packageObtainer = ConstructDefaultPackageObtainer(toolsPath, reporter, testMockBehaviorIsInSync, nugetConfigPath.Value); - ToolConfigurationAndExecutablePath toolConfigurationAndExecutableDirectory = + ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = packageObtainer.ObtainAndReturnExecutablePath( packageId: TestPackageId, packageVersion: TestPackageVersion, @@ -138,7 +175,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests /dependency2 package id/ /project.assets.json */ - var assetJsonPath = toolConfigurationAndExecutableDirectory + var assetJsonPath = toolConfigurationAndExecutablePath .Executable .GetDirectoryPath() .GetParentPath() @@ -177,7 +214,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests IToolPackageObtainer packageObtainer; if (testMockBehaviorIsInSync) { - packageObtainer = new ToolPackageObtainerMock(); + packageObtainer = new ToolPackageObtainerMock(toolsPath: toolsPath); } else { @@ -212,7 +249,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests public void GivenAllButNoPackageVersionItCanDownloadThePackage(bool testMockBehaviorIsInSync) { var reporter = new BufferedReporter(); - var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); + FilePath nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); var packageObtainer = @@ -235,35 +272,6 @@ namespace Microsoft.DotNet.ToolPackage.Tests File.Delete(executable.Value); } - [Theory] - [InlineData(false)] - [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, 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(); - } - [Theory] [InlineData(false)] [InlineData(true)] @@ -292,7 +300,8 @@ namespace Microsoft.DotNet.ToolPackage.Tests } } } - }); + }, + toolsPath: toolsPath); } else { @@ -334,6 +343,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests var nonExistNugetConfigFile = new FilePath("NonExistent.file"); Action a = () => { + ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = packageObtainer.ObtainAndReturnExecutablePath( packageId: TestPackageId, packageVersion: TestPackageVersion, @@ -358,16 +368,21 @@ namespace Microsoft.DotNet.ToolPackage.Tests var reporter = new BufferedReporter(); var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); - var packageObtainer = ConstructDefaultPackageObtainer(toolsPath, reporter); - var toolConfigurationAndExecutableDirectory = packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - targetframework: _testTargetframework, - source:GetTestLocalFeedPath()); + var packageObtainer = ConstructDefaultPackageObtainer( + toolsPath, + reporter, + testMockBehaviorIsInSync: testMockBehaviorIsInSync, + addSourceFeedWithFilePath: GetTestLocalFeedPath()); + ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = + packageObtainer.ObtainAndReturnExecutablePath( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + targetframework: _testTargetframework, + source: GetTestLocalFeedPath()); reporter.Lines.Should().BeEmpty(); - var executable = toolConfigurationAndExecutableDirectory.Executable; + var executable = toolConfigurationAndExecutablePath.Executable; File.Exists(executable.Value) .Should() @@ -376,6 +391,158 @@ namespace Microsoft.DotNet.ToolPackage.Tests File.Delete(executable.Value); } + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenFailedRestoreItCanRollBack(bool testMockBehaviorIsInSync) + { + var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); + + var reporter = new BufferedReporter(); + var packageObtainer = ConstructDefaultPackageObtainer(toolsPath, reporter, testMockBehaviorIsInSync); + + try + { + using (var t = new TransactionScope()) + { + packageObtainer.ObtainAndReturnExecutablePath( + packageId: "non exist package id", + packageVersion: TestPackageVersion, + targetframework: _testTargetframework); + + t.Complete(); + } + } + catch (PackageObtainException) + { + // catch the intent error + } + + AssertRollBack(toolsPath); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GiveSucessRestoreButFailedOnNextStepItCanRollBack(bool testMockBehaviorIsInSync) + { + FilePath nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); + var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); + var reporter = new BufferedReporter(); + var packageObtainer = ConstructDefaultPackageObtainer(toolsPath, reporter, testMockBehaviorIsInSync); + + void FailedStepAfterSuccessRestore() => throw new GracefulException("simulated error"); + + try + { + using (var t = new TransactionScope()) + { + ToolConfigurationAndExecutablePath obtainAndReturnExecutablePathtransactional + = packageObtainer.ObtainAndReturnExecutablePath( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + targetframework: _testTargetframework); + + FailedStepAfterSuccessRestore(); + t.Complete(); + } + } + catch (GracefulException) + { + // catch the simulated error + } + + AssertRollBack(toolsPath); + } + + [Theory] + [InlineData(false)] + [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, reporter, testMockBehaviorIsInSync, nugetConfigPath.Value); + + try + { + using (var t = new TransactionScope()) + { + packageObtainer.ObtainAndReturnExecutablePath( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + targetframework: _testTargetframework); + + packageObtainer.ObtainAndReturnExecutablePath( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + targetframework: _testTargetframework); + + t.Complete(); + } + } + catch (PackageObtainException) + { + // catch the simulated error + } + + AssertRollBack(toolsPath); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAllButNoPackageVersionAndInvokeTwiceInTransactionItShouldRollback(bool testMockBehaviorIsInSync) + { + var reporter = new BufferedReporter(); + var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); + var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); + + var packageObtainer = + 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.ShouldThrow(); + + Directory.Exists(Path.Combine(toolsPath, TestPackageId)) + .Should().BeTrue("The result of first one is still here"); + + Directory.GetDirectories(Path.Combine(toolsPath, ".stage")) + .Should().BeEmpty("nothing in stage folder, already rolled back"); + } + + private static void AssertRollBack(string toolsPath) + { + if (!Directory.Exists(toolsPath)) + { + return; // nothing at all + } + + Directory.GetFiles(toolsPath).Should().BeEmpty(); + Directory.GetDirectories(toolsPath) + .Should().NotContain(d => !new DirectoryInfo(d).Name.Equals(".stage"), + "no broken folder, exclude stage folder"); + + Directory.GetDirectories(Path.Combine(toolsPath, ".stage")) + .Should().BeEmpty("nothing in stage folder"); + } + private static readonly Func GetUniqueTempProjectPathEachTest = () => { var tempProjectDirectory = @@ -412,7 +579,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests } } } - }); + }, toolsPath: toolsPath); } if (addSourceFeedWithFilePath != null) @@ -422,7 +589,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests { new MockFeed { - Type = MockFeedType.ExplicitNugetConfig, + Type = MockFeedType.Source, Uri = addSourceFeedWithFilePath, Packages = new List { @@ -433,10 +600,11 @@ namespace Microsoft.DotNet.ToolPackage.Tests } } } - }); + }, + toolsPath: toolsPath); } - return new ToolPackageObtainerMock(); + return new ToolPackageObtainerMock(toolsPath: toolsPath); } return new ToolPackageObtainer( @@ -465,7 +633,6 @@ namespace Microsoft.DotNet.ToolPackage.Tests } private static string GetTestLocalFeedPath() => Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestAssetLocalNugetFeed"); - private readonly string _testTargetframework = BundledTargetFramework.GetTargetFrameworkMoniker(); private const string TestPackageVersion = "1.0.4"; private const string TestPackageId = "global.tool.console.demo"; diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimMakerMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimMakerMock.cs index 50d123d09..1f9ca0060 100644 --- a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimMakerMock.cs +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimMakerMock.cs @@ -2,7 +2,11 @@ // 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.Runtime.InteropServices; +using System.Transactions; +using Microsoft.DotNet.Cli; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.ShellShim; using Microsoft.Extensions.EnvironmentAbstractions; @@ -18,12 +22,56 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks public ShellShimMakerMock(string pathToPlaceShim, IFileSystem fileSystem = null) { _pathToPlaceShim = - pathToPlaceShim ?? throw new ArgumentNullException(nameof(pathToPlaceShim)); + pathToPlaceShim ?? + throw new ArgumentNullException(nameof(pathToPlaceShim)); _fileSystem = fileSystem ?? new FileSystemWrapper(); } + public void EnsureCommandNameUniqueness(string shellCommandName) + { + if (_fileSystem.File.Exists(GetShimPath(shellCommandName).Value)) + { + throw new GracefulException( + string.Format(CommonLocalizableStrings.FailInstallToolSameName, + shellCommandName)); + } + } + public void CreateShim(FilePath packageExecutable, string shellCommandName) + { + var createShimTransaction = new CreateShimTransaction( + createShim: locationOfShimDuringTransaction => + { + EnsureCommandNameUniqueness(shellCommandName); + PlaceShim(packageExecutable, shellCommandName, locationOfShimDuringTransaction); + }, + rollback: locationOfShimDuringTransaction => + { + foreach (FilePath f in locationOfShimDuringTransaction) + { + if (File.Exists(f.Value)) + { + File.Delete(f.Value); + } + } + }); + + using (var transactionScope = new TransactionScope()) + { + Transaction.Current.EnlistVolatile(createShimTransaction, EnlistmentOptions.None); + createShimTransaction.CreateShim(); + + transactionScope.Complete(); + } + } + + public void Remove(string shellCommandName) + { + File.Delete(GetShimPath(shellCommandName).Value); + } + + private void PlaceShim(FilePath packageExecutable, string shellCommandName, List locationOfShimDuringTransaction) { var fakeshim = new FakeShim { @@ -32,18 +80,20 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks }; var script = JsonConvert.SerializeObject(fakeshim); - FilePath scriptPath = new FilePath(Path.Combine(_pathToPlaceShim, shellCommandName)); + FilePath scriptPath = GetShimPath(shellCommandName); _fileSystem.File.WriteAllText(scriptPath.Value, script); + locationOfShimDuringTransaction.Add(scriptPath); } - public void EnsureCommandNameUniqueness(string shellCommandName) + private FilePath GetShimPath(string shellCommandName) { - if (_fileSystem.File.Exists(Path.Combine(_pathToPlaceShim, shellCommandName))) + var scriptPath = Path.Combine(_pathToPlaceShim, shellCommandName); + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - throw new GracefulException( - string.Format(CommonLocalizableStrings.FailInstallToolSameName, - shellCommandName)); + scriptPath += ".exe"; } + + return new FilePath(scriptPath); } public class FakeShim diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageObtainerMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageObtainerMock.cs index 6c1e31b7c..3463c3859 100644 --- a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageObtainerMock.cs +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageObtainerMock.cs @@ -5,6 +5,8 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Transactions; +using Microsoft.DotNet.Cli; using Microsoft.DotNet.ToolPackage; using Microsoft.Extensions.EnvironmentAbstractions; @@ -12,20 +14,27 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks { internal class ToolPackageObtainerMock : IToolPackageObtainer { - private readonly Action _beforeRunObtain; + private readonly string _toolsPath; public const string FakeEntrypointName = "SimulatorEntryPoint.dll"; public const string FakeCommandName = "SimulatorCommand"; + private readonly Action _beforeRunObtain; + private readonly Action _duringObtain; private static IFileSystem _fileSystem; private string _fakeExecutableDirectory; private List _mockFeeds; + private string _packageIdVersionDirectory; public ToolPackageObtainerMock( IFileSystem fileSystemWrapper = null, bool useDefaultFeed = true, IEnumerable additionalFeeds = null, - Action beforeRunObtain = null) + Action beforeRunObtain = null, + Action duringObtain = null, + string toolsPath = null) { - _beforeRunObtain = beforeRunObtain ?? (() => { }); + _toolsPath = toolsPath ?? "toolsPath"; + _beforeRunObtain = beforeRunObtain ?? (() => {}); + _duringObtain = duringObtain ?? (() => {}); _fileSystem = fileSystemWrapper ?? new FileSystemWrapper(); _mockFeeds = new List(); @@ -34,14 +43,14 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks _mockFeeds.Add(new MockFeed { Type = MockFeedType.FeedFromLookUpNugetConfig, - Packages = new List - { - new MockFeedPackage + Packages = new List { - PackageId = "global.tool.console.demo", - Version = "1.0.4" + new MockFeedPackage + { + PackageId = "global.tool.console.demo", + Version = "1.0.4" + } } - } }); } @@ -59,42 +68,97 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks string source = null, string verbosity = null) { - _beforeRunObtain(); + var stagedFile = Path.Combine(_toolsPath, ".stage", Path.GetRandomFileName()); + bool afterStage = false; - PickFeedByNugetConfig(nugetconfig); - PickFeedBySource(source); + var toolPackageObtainTransaction = new ToolPackageObtainTransaction( + obtainAndReturnExecutablePath: (_) => + { + if (Directory.Exists(Path.Combine(_toolsPath, packageId))) + { + throw new PackageObtainException( + string.Format(CommonLocalizableStrings.ToolPackageConflictPackageId, packageId)); + } - MockFeedPackage package = _mockFeeds - .SelectMany(f => f.Packages) - .Where(p => MatchPackageVersion(p, packageId, packageVersion)).OrderByDescending(p => p.Version) - .FirstOrDefault(); + _beforeRunObtain(); - if (package == null) + PickFeedByNugetConfig(nugetconfig); + PickFeedBySource(source); + + MockFeedPackage package = _mockFeeds + .SelectMany(f => f.Packages) + .Where(p => MatchPackageVersion(p, packageId, packageVersion)).OrderByDescending(p => p.Version) + .FirstOrDefault(); + + if (package == null) + { + throw new PackageObtainException("simulated cannot find package"); + } + + packageVersion = package.Version; + targetframework = targetframework ?? "targetframework"; + + _packageIdVersionDirectory = Path.Combine(_toolsPath, packageId, packageVersion); + + _fakeExecutableDirectory = Path.Combine(_packageIdVersionDirectory, + packageId, packageVersion, "morefolders", "tools", + targetframework); + + SimulateStageFile(); + _duringObtain(); + + _fileSystem.File.Delete(stagedFile); + afterStage = true; + + _fileSystem.Directory.CreateDirectory(_packageIdVersionDirectory); + _fileSystem.File.CreateEmptyFile(Path.Combine(_packageIdVersionDirectory, "project.assets.json")); + _fileSystem.Directory.CreateDirectory(_fakeExecutableDirectory); + var fakeExecutable = Path.Combine(_fakeExecutableDirectory, FakeEntrypointName); + _fileSystem.File.CreateEmptyFile(fakeExecutable); + + return new ToolConfigurationAndExecutablePath( + toolConfiguration: new ToolConfiguration(FakeCommandName, FakeEntrypointName), + executable : new FilePath(fakeExecutable));; + }, + + rollback: (_) => + { + if (afterStage == false) + { + if (_fileSystem.File.Exists(stagedFile)) + { + _fileSystem.File.Delete(stagedFile); + } + } + else + { + if (_fileSystem.Directory.Exists(Path.Combine(_toolsPath, packageId))) + { + _fileSystem.Directory.Delete(Path.Combine(_toolsPath, packageId), true); + } + } + } + ); + + using(var transactionScope = new TransactionScope()) { - throw new PackageObtainException("simulated cannot find package"); + Transaction.Current.EnlistVolatile(toolPackageObtainTransaction, EnlistmentOptions.None); + var toolConfigurationAndExecutablePath = toolPackageObtainTransaction.ObtainAndReturnExecutablePath(); + + transactionScope.Complete(); + return toolConfigurationAndExecutablePath; + } + } + + private void SimulateStageFile() + { + var stageDirectory = Path.Combine(_toolsPath, ".stage"); + if (!_fileSystem.Directory.Exists(stageDirectory)) + { + _fileSystem.Directory.CreateDirectory(stageDirectory); } - packageVersion = package.Version; - targetframework = targetframework ?? "targetframework"; - - var packageIdVersionDirectory = Path.Combine("toolPath", packageId, packageVersion); - - _fakeExecutableDirectory = Path.Combine(packageIdVersionDirectory, - packageId, packageVersion, "morefolders", "tools", - targetframework); - var fakeExecutable = Path.Combine(_fakeExecutableDirectory, FakeEntrypointName); - - if (!_fileSystem.Directory.Exists(_fakeExecutableDirectory)) - { - _fileSystem.Directory.CreateDirectory(_fakeExecutableDirectory); - } - - _fileSystem.File.CreateEmptyFile(Path.Combine(packageIdVersionDirectory, "project.assets.json")); - _fileSystem.File.CreateEmptyFile(fakeExecutable); - - return new ToolConfigurationAndExecutablePath( - toolConfiguration: new ToolConfiguration(FakeCommandName, FakeEntrypointName), - executable: new FilePath(fakeExecutable)); + _fileSystem.File.CreateEmptyFile(Path.Combine(stageDirectory, "stagedfile")); } private void PickFeedBySource(string source) diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Mock/FileSystemMockBuilder.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Mock/FileSystemMockBuilder.cs index cda8c704b..9cb1ddd59 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Mock/FileSystemMockBuilder.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Mock/FileSystemMockBuilder.cs @@ -106,6 +106,16 @@ namespace Microsoft.Extensions.DependencyModel.Tests { _files[path] = content; } + + public void Delete(string path) + { + if (!Exists(path)) + { + return; + } + + _files.Remove(path); + } } private class DirectoryMock : IDirectory @@ -143,6 +153,22 @@ namespace Microsoft.Extensions.DependencyModel.Tests { _files.Add(path, path); } + + public void Delete(string path, bool recursive) + { + if (!recursive && Exists(path) == true) + { + if (_files.Keys.Where(k => k.StartsWith(path)).Count() > 1) + { + throw new IOException("The directory is not empty"); + } + } + + foreach (var k in _files.Keys.Where(k => k.StartsWith(path)).ToList()) + { + _files.Remove(k); + } + } } private class TemporaryDirectoryMock : ITemporaryDirectoryMock diff --git a/test/dotnet.Tests/InstallToolCommandTests/InstallToolCommandTests.cs b/test/dotnet.Tests/InstallToolCommandTests/InstallToolCommandTests.cs index 60effad3b..c3a838ae1 100644 --- a/test/dotnet.Tests/InstallToolCommandTests/InstallToolCommandTests.cs +++ b/test/dotnet.Tests/InstallToolCommandTests/InstallToolCommandTests.cs @@ -19,6 +19,7 @@ using Newtonsoft.Json; using Xunit; using Parser = Microsoft.DotNet.Cli.Parser; using LocalizableStrings = Microsoft.DotNet.Tools.Install.Tool.LocalizableStrings; +using System.Runtime.InteropServices; namespace Microsoft.DotNet.Tests.InstallToolCommandTests { @@ -32,20 +33,22 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests private readonly ParseResult _parseResult; private readonly BufferedReporter _reporter; private const string PathToPlaceShim = "pathToPlace"; + private const string PathToPlacePackages = PathToPlaceShim + "pkg"; + private const string PackageId = "global.tool.console.demo"; public InstallToolCommandTests() { _fileSystemWrapper = new FileSystemMockBuilder().Build(); - _toolPackageObtainerMock = new ToolPackageObtainerMock(_fileSystemWrapper); + _toolPackageObtainerMock = new ToolPackageObtainerMock(_fileSystemWrapper, toolsPath: PathToPlacePackages); _shellShimMakerMock = new ShellShimMakerMock(PathToPlaceShim, _fileSystemWrapper); _reporter = new BufferedReporter(); _environmentPathInstructionMock = new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim); - ParseResult result = Parser.Instance.Parse("dotnet install tool -g global.tool.console.demo"); + ParseResult result = Parser.Instance.Parse($"dotnet install tool -g {PackageId}"); _appliedCommand = result["dotnet"]["install"]["tool"]; var parser = Parser.Instance; - _parseResult = parser.ParseFrom("dotnet install", new[] {"tool", "global.tool.console.demo"}); + _parseResult = parser.ParseFrom("dotnet install", new[] {"tool", PackageId}); } [Fact] @@ -60,12 +63,9 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests 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)) - .Should().BeTrue(); + _fileSystemWrapper.File.Exists(ExpectedCommandPath()).Should().BeTrue(); var deserializedFakeShim = JsonConvert.DeserializeObject( - _fileSystemWrapper.File.ReadAllText( - Path.Combine("pathToPlace", - ToolPackageObtainerMock.FakeCommandName))); + _fileSystemWrapper.File.ReadAllText(ExpectedCommandPath())); _fileSystemWrapper.File.Exists(deserializedFakeShim.ExecutablePath).Should().BeTrue(); } @@ -73,11 +73,10 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests public void WhenRunWithPackageIdWithSourceItShouldCreateValidShim() { const string sourcePath = "http://mysouce.com"; - ParseResult result = Parser.Instance.Parse($"dotnet install tool -g global.tool.console.demo --source {sourcePath}"); + ParseResult result = Parser.Instance.Parse($"dotnet install tool -g {PackageId} --source {sourcePath}"); AppliedOption appliedCommand = result["dotnet"]["install"]["tool"]; - const string packageId = "global.tool.console.demo"; ParseResult parseResult = - Parser.Instance.ParseFrom("dotnet install", new[] {"tool", packageId, "--source", sourcePath}); + Parser.Instance.ParseFrom("dotnet install", new[] { "tool", PackageId, "--source", sourcePath }); var installToolCommand = new InstallToolCommand(appliedCommand, parseResult, @@ -91,7 +90,7 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests { new MockFeedPackage { - PackageId = packageId, + PackageId = PackageId, Version = "1.0.4" } } @@ -103,13 +102,11 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests 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)) - .Should().BeTrue(); + _fileSystemWrapper.File.Exists(ExpectedCommandPath()) + .Should().BeTrue(); ShellShimMakerMock.FakeShim deserializedFakeShim = JsonConvert.DeserializeObject( - _fileSystemWrapper.File.ReadAllText( - Path.Combine("pathToPlace", - ToolPackageObtainerMock.FakeCommandName))); + _fileSystemWrapper.File.ReadAllText(ExpectedCommandPath())); _fileSystemWrapper.File.Exists(deserializedFakeShim.ExecutablePath).Should().BeTrue(); } @@ -157,6 +154,49 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests .Contain(string.Format(LocalizableStrings.ToolInstallationFailed, "global.tool.console.demo")); } + [Fact] + public void GivenFailedPackageObtainWhenRunWithPackageIdItShouldHaveNoBrokenFolderOnDisk() + { + var toolPackageObtainerSimulatorThatThrows + = new ToolPackageObtainerMock( + _fileSystemWrapper, true, null, + duringObtain: () => throw new PackageObtainException("Simulated error"), + toolsPath: PathToPlacePackages); + var installToolCommand = new InstallToolCommand( + _appliedCommand, + _parseResult, + toolPackageObtainerSimulatorThatThrows, + _shellShimMakerMock, + _environmentPathInstructionMock, + _reporter); + + installToolCommand.Execute(); + + _fileSystemWrapper.Directory.Exists(Path.Combine(PathToPlacePackages, PackageId)).Should().BeFalse(); + } + + [Fact] + public void GivenCreateShimItShouldHaveNoBrokenFolderOnDisk() + { + _fileSystemWrapper.File.CreateEmptyFile(ExpectedCommandPath()); // Create conflict shim + var toolPackageObtainerSimulatorThatThrows + = new ToolPackageObtainerMock( + _fileSystemWrapper, true, null, + toolsPath: PathToPlacePackages); + var installToolCommand = new InstallToolCommand( + _appliedCommand, + _parseResult, + toolPackageObtainerSimulatorThatThrows, + _shellShimMakerMock, + _environmentPathInstructionMock, + _reporter); + + Action a = () => installToolCommand.Execute(); + a.ShouldThrow(); + + _fileSystemWrapper.Directory.Exists(Path.Combine(PathToPlacePackages, PackageId)).Should().BeFalse(); + } + [Fact] public void GivenInCorrectToolConfigurationWhenRunWithPackageIdItShouldFail() { @@ -208,5 +248,13 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests .Single().Should() .Contain(string.Format(LocalizableStrings.InstallationSucceeded, "SimulatorCommand")); } + + private static string ExpectedCommandPath() + { + var extension = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : string.Empty; + return Path.Combine( + "pathToPlace", + ToolPackageObtainerMock.FakeCommandName + extension); + } } } From f050264331d6345071c8765137749608106896c4 Mon Sep 17 00:00:00 2001 From: William Lee Date: Wed, 7 Feb 2018 14:28:13 -0800 Subject: [PATCH 028/103] Rename to BundledNETCorePlatformsPackageVersion (#8538) --- build/DependencyVersions.props | 2 +- build/MSBuildExtensions.targets | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 08249a88e..586a705bb 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -14,7 +14,7 @@ $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) - 2.1.300-preview2-62530-05 + 2.1.300-preview2-62607-04 $(MicrosoftNETSdkPackageVersion) 2.1.0-preview2-30028 2.1.0-release21-20180126-1326543 diff --git a/build/MSBuildExtensions.targets b/build/MSBuildExtensions.targets index f1afbe3cb..4f95d4db1 100644 --- a/build/MSBuildExtensions.targets +++ b/build/MSBuildExtensions.targets @@ -97,23 +97,25 @@ of our build against Microsoft.NETCore.App to find the correct NETStandard.Library version --> - <_NETStandardLibraryVersions Include="@(PackageDefinitions->'%(Version)')" + <_NETStandardLibraryPackageVersions Include="@(PackageDefinitions->'%(Version)')" Condition="%(PackageDefinitions.Name) == 'NetStandard.Library'" /> - <_NETCorePlatformsImplicitPackageVersion Include="@(PackageDefinitions->'%(Version)')" + <_NETCorePlatformsPackageVersions Include="@(PackageDefinitions->'%(Version)')" Condition="%(PackageDefinitions.Name) == 'Microsoft.NETCore.Platforms'" /> - + <_NETCoreAppPackageVersion>$(MicrosoftNETCoreAppPackageVersion) - <_NETStandardPackageVersion>@(_NETStandardLibraryVersions->Distinct()) - <_NETCorePlatformsImplicitPackageVersion>@(_NETCorePlatformsImplicitPackageVersion->Distinct()) + <_NETStandardLibraryPackageVersion>@(_NETStandardLibraryPackageVersions->Distinct()) + <_NETCorePlatformsPackageVersion>@(_NETCorePlatformsPackageVersions->Distinct()) <_NETCoreAppTargetFrameworkVersion>$(_NETCoreAppPackageVersion.Split('.')[0]).$(_NETCoreAppPackageVersion.Split('.')[1]) - <_NETStandardTargetFrameworkVersion>$(_NETStandardPackageVersion.Split('.')[0]).$(_NETStandardPackageVersion.Split('.')[1]) + <_NETStandardTargetFrameworkVersion>$(_NETStandardLibraryPackageVersion.Split('.')[0]).$(_NETStandardLibraryPackageVersion.Split('.')[1]) $(_NETCoreAppTargetFrameworkVersion) $(_NETCoreAppPackageVersion) $(_NETStandardTargetFrameworkVersion) - $(_NETStandardPackageVersion) - $(_NETCorePlatformsImplicitPackageVersion) + $(_NETStandardLibraryPackageVersion) + $(_NETCorePlatformsPackageVersion) ]]> From 7bc25a328a7dde20fe671f685fccff247c8eeb7a Mon Sep 17 00:00:00 2001 From: dotnet-bot Date: Thu, 8 Feb 2018 01:57:49 +0000 Subject: [PATCH 029/103] Update CoreSetup, CoreSetup, CoreSetup, Roslyn to preview2-26131-06, preview2-26131-06, preview2-26131-06, beta1-62608-01, respectively --- build/DependencyVersions.props | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 586a705bb..6a0f6386a 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -2,7 +2,7 @@ 2.1.0-preview1-28124 - 2.1.0-preview2-26130-06 + 2.1.0-preview2-26131-06 $(MicrosoftNETCoreAppPackageVersion) 15.6.0-preview-000054-1286830 $(MicrosoftBuildPackageVersion) @@ -10,7 +10,7 @@ $(MicrosoftBuildPackageVersion) $(MicrosoftBuildPackageVersion) 4.2.0-rtm-171122-0 - 2.7.0-beta3-62529-06 + 2.8.0-beta1-62608-01 $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) @@ -28,8 +28,8 @@ $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) - 2.1.0-preview2-26130-06 - 2.1.0-preview2-26130-06 + 2.1.0-preview2-26131-06 + 2.1.0-preview2-26131-06 0.1.1-alpha-174 1.2.1-alpha-002133 $(MicrosoftDotNetProjectJsonMigrationPackageVersion) From b9e6906cc20b572628a5c4d5a7a144bfdcde0c5a Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Thu, 8 Feb 2018 10:13:22 -0800 Subject: [PATCH 030/103] Adding a baseline with files to be excluded from sign check. --- build/CLI_Baseline.csv | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 build/CLI_Baseline.csv diff --git a/build/CLI_Baseline.csv b/build/CLI_Baseline.csv new file mode 100644 index 000000000..6bafd8e04 --- /dev/null +++ b/build/CLI_Baseline.csv @@ -0,0 +1,30 @@ +sdk\*\microsoft.testplatform.vstestconsole.translationlayer.xml,unsigned,oss +sdk\*\sdks\nuget.build.tasks.pack\*\nuget.build.tasks.pack.xml,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_projecttemplates*nupkgdir\additional-methods.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_projecttemplates*nupkgdir\additional-methods.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_projecttemplates*nupkgdir\additional-methods.min.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_projecttemplates*nupkgdir\bootstrap.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_projecttemplates*nupkgdir\bootstrap.min.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_projecttemplates*nupkgdir\glyphicons-halflings-regular.ttf,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_projecttemplates*nupkgdir\jquery.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_projecttemplates*nupkgdir\jquery.min.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_projecttemplates*nupkgdir\jquery.validate.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_projecttemplates*nupkgdir\jquery.validate.min.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_projecttemplates*nupkgdir\jquery.validate.unobtrusive.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_projecttemplates*nupkgdir\jquery.validate.unobtrusive.min.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_projecttemplates*nupkgdir\npm.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_projecttemplates*nupkgdir\site.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_projecttemplates*nupkgdir\site.min.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_spa_projecttemplates*nupkgdir\app.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_spa_projecttemplates*nupkgdir\app.test.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_spa_projecttemplates*nupkgdir\configurestore.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_spa_projecttemplates*nupkgdir\counter.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_spa_projecttemplates*nupkgdir\fetchdata.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_spa_projecttemplates*nupkgdir\home.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_spa_projecttemplates*nupkgdir\index.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_spa_projecttemplates*nupkgdir\karma.conf.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_spa_projecttemplates*nupkgdir\layout.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_spa_projecttemplates*nupkgdir\navmenu.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_spa_projecttemplates*nupkgdir\protractor.conf.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_spa_projecttemplates*nupkgdir\registerserviceworker.js,unsigned,oss +sdk\*\templates\microsoft_dotnet_web_spa_projecttemplates*nupkgdir\weatherforecasts.js,unsigned,oss \ No newline at end of file From 0dc22a3b41a8ccaee5807428f00ace8ea9f52579 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Thu, 8 Feb 2018 11:29:57 -0800 Subject: [PATCH 031/103] Revert back to the dev feed for asp.net in master and move the asp.net core version up. --- build/DependencyVersions.props | 2 +- build/NugetConfigFile.targets | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index bf91e218b..94cc0f586 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -1,7 +1,7 @@ - 2.1.0-preview1-28228 + 2.1.0-preview2-30057 2.1.0-preview2-26131-06 $(MicrosoftNETCoreAppPackageVersion) 15.6.0-preview-000054-1286830 diff --git a/build/NugetConfigFile.targets b/build/NugetConfigFile.targets index f8b41839b..f6d1361e0 100644 --- a/build/NugetConfigFile.targets +++ b/build/NugetConfigFile.targets @@ -20,7 +20,7 @@ - + From a82d52183f0da56d226a536de7aef518cc919666 Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Thu, 8 Feb 2018 15:24:40 -0800 Subject: [PATCH 032/103] Fix unit test with hard-coded English message expectation --- test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs b/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs index 804288f3e..5b7d768a0 100644 --- a/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs +++ b/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs @@ -10,6 +10,7 @@ using System.Xml.Linq; using FluentAssertions; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.TestFramework; +using Microsoft.DotNet.Tools; using Microsoft.DotNet.Tools.Test.Utilities; using Microsoft.DotNet.Tools.Test.Utilities.Mock; using Microsoft.DotNet.Tools.Tests.ComponentMocks; @@ -116,7 +117,7 @@ namespace Microsoft.DotNet.ShellShim.Tests a.ShouldThrow() .And.Message .Should().Contain( - $"Failed to install tool {shellCommandName}. A command with the same name already exists."); + string.Format(CommonLocalizableStrings.FailInstallToolSameName, shellCommandName)); } [Theory] From 9bf75f06fb52af032a34074cb9a29d67fae05df4 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 14 Feb 2018 13:42:47 -0800 Subject: [PATCH 033/103] Update Sdk versions --- build/DependencyVersions.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 94cc0f586..3fb8e3ff4 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -16,8 +16,8 @@ $(MicrosoftCodeAnalysisCSharpPackageVersion) 2.1.300-preview2-62607-04 $(MicrosoftNETSdkPackageVersion) - 2.1.0-preview2-30028 - 2.1.0-release21-20180126-1326543 + 2.1.0-preview2-30099 + 2.1.0-rel-20180209-1369829 $(MicrosoftNETSdkWebPackageVersion) $(MicrosoftNETSdkWebPackageVersion) 1.0.1-beta3-20180104-1263555 From 4810eff39072123f23026a13553622d141d44381 Mon Sep 17 00:00:00 2001 From: Livar Date: Thu, 15 Feb 2018 12:00:25 -0800 Subject: [PATCH 034/103] Update ASP.NET version to 2.1.0-preview2-30106 --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index b46faddf5..1de0f4d93 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -1,7 +1,7 @@ - 2.1.0-preview2-30057 + 2.1.0-preview2-30106 2.1.0-preview2-26131-06 $(MicrosoftNETCoreAppPackageVersion) 15.6.81 From d823581166880b27fbb08e22139dc2d7431364b9 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Thu, 15 Feb 2018 12:45:53 -0800 Subject: [PATCH 035/103] Updating the lzma to use the new asp.net runtime location. --- build/compile/LzmaArchive.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/compile/LzmaArchive.targets b/build/compile/LzmaArchive.targets index 0947b7679..a1fa07e91 100644 --- a/build/compile/LzmaArchive.targets +++ b/build/compile/LzmaArchive.targets @@ -5,7 +5,7 @@ $(SdkOutputDirectory)/nuGetPackagesArchive.lzma nuGetPackagesArchive-$(AspNetCoreVersion).lzma $(IntermediateDirectory)/$(NugetPackagesArchiveName) - $(CoreSetupRootUrl)$(AspNetCoreVersion)/$(NugetPackagesArchiveName) + $(AspNetCoreSharedFxRootUrl)$(AspNetCoreVersion)/$(NugetPackagesArchiveName) Date: Thu, 15 Feb 2018 12:58:21 -0800 Subject: [PATCH 036/103] Fixing the URLs for the msbuildscript.tests to use the new asp.net runtime folder as well. --- test/MsBuildScript.Tests/runtests.target | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/MsBuildScript.Tests/runtests.target b/test/MsBuildScript.Tests/runtests.target index b7da47a1d..355e520bf 100644 --- a/test/MsBuildScript.Tests/runtests.target +++ b/test/MsBuildScript.Tests/runtests.target @@ -8,8 +8,8 @@ - - - + + + From e8f521cbef972e0e2c6ef5db6223d7aa73b62fb9 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Thu, 15 Feb 2018 14:21:27 -0800 Subject: [PATCH 037/103] Stop re-targeting Roslyn to the CLI runtime. It will roll-forward to the CLI runtime (2.1.0) through minor version roll-forward if necessary. --- src/redist/redist.csproj | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index c5e7c93aa..493683cb8 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -75,22 +75,8 @@ - - - - - - - "version": ".*" - "version": "$(MicrosoftNETCoreAppPackageVersion)" - - From 08f050c012cb80bb9433cd401d9be866307e4687 Mon Sep 17 00:00:00 2001 From: William Lee Date: Fri, 16 Feb 2018 13:32:29 -0800 Subject: [PATCH 038/103] bundled DotnetTool (#8606) Extract packages to DotnetTools folder under sdk/{version} Add new resolver to discover it Add test to enforce package structure. It will fail when the structure changed --- Directory.Build.props | 1 + build/BundledDotnetTools.proj | 27 ++++++ build/BundledDotnetTools.props | 6 ++ build/BundledTemplates.proj | 10 +-- build/templates/templates.csproj | 3 +- .../CommandResolutionStrategy.cs | 3 + .../DefaultCommandResolverPolicy.cs | 1 + .../DotnetToolsCommandResolver.cs | 89 +++++++++++++++++++ src/redist/redist.csproj | 23 ++++- test/EndToEnd/GivenDotnetUsesDotnetTools.cs | 17 ++++ .../GivenDotnetInvokesMSBuild.cs | 73 +++++++++++++++ test/InsertionTests/InsertionTests.csproj | 40 +++++++++ test/Microsoft.DotNet.Cli.Tests.sln | 19 +++- .../GivenADefaultCommandResolver.cs | 3 +- .../GivenADotnetToolsCommandResolver.cs | 68 ++++++++++++++ .../Microsoft.DotNet.Cli.Utils.Tests.csproj | 22 +++++ 16 files changed, 393 insertions(+), 12 deletions(-) create mode 100644 build/BundledDotnetTools.proj create mode 100644 build/BundledDotnetTools.props create mode 100644 src/Microsoft.DotNet.Cli.Utils/CommandResolution/DotnetToolsCommandResolver.cs create mode 100644 test/EndToEnd/GivenDotnetUsesDotnetTools.cs create mode 100644 test/InsertionTests/GivenDotnetInvokesMSBuild.cs create mode 100644 test/InsertionTests/InsertionTests.csproj create mode 100644 test/Microsoft.DotNet.Cli.Utils.Tests/GivenADotnetToolsCommandResolver.cs diff --git a/Directory.Build.props b/Directory.Build.props index 97a615453..4a8c44efd 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -57,6 +57,7 @@ tools\TestAssetsDependencies\TestAssetsDependencies.csproj + diff --git a/build/BundledDotnetTools.proj b/build/BundledDotnetTools.proj new file mode 100644 index 000000000..b94bac722 --- /dev/null +++ b/build/BundledDotnetTools.proj @@ -0,0 +1,27 @@ + + + + + + + + + + + + + /p:TargetFramework=$(CliTargetFramework) + $(DotnetToolsRestoreAdditionalParameters) /p:TemplateFillInPackageName=$(TemplateFillInPackageName) + $(DotnetToolsRestoreAdditionalParameters) /p:TemplateFillInPackageVersion=$(TemplateFillInPackageVersion) + $(DotnetToolsRestoreAdditionalParameters) /p:RestorePackagesPath=$(DotnetToolsLayoutDirectory) + $(DotnetToolsRestoreAdditionalParameters) /p:RestoreProjectStyle=$(DotnetToolsRestoreProjectStyle) + + + + + diff --git a/build/BundledDotnetTools.props b/build/BundledDotnetTools.props new file mode 100644 index 000000000..acd2156a5 --- /dev/null +++ b/build/BundledDotnetTools.props @@ -0,0 +1,6 @@ + + + + + + diff --git a/build/BundledTemplates.proj b/build/BundledTemplates.proj index dfc66e111..4d215f874 100644 --- a/build/BundledTemplates.proj +++ b/build/BundledTemplates.proj @@ -11,26 +11,26 @@ - - + + Condition="!Exists('$(TemplateNuPkgPath)/$(TemplateFillInPackageName.ToLower()).nuspec')"> + AdditionalParameters="/p:TargetFramework=netcoreapp1.0 /p:TemplateFillInPackageName=$(TemplateFillInPackageName) /p:TemplateFillInPackageVersion=$(TemplateFillInPackageVersion)" /> - $(NuGetPackagesDir)/$(TemplatePackageName.ToLower())/$(TemplatePackageVersion.ToLower()) + $(NuGetPackagesDir)/$(TemplateFillInPackageName.ToLower())/$(TemplateFillInPackageVersion.ToLower()) diff --git a/build/templates/templates.csproj b/build/templates/templates.csproj index 099a67e3f..2b8443fc6 100644 --- a/build/templates/templates.csproj +++ b/build/templates/templates.csproj @@ -3,12 +3,11 @@ Library - netcoreapp1.0 false - + diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/CommandResolutionStrategy.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/CommandResolutionStrategy.cs index da52bf31b..d2b81f483 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/CommandResolutionStrategy.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/CommandResolutionStrategy.cs @@ -14,6 +14,9 @@ namespace Microsoft.DotNet.Cli.Utils // command loaded from project tools nuget package ProjectToolsPackage, + // command loaded from bundled DotnetTools nuget package + DotnetToolsPackage, + // command loaded from the same directory as the executing assembly BaseDirectory, diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/DefaultCommandResolverPolicy.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/DefaultCommandResolverPolicy.cs index d8a2c464b..711d63112 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/DefaultCommandResolverPolicy.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/DefaultCommandResolverPolicy.cs @@ -44,6 +44,7 @@ namespace Microsoft.DotNet.Cli.Utils var compositeCommandResolver = new CompositeCommandResolver(); compositeCommandResolver.AddCommandResolver(new MuxerCommandResolver()); + compositeCommandResolver.AddCommandResolver(new DotnetToolsCommandResolver()); compositeCommandResolver.AddCommandResolver(new RootedCommandResolver()); compositeCommandResolver.AddCommandResolver( new ProjectToolsCommandResolver(packagedCommandSpecFactory, environment)); diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/DotnetToolsCommandResolver.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/DotnetToolsCommandResolver.cs new file mode 100644 index 000000000..64ba55118 --- /dev/null +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/DotnetToolsCommandResolver.cs @@ -0,0 +1,89 @@ +// 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 System.IO; +using System.Reflection; +using System.Collections.Generic; +using Microsoft.DotNet.PlatformAbstractions; + +namespace Microsoft.DotNet.Cli.Utils +{ + public class DotnetToolsCommandResolver : ICommandResolver + { + private string _dotnetToolPath; + + public DotnetToolsCommandResolver(string dotnetToolPath = null) + { + if (dotnetToolPath == null) + { + _dotnetToolPath = Path.Combine(ApplicationEnvironment.ApplicationBasePath, + "DotnetTools"); + } + else + { + _dotnetToolPath = dotnetToolPath; + } + } + + public CommandSpec Resolve(CommandResolverArguments arguments) + { + if (string.IsNullOrEmpty(arguments.CommandName)) + { + return null; + } + + var packageId = new DirectoryInfo(Path.Combine(_dotnetToolPath, arguments.CommandName)); + if (!packageId.Exists) + { + return null; + } + + var version = packageId.GetDirectories()[0]; + var dll = version.GetDirectories("tools")[0] + .GetDirectories()[0] // TFM + .GetDirectories()[0] // RID + .GetFiles($"{arguments.CommandName}.dll")[0]; + + return CreatePackageCommandSpecUsingMuxer( + dll.FullName, + arguments.CommandArguments, + CommandResolutionStrategy.DotnetToolsPackage); + } + + private CommandSpec CreatePackageCommandSpecUsingMuxer( + string commandPath, + IEnumerable commandArguments, + CommandResolutionStrategy commandResolutionStrategy) + { + var arguments = new List(); + + var muxer = new Muxer(); + + var host = muxer.MuxerPath; + if (host == null) + { + throw new Exception(LocalizableStrings.UnableToLocateDotnetMultiplexer); + } + + arguments.Add(commandPath); + + if (commandArguments != null) + { + arguments.AddRange(commandArguments); + } + + return CreateCommandSpec(host, arguments, commandResolutionStrategy); + } + + private CommandSpec CreateCommandSpec( + string commandPath, + IEnumerable commandArguments, + CommandResolutionStrategy commandResolutionStrategy) + { + var escapedArgs = ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(commandArguments); + + return new CommandSpec(commandPath, escapedArgs, commandResolutionStrategy); + } + } +} diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index 493683cb8..b86cde0d6 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -179,8 +179,8 @@ TemplateLayoutDirectory=$(SdkOutputDirectory)/Templates; - TemplatePackageName=%(BundledTemplate.Identity); - TemplatePackageVersion=%(BundledTemplate.Version); + TemplateFillInPackageName=%(BundledTemplate.Identity); + TemplateFillInPackageVersion=%(BundledTemplate.Version); PreviousStageDirectory=$(PreviousStageDirectory) @@ -192,6 +192,25 @@ + + + + + DotnetToolsLayoutDirectory=$(SdkOutputDirectory)/DotnetTools; + TemplateFillInPackageName=%(BundledDotnetTools.Identity); + TemplateFillInPackageVersion=%(BundledDotnetTools.Version); + PreviousStageDirectory=$(PreviousStageDirectory) + + + + + + + + + Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestDotnetToolsLayoutDirectory"); + private IEnumerable GetDotnetToolDirectory() => + new DirectoryInfo(GetDotnetToolPath()).GetDirectories().Where(d => d.Name.StartsWith("dotnet-")); + + [Fact] + public void Then_there_is_DotnetTools() + { + new DirectoryInfo(GetDotnetToolPath()).GetDirectories().Should().Contain(d => d.Name.StartsWith("dotnet-")); + } + + [Fact] + public void Then_there_is_only_1_version() + { + foreach (var packageFolder in GetDotnetToolDirectory()) + { + packageFolder.GetDirectories().Should().HaveCount(1); + } + } + + [Fact] + public void Then_there_is_only_1_tfm() + { + foreach (var packageFolder in GetDotnetToolDirectory()) + { + packageFolder.GetDirectories()[0] + .GetDirectories("tools")[0] + .GetDirectories().Should().HaveCount(1); + } + } + + [Fact] + public void Then_there_is_only_1_rid() + { + foreach (var packageFolder in GetDotnetToolDirectory()) + { + packageFolder.GetDirectories()[0] + .GetDirectories("tools")[0] + .GetDirectories()[0] + .GetDirectories().Should().HaveCount(1); + } + } + + [Fact] + public void Then_packageName_is_the_same_as_dll() + { + foreach (var packageFolder in GetDotnetToolDirectory()) + { + var packageId = packageFolder.Name; + packageFolder.GetDirectories()[0].GetDirectories("tools")[0].GetDirectories()[0].GetDirectories()[0] + .GetFiles() + .Should().Contain(f => string.Equals(f.Name, $"{packageId}.dll", StringComparison.Ordinal)); + } + } + } +} diff --git a/test/InsertionTests/InsertionTests.csproj b/test/InsertionTests/InsertionTests.csproj new file mode 100644 index 000000000..e4ac93433 --- /dev/null +++ b/test/InsertionTests/InsertionTests.csproj @@ -0,0 +1,40 @@ + + + $(CliTargetFramework) + $(MicrosoftNETCoreAppPackageVersion) + true + msbuild.IntegrationTests + $(AssetTargetFallback);dotnet5.4;portable-net451+win8 + + + + + + + + + + + + + + + + $(OutputPath)/TestDotnetToolsLayoutDirectory + + + + + + DotnetToolsLayoutDirectory=$(SdkOutputDirectory)/DotnetTools; + TemplateFillInPackageName=%(BundledDotnetTools.Identity); + TemplateFillInPackageVersion=%(BundledDotnetTools.Version); + PreviousStageDirectory=$(PreviousStageDirectory); + DotnetToolsLayoutDirectory=$(testAssetSourceRoot); + DotnetToolsRestoreProjectStyle=DotnetToolReference + + + + + + diff --git a/test/Microsoft.DotNet.Cli.Tests.sln b/test/Microsoft.DotNet.Cli.Tests.sln index 9e41297be..c1ce1757e 100644 --- a/test/Microsoft.DotNet.Cli.Tests.sln +++ b/test/Microsoft.DotNet.Cli.Tests.sln @@ -1,6 +1,7 @@ -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 +VisualStudioVersion = 15.0.27130.2024 MinimumVisualStudioVersion = 10.0.40219.1 Project("{13B669BE-BB05-4DDF-9536-439F39A36129}") = "dotnet-add-reference.Tests", "dotnet-add-reference.Tests\dotnet-add-reference.Tests.csproj", "{AB63A3E5-76A3-4EE9-A380-8E0C7B7644DC}" EndProject @@ -90,6 +91,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Tools.Test 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 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InsertionTests", "InsertionTests\InsertionTests.csproj", "{A9713391-3D44-4664-9C41-75765218FD6C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -592,6 +595,18 @@ Global {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 + {A9713391-3D44-4664-9C41-75765218FD6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A9713391-3D44-4664-9C41-75765218FD6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A9713391-3D44-4664-9C41-75765218FD6C}.Debug|x64.ActiveCfg = Debug|Any CPU + {A9713391-3D44-4664-9C41-75765218FD6C}.Debug|x64.Build.0 = Debug|Any CPU + {A9713391-3D44-4664-9C41-75765218FD6C}.Debug|x86.ActiveCfg = Debug|Any CPU + {A9713391-3D44-4664-9C41-75765218FD6C}.Debug|x86.Build.0 = Debug|Any CPU + {A9713391-3D44-4664-9C41-75765218FD6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A9713391-3D44-4664-9C41-75765218FD6C}.Release|Any CPU.Build.0 = Release|Any CPU + {A9713391-3D44-4664-9C41-75765218FD6C}.Release|x64.ActiveCfg = Release|Any CPU + {A9713391-3D44-4664-9C41-75765218FD6C}.Release|x64.Build.0 = Release|Any CPU + {A9713391-3D44-4664-9C41-75765218FD6C}.Release|x86.ActiveCfg = Release|Any CPU + {A9713391-3D44-4664-9C41-75765218FD6C}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenADefaultCommandResolver.cs b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenADefaultCommandResolver.cs index b2e354e30..5537218f7 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenADefaultCommandResolver.cs +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenADefaultCommandResolver.cs @@ -17,13 +17,14 @@ namespace Microsoft.DotNet.Cli.Utils.Tests var resolvers = defaultCommandResolver.OrderedCommandResolvers; - resolvers.Should().HaveCount(7); + resolvers.Should().HaveCount(8); resolvers.Select(r => r.GetType()) .Should() .ContainInOrder( new []{ typeof(MuxerCommandResolver), + typeof(DotnetToolsCommandResolver), typeof(RootedCommandResolver), typeof(ProjectToolsCommandResolver), typeof(AppBaseDllCommandResolver), diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenADotnetToolsCommandResolver.cs b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenADotnetToolsCommandResolver.cs new file mode 100644 index 000000000..d18bc8b2c --- /dev/null +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenADotnetToolsCommandResolver.cs @@ -0,0 +1,68 @@ +// 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.IO; +using FluentAssertions; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.Tools.Test.Utilities; +using Xunit; +using System.Reflection; + +namespace Microsoft.DotNet.Tests +{ + + public class GivenADotnetToolsCommandResolver : TestBase + { + private readonly DotnetToolsCommandResolver _dotnetToolsCommandResolver; + + // Assets are placed during build of this project + private static string GetDotnetToolPath() => Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestDotnetToolsLayoutDirectory"); + + public GivenADotnetToolsCommandResolver() + { + _dotnetToolsCommandResolver = new DotnetToolsCommandResolver(GetDotnetToolPath()); + } + + [Fact] + public void ItReturnsNullWhenCommandNameIsNull() + { + var commandResolverArguments = new CommandResolverArguments() + { + CommandName = null, + }; + + var result = _dotnetToolsCommandResolver.Resolve(commandResolverArguments); + + result.Should().BeNull(); + } + + [Fact] + public void ItReturnsNullWhenCommandNameDoesNotExistInProjectTools() + { + var commandResolverArguments = new CommandResolverArguments() + { + CommandName = "nonexistent-command", + }; + + var result = _dotnetToolsCommandResolver.Resolve(commandResolverArguments); + + result.Should().BeNull(); + } + + [Fact] + public void ItReturnsACommandSpec() + { + var commandResolverArguments = new CommandResolverArguments() + { + CommandName = "dotnet-watch", + }; + + var result = _dotnetToolsCommandResolver.Resolve(commandResolverArguments); + + result.Should().NotBeNull(); + + var commandPath = result.Args.Trim('"'); + commandPath.Should().Contain("dotnet-watch.dll"); + } + } +} diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj b/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj index d03b8c253..222c14025 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj @@ -40,4 +40,26 @@ + + + + + $(OutputPath)/TestDotnetToolsLayoutDirectory + + + + + + DotnetToolsLayoutDirectory=$(SdkOutputDirectory)/DotnetTools; + TemplateFillInPackageName=dotnet-watch; + TemplateFillInPackageVersion=$(AspNetCoreVersion); + PreviousStageDirectory=$(PreviousStageDirectory); + DotnetToolsLayoutDirectory=$(testAssetSourceRoot); + DotnetToolsRestoreProjectStyle=DotnetToolReference + + + + + + From 1e9f85d35a65340409ab1fd10485d7f1acf07ddd Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 16 Feb 2018 16:45:17 -0800 Subject: [PATCH 039/103] Update versions of Web and Razor Sdk --- build/DependencyVersions.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 1de0f4d93..db72f8db4 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -16,8 +16,8 @@ $(MicrosoftCodeAnalysisCSharpPackageVersion) 2.1.300-preview2-62607-04 $(MicrosoftNETSdkPackageVersion) - 2.1.0-preview2-30099 - 2.1.0-rel-20180209-1369829 + 2.1.0-preview2-30119 + 2.1.0-rel-20180215-1390388 $(MicrosoftNETSdkWebPackageVersion) $(MicrosoftNETSdkWebPackageVersion) 1.0.1-beta3-20180104-1263555 From aab9af71b881b442aaa86182aa469ae199fb002c Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Sun, 28 Jan 2018 13:35:04 -0800 Subject: [PATCH 040/103] Implement uninstall tool command. This commit implements the `uninstall tool` command. The `uninstall tool` command is responsible for uninstalling global tools that are installed with the `install tool` command. This commit heavily refactors the ToolPackage and ShellShim namespaces to better support the operations required for the uninstall command. Several string resources have been updated to be more informative or to correct oddly structured sentences. This commit also fixes `--version` on the install command not supporting ranges and wildcards. Fixes #8549. Issue #8485 is partially fixed by this commit (`--prerelease` is not yet implemented). --- src/Microsoft.DotNet.Cli.Utils/Constants.cs | 1 + .../DirectoryWrapper.cs | 14 +- .../FileWrapper.cs | 5 + .../IDirectory.cs | 6 +- .../IFile.cs | 2 + src/dotnet/BuiltInCommandsCatalog.cs | 5 + src/dotnet/CommonLocalizableStrings.resx | 80 ++- src/dotnet/Parser.cs | 1 + src/dotnet/ShellShim/CreateShimTransaction.cs | 52 -- .../ShellShim/DoNothingEnvironmentPath.cs | 2 +- src/dotnet/ShellShim/IShellShimMaker.cs | 10 - src/dotnet/ShellShim/IShellShimRepository.cs | 13 + src/dotnet/ShellShim/LinuxEnvironmentPath.cs | 4 +- src/dotnet/ShellShim/OsxEnvironmentPath.cs | 4 +- src/dotnet/ShellShim/ShellShimException.cs | 22 + src/dotnet/ShellShim/ShellShimMaker.cs | 166 ----- src/dotnet/ShellShim/ShellShimRepository.cs | 213 ++++++ .../ShellShim/WindowsEnvironmentPath.cs | 4 +- src/dotnet/ToolPackage/CommandSettings.cs | 24 + src/dotnet/ToolPackage/IProjectRestorer.cs | 10 +- src/dotnet/ToolPackage/IToolPackage.cs | 22 + ...geObtainer.cs => IToolPackageInstaller.cs} | 13 +- src/dotnet/ToolPackage/IToolPackageStore.cs | 16 + src/dotnet/ToolPackage/PackageVersion.cs | 28 - .../ToolConfigurationAndExecutablePath.cs | 22 - .../ToolConfigurationDeserializer.cs | 30 +- .../ToolPackage/ToolConfigurationException.cs | 10 +- ...inException.cs => ToolPackageException.cs} | 8 +- .../ToolPackage/ToolPackageInstaller.cs | 171 +++++ src/dotnet/ToolPackage/ToolPackageInstance.cs | 174 +++++ .../ToolPackageObtainTransaction.cs | 52 -- src/dotnet/ToolPackage/ToolPackageObtainer.cs | 278 -------- src/dotnet/ToolPackage/ToolPackageStore.cs | 42 ++ src/dotnet/TransactionalAction.cs | 94 +++ .../commands/dotnet-help/HelpUsageText.cs | 1 + .../dotnet-help/LocalizableStrings.resx | 3 + .../dotnet-help/xlf/LocalizableStrings.cs.xlf | 5 + .../dotnet-help/xlf/LocalizableStrings.de.xlf | 5 + .../dotnet-help/xlf/LocalizableStrings.es.xlf | 5 + .../dotnet-help/xlf/LocalizableStrings.fr.xlf | 5 + .../dotnet-help/xlf/LocalizableStrings.it.xlf | 5 + .../dotnet-help/xlf/LocalizableStrings.ja.xlf | 5 + .../dotnet-help/xlf/LocalizableStrings.ko.xlf | 5 + .../dotnet-help/xlf/LocalizableStrings.pl.xlf | 5 + .../xlf/LocalizableStrings.pt-BR.xlf | 5 + .../dotnet-help/xlf/LocalizableStrings.ru.xlf | 5 + .../dotnet-help/xlf/LocalizableStrings.tr.xlf | 5 + .../xlf/LocalizableStrings.zh-Hans.xlf | 5 + .../xlf/LocalizableStrings.zh-Hant.xlf | 5 + .../dotnet-install-tool/InstallToolCommand.cs | 124 ++-- .../LocalizableStrings.resx | 17 +- .../dotnet-install-tool/ProjectRestorer.cs | 16 +- .../xlf/LocalizableStrings.cs.xlf | 32 +- .../xlf/LocalizableStrings.de.xlf | 32 +- .../xlf/LocalizableStrings.es.xlf | 32 +- .../xlf/LocalizableStrings.fr.xlf | 32 +- .../xlf/LocalizableStrings.it.xlf | 32 +- .../xlf/LocalizableStrings.ja.xlf | 32 +- .../xlf/LocalizableStrings.ko.xlf | 32 +- .../xlf/LocalizableStrings.pl.xlf | 32 +- .../xlf/LocalizableStrings.pt-BR.xlf | 32 +- .../xlf/LocalizableStrings.ru.xlf | 32 +- .../xlf/LocalizableStrings.tr.xlf | 32 +- .../xlf/LocalizableStrings.zh-Hans.xlf | 32 +- .../xlf/LocalizableStrings.zh-Hant.xlf | 32 +- .../dotnet-uninstall/LocalizableStrings.resx | 129 ++++ .../dotnet-uninstall/UninstallCommand.cs | 31 + .../UninstallCommandParser.cs | 21 + .../tool/LocalizableStrings.resx | 150 ++++ .../tool/UninstallToolCommand.cs | 125 ++++ .../tool/UninstallToolCommandParser.cs | 25 + .../tool/xlf/LocalizableStrings.cs.xlf | 57 ++ .../tool/xlf/LocalizableStrings.de.xlf | 57 ++ .../tool/xlf/LocalizableStrings.es.xlf | 57 ++ .../tool/xlf/LocalizableStrings.fr.xlf | 57 ++ .../tool/xlf/LocalizableStrings.it.xlf | 57 ++ .../tool/xlf/LocalizableStrings.ja.xlf | 57 ++ .../tool/xlf/LocalizableStrings.ko.xlf | 57 ++ .../tool/xlf/LocalizableStrings.pl.xlf | 57 ++ .../tool/xlf/LocalizableStrings.pt-BR.xlf | 57 ++ .../tool/xlf/LocalizableStrings.ru.xlf | 57 ++ .../tool/xlf/LocalizableStrings.tr.xlf | 57 ++ .../tool/xlf/LocalizableStrings.zh-Hans.xlf | 57 ++ .../tool/xlf/LocalizableStrings.zh-Hant.xlf | 57 ++ .../xlf/LocalizableStrings.cs.xlf | 22 + .../xlf/LocalizableStrings.de.xlf | 22 + .../xlf/LocalizableStrings.es.xlf | 22 + .../xlf/LocalizableStrings.fr.xlf | 22 + .../xlf/LocalizableStrings.it.xlf | 22 + .../xlf/LocalizableStrings.ja.xlf | 22 + .../xlf/LocalizableStrings.ko.xlf | 22 + .../xlf/LocalizableStrings.pl.xlf | 22 + .../xlf/LocalizableStrings.pt-BR.xlf | 22 + .../xlf/LocalizableStrings.ru.xlf | 22 + .../xlf/LocalizableStrings.tr.xlf | 22 + .../xlf/LocalizableStrings.zh-Hans.xlf | 22 + .../xlf/LocalizableStrings.zh-Hant.xlf | 22 + src/dotnet/dotnet.csproj | 2 + .../xlf/CommonLocalizableStrings.cs.xlf | 182 +++-- .../xlf/CommonLocalizableStrings.de.xlf | 182 +++-- .../xlf/CommonLocalizableStrings.es.xlf | 182 +++-- .../xlf/CommonLocalizableStrings.fr.xlf | 182 +++-- .../xlf/CommonLocalizableStrings.it.xlf | 182 +++-- .../xlf/CommonLocalizableStrings.ja.xlf | 182 +++-- .../xlf/CommonLocalizableStrings.ko.xlf | 182 +++-- .../xlf/CommonLocalizableStrings.pl.xlf | 182 +++-- .../xlf/CommonLocalizableStrings.pt-BR.xlf | 182 +++-- .../xlf/CommonLocalizableStrings.ru.xlf | 182 +++-- .../xlf/CommonLocalizableStrings.tr.xlf | 182 +++-- .../xlf/CommonLocalizableStrings.zh-Hans.xlf | 182 +++-- .../xlf/CommonLocalizableStrings.zh-Hant.xlf | 182 +++-- .../GivenAFirstTimeUseNoticeSentinel.cs | 12 +- ...nAFunctionReturnStringAndFakeFileSystem.cs | 18 +- .../GivenANuGetCacheSentinel.cs | 17 +- .../FakeFile.cs | 6 +- .../LinuxEnvironmentPathTests.cs | 4 +- .../OsxEnvironmentPathTests.cs | 4 +- .../ShellShimMakerTests.cs | 324 --------- .../ShellShimRepositoryTests.cs | 409 +++++++++++ .../ToolConfigurationDeserializerTests.cs | 2 +- .../ToolPackageInstallerTests.cs | 647 ++++++++++++++++++ .../ToolPackageObtainerTests.cs | 640 ----------------- .../MockFeedType.cs | 3 +- .../ProjectRestorerMock.cs | 160 +++++ .../ShellShimMakerMock.cs | 105 --- .../ShellShimRepositoryMock.cs | 104 +++ .../ToolPackageInstallerMock.cs | 111 +++ .../ToolPackageMock.cs | 127 ++++ .../ToolPackageObtainerMock.cs | 224 ------ .../ToolPackageStoreMock.cs | 51 ++ .../Mock/FileSystemMockBuilder.cs | 62 +- ...ivenThatIWantToShowHelpForDotnetCommand.cs | 1 + .../InstallToolCommandTests.cs | 185 ++--- .../CommandTests/UninstallToolCommandTests.cs | 203 ++++++ 134 files changed, 6376 insertions(+), 3159 deletions(-) delete mode 100644 src/dotnet/ShellShim/CreateShimTransaction.cs delete mode 100644 src/dotnet/ShellShim/IShellShimMaker.cs create mode 100644 src/dotnet/ShellShim/IShellShimRepository.cs create mode 100644 src/dotnet/ShellShim/ShellShimException.cs delete mode 100644 src/dotnet/ShellShim/ShellShimMaker.cs create mode 100644 src/dotnet/ShellShim/ShellShimRepository.cs create mode 100644 src/dotnet/ToolPackage/CommandSettings.cs create mode 100644 src/dotnet/ToolPackage/IToolPackage.cs rename src/dotnet/ToolPackage/{IToolPackageObtainer.cs => IToolPackageInstaller.cs} (58%) create mode 100644 src/dotnet/ToolPackage/IToolPackageStore.cs delete mode 100644 src/dotnet/ToolPackage/PackageVersion.cs delete mode 100644 src/dotnet/ToolPackage/ToolConfigurationAndExecutablePath.cs rename src/dotnet/ToolPackage/{PackageObtainException.cs => ToolPackageException.cs} (52%) create mode 100644 src/dotnet/ToolPackage/ToolPackageInstaller.cs create mode 100644 src/dotnet/ToolPackage/ToolPackageInstance.cs delete mode 100644 src/dotnet/ToolPackage/ToolPackageObtainTransaction.cs delete mode 100644 src/dotnet/ToolPackage/ToolPackageObtainer.cs create mode 100644 src/dotnet/ToolPackage/ToolPackageStore.cs create mode 100644 src/dotnet/TransactionalAction.cs create mode 100644 src/dotnet/commands/dotnet-uninstall/LocalizableStrings.resx create mode 100644 src/dotnet/commands/dotnet-uninstall/UninstallCommand.cs create mode 100644 src/dotnet/commands/dotnet-uninstall/UninstallCommandParser.cs create mode 100644 src/dotnet/commands/dotnet-uninstall/tool/LocalizableStrings.resx create mode 100644 src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs create mode 100644 src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommandParser.cs create mode 100644 src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.cs.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.de.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.es.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.fr.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.it.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ja.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ko.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.pl.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.pt-BR.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ru.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.tr.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.zh-Hans.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.zh-Hant.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.cs.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.de.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.es.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.fr.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.it.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.ja.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.ko.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.pl.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.pt-BR.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.ru.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.tr.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.zh-Hans.xlf create mode 100644 src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.zh-Hant.xlf delete mode 100644 test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs create mode 100644 test/Microsoft.DotNet.ShellShim.Tests/ShellShimRepositoryTests.cs create mode 100644 test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs delete mode 100644 test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs create mode 100644 test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ProjectRestorerMock.cs delete mode 100644 test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimMakerMock.cs create mode 100644 test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimRepositoryMock.cs create mode 100644 test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageInstallerMock.cs create mode 100644 test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageMock.cs delete mode 100644 test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageObtainerMock.cs create mode 100644 test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageStoreMock.cs rename test/dotnet.Tests/{InstallToolCommandTests => CommandTests}/InstallToolCommandTests.cs (56%) create mode 100644 test/dotnet.Tests/CommandTests/UninstallToolCommandTests.cs diff --git a/src/Microsoft.DotNet.Cli.Utils/Constants.cs b/src/Microsoft.DotNet.Cli.Utils/Constants.cs index 187a451d2..ad5d5111d 100644 --- a/src/Microsoft.DotNet.Cli.Utils/Constants.cs +++ b/src/Microsoft.DotNet.Cli.Utils/Constants.cs @@ -21,5 +21,6 @@ namespace Microsoft.DotNet.Cli.Utils public static readonly string ProjectArgumentName = ""; public static readonly string SolutionArgumentName = ""; + public static readonly string ToolPackageArgumentName = ""; } } diff --git a/src/Microsoft.DotNet.InternalAbstractions/DirectoryWrapper.cs b/src/Microsoft.DotNet.InternalAbstractions/DirectoryWrapper.cs index 1e0371cad..2c790b156 100644 --- a/src/Microsoft.DotNet.InternalAbstractions/DirectoryWrapper.cs +++ b/src/Microsoft.DotNet.InternalAbstractions/DirectoryWrapper.cs @@ -19,9 +19,14 @@ namespace Microsoft.Extensions.EnvironmentAbstractions return new TemporaryDirectory(); } - public IEnumerable GetFiles(string path, string searchPattern) + public IEnumerable EnumerateFileSystemEntries(string path) { - return Directory.GetFiles(path, searchPattern); + return Directory.EnumerateFileSystemEntries(path); + } + + public IEnumerable EnumerateFileSystemEntries(string path, string searchPattern) + { + return Directory.EnumerateFileSystemEntries(path, searchPattern); } public string GetDirectoryFullName(string path) @@ -52,5 +57,10 @@ namespace Microsoft.Extensions.EnvironmentAbstractions { Directory.Delete(path, recursive); } + + public void Move(string source, string destination) + { + Directory.Move(source, destination); + } } } diff --git a/src/Microsoft.DotNet.InternalAbstractions/FileWrapper.cs b/src/Microsoft.DotNet.InternalAbstractions/FileWrapper.cs index c134cca0a..512037f33 100644 --- a/src/Microsoft.DotNet.InternalAbstractions/FileWrapper.cs +++ b/src/Microsoft.DotNet.InternalAbstractions/FileWrapper.cs @@ -46,6 +46,11 @@ namespace Microsoft.Extensions.EnvironmentAbstractions File.WriteAllText(path, content); } + public void Move(string source, string destination) + { + File.Move(source, destination); + } + public void Delete(string path) { File.Delete(path); diff --git a/src/Microsoft.DotNet.InternalAbstractions/IDirectory.cs b/src/Microsoft.DotNet.InternalAbstractions/IDirectory.cs index c92db0160..1660bcfa4 100644 --- a/src/Microsoft.DotNet.InternalAbstractions/IDirectory.cs +++ b/src/Microsoft.DotNet.InternalAbstractions/IDirectory.cs @@ -11,12 +11,16 @@ namespace Microsoft.Extensions.EnvironmentAbstractions ITemporaryDirectory CreateTemporaryDirectory(); - IEnumerable GetFiles(string path, string searchPattern); + IEnumerable EnumerateFileSystemEntries(string path); + + IEnumerable EnumerateFileSystemEntries(string path, string searchPattern); string GetDirectoryFullName(string path); void CreateDirectory(string path); void Delete(string path, bool recursive); + + void Move(string source, string destination); } } diff --git a/src/Microsoft.DotNet.InternalAbstractions/IFile.cs b/src/Microsoft.DotNet.InternalAbstractions/IFile.cs index 39b43312a..a04f70dcd 100644 --- a/src/Microsoft.DotNet.InternalAbstractions/IFile.cs +++ b/src/Microsoft.DotNet.InternalAbstractions/IFile.cs @@ -25,6 +25,8 @@ namespace Microsoft.Extensions.EnvironmentAbstractions void WriteAllText(string path, string content); + void Move(string source, string destination); + void Delete(string path); } } diff --git a/src/dotnet/BuiltInCommandsCatalog.cs b/src/dotnet/BuiltInCommandsCatalog.cs index dd2c242d6..b3b1c1824 100644 --- a/src/dotnet/BuiltInCommandsCatalog.cs +++ b/src/dotnet/BuiltInCommandsCatalog.cs @@ -18,6 +18,7 @@ using Microsoft.DotNet.Tools.Run; using Microsoft.DotNet.Tools.Sln; using Microsoft.DotNet.Tools.Store; using Microsoft.DotNet.Tools.Test; +using Microsoft.DotNet.Tools.Uninstall; using Microsoft.DotNet.Tools.VSTest; using System.Collections.Generic; using Microsoft.DotNet.Tools.Install; @@ -149,6 +150,10 @@ namespace Microsoft.DotNet.Cli { Command = InstallCommand.Run }, + ["uninstall"] = new BuiltInCommandMetadata + { + Command = UninstallCommand.Run + }, ["internal-reportinstallsuccess"] = new BuiltInCommandMetadata { Command = InternalReportinstallsuccess.Run diff --git a/src/dotnet/CommonLocalizableStrings.resx b/src/dotnet/CommonLocalizableStrings.resx index 46c5fbd23..fd28bb3cf 100644 --- a/src/dotnet/CommonLocalizableStrings.resx +++ b/src/dotnet/CommonLocalizableStrings.resx @@ -520,9 +520,6 @@ Does not do an implicit restore when executing the command. - - NuGet configuration file {0} does not exist. - Invalid XML: {0} @@ -541,46 +538,77 @@ Command '{0}' uses unsupported runner '{1}'." - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: + + Command '{0}' conflicts with an existing command from another tool. + + + Cannot create shell shim for an empty executable path. + + + Cannot create shell shim for an empty command. + + + Failed to retrieve tool configuration: {0} + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: -cat << EOF >> ~/.bash_profile +cat << \EOF >> ~/.bash_profile # Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: -cat << EOF >> ~/.bash_profile +cat << \EOF >> ~/.bash_profile # Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + + Tools directory '{0}' is not currently on the PATH environment variable. -setx PATH "%PATH%;{1}" +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. - - Failed to change permission: -Error: {0} -Output: {1} + + Failed to create tool shim for command '{0}': {1} - - Failed to install tool {0}. A command with the same name already exists. + + Failed to remove tool shim for command '{0}': {1} + + + Failed to set user executable permissions for shell shim: {0} + + + Failed to install tool package '{0}': {1} + + + Failed to uninstall tool package '{0}': {1} Package '{0}' is missing entry point file {1}. @@ -589,6 +617,6 @@ Output: {1} Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Tool '{0}' is already installed. + Tool '{0}' (version '{1}') is already installed. diff --git a/src/dotnet/Parser.cs b/src/dotnet/Parser.cs index 07639b3ab..076aeb9f3 100644 --- a/src/dotnet/Parser.cs +++ b/src/dotnet/Parser.cs @@ -56,6 +56,7 @@ namespace Microsoft.DotNet.Cli CompleteCommandParser.Complete(), InternalReportinstallsuccessCommandParser.InternalReportinstallsuccess(), InstallCommandParser.Install(), + UninstallCommandParser.Uninstall(), CommonOptions.HelpOption(), Create.Option("--info", ""), Create.Option("-d", ""), diff --git a/src/dotnet/ShellShim/CreateShimTransaction.cs b/src/dotnet/ShellShim/CreateShimTransaction.cs deleted file mode 100644 index f071c78a5..000000000 --- a/src/dotnet/ShellShim/CreateShimTransaction.cs +++ /dev/null @@ -1,52 +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 System.Collections.Generic; -using System.Transactions; -using Microsoft.Extensions.EnvironmentAbstractions; - -namespace Microsoft.DotNet.ShellShim -{ - internal class CreateShimTransaction : IEnlistmentNotification - { - private readonly Action> _createShim; - private readonly Action> _rollback; - private List _locationOfShimDuringTransaction = new List(); - - public CreateShimTransaction( - Action> createShim, - Action> rollback) - { - _createShim = createShim ?? throw new ArgumentNullException(nameof(createShim)); - _rollback = rollback ?? throw new ArgumentNullException(nameof(rollback)); - } - - public void CreateShim() - { - _createShim(_locationOfShimDuringTransaction); - } - - public void Commit(Enlistment enlistment) - { - enlistment.Done(); - } - - public void InDoubt(Enlistment enlistment) - { - Rollback(enlistment); - } - - public void Prepare(PreparingEnlistment preparingEnlistment) - { - preparingEnlistment.Done(); - } - - public void Rollback(Enlistment enlistment) - { - _rollback(_locationOfShimDuringTransaction); - - enlistment.Done(); - } - } -} diff --git a/src/dotnet/ShellShim/DoNothingEnvironmentPath.cs b/src/dotnet/ShellShim/DoNothingEnvironmentPath.cs index 336abab29..f80d63fef 100644 --- a/src/dotnet/ShellShim/DoNothingEnvironmentPath.cs +++ b/src/dotnet/ShellShim/DoNothingEnvironmentPath.cs @@ -9,7 +9,7 @@ using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.ShellShim { - public class DoNothingEnvironmentPath : IEnvironmentPath + internal class DoNothingEnvironmentPath : IEnvironmentPath { public void AddPackageExecutablePathToUserPath() { diff --git a/src/dotnet/ShellShim/IShellShimMaker.cs b/src/dotnet/ShellShim/IShellShimMaker.cs deleted file mode 100644 index 443285ddd..000000000 --- a/src/dotnet/ShellShim/IShellShimMaker.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Microsoft.Extensions.EnvironmentAbstractions; - -namespace Microsoft.DotNet.ShellShim -{ - public interface IShellShimMaker - { - void CreateShim(FilePath packageExecutable, string shellCommandName); - void EnsureCommandNameUniqueness(string shellCommandName); - } -} diff --git a/src/dotnet/ShellShim/IShellShimRepository.cs b/src/dotnet/ShellShim/IShellShimRepository.cs new file mode 100644 index 000000000..737b548df --- /dev/null +++ b/src/dotnet/ShellShim/IShellShimRepository.cs @@ -0,0 +1,13 @@ +// 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.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.ShellShim +{ + internal interface IShellShimRepository + { + void CreateShim(FilePath targetExecutablePath, string commandName); + + void RemoveShim(string commandName); + } +} diff --git a/src/dotnet/ShellShim/LinuxEnvironmentPath.cs b/src/dotnet/ShellShim/LinuxEnvironmentPath.cs index dcea206a4..3ddde8308 100644 --- a/src/dotnet/ShellShim/LinuxEnvironmentPath.cs +++ b/src/dotnet/ShellShim/LinuxEnvironmentPath.cs @@ -75,8 +75,8 @@ namespace Microsoft.DotNet.ShellShim // similar to https://code.visualstudio.com/docs/setup/mac _reporter.WriteLine( string.Format( - CommonLocalizableStrings.EnvironmentPathLinuxManualInstruction, - _packageExecutablePath.Path, _packageExecutablePath.Path)); + CommonLocalizableStrings.EnvironmentPathLinuxManualInstructions, + _packageExecutablePath.Path)); } } } diff --git a/src/dotnet/ShellShim/OsxEnvironmentPath.cs b/src/dotnet/ShellShim/OsxEnvironmentPath.cs index 965a14453..7b64f01c3 100644 --- a/src/dotnet/ShellShim/OsxEnvironmentPath.cs +++ b/src/dotnet/ShellShim/OsxEnvironmentPath.cs @@ -75,8 +75,8 @@ namespace Microsoft.DotNet.ShellShim // similar to https://code.visualstudio.com/docs/setup/mac _reporter.WriteLine( string.Format( - CommonLocalizableStrings.EnvironmentPathOSXManualInstruction, - _packageExecutablePath.Path, _packageExecutablePath.Path)); + CommonLocalizableStrings.EnvironmentPathOSXManualInstructions, + _packageExecutablePath.Path)); } } } diff --git a/src/dotnet/ShellShim/ShellShimException.cs b/src/dotnet/ShellShim/ShellShimException.cs new file mode 100644 index 000000000..9a7adcce3 --- /dev/null +++ b/src/dotnet/ShellShim/ShellShimException.cs @@ -0,0 +1,22 @@ +// 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; + +namespace Microsoft.DotNet.ShellShim +{ + internal class ShellShimException : Exception + { + public ShellShimException() + { + } + + public ShellShimException(string message) : base(message) + { + } + + public ShellShimException(string message, Exception innerException) : base(message, innerException) + { + } + } +} diff --git a/src/dotnet/ShellShim/ShellShimMaker.cs b/src/dotnet/ShellShim/ShellShimMaker.cs deleted file mode 100644 index dbe95371e..000000000 --- a/src/dotnet/ShellShim/ShellShimMaker.cs +++ /dev/null @@ -1,166 +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 System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Transactions; -using System.Xml.Linq; -using Microsoft.DotNet.Cli.Utils; -using Microsoft.DotNet.Tools; -using Microsoft.Extensions.EnvironmentAbstractions; - -namespace Microsoft.DotNet.ShellShim -{ - public class ShellShimMaker : IShellShimMaker - { - private const string LauncherExeResourceName = "Microsoft.DotNet.Tools.Launcher.Executable"; - private const string LauncherConfigResourceName = "Microsoft.DotNet.Tools.Launcher.Config"; - - private readonly string _pathToPlaceShim; - - public ShellShimMaker(string pathToPlaceShim) - { - _pathToPlaceShim = pathToPlaceShim ?? throw new ArgumentNullException(nameof(pathToPlaceShim)); - } - - public void CreateShim(FilePath packageExecutable, string shellCommandName) - { - var createShimTransaction = new CreateShimTransaction( - createShim: locationOfShimDuringTransaction => - { - EnsureCommandNameUniqueness(shellCommandName); - PlaceShim(packageExecutable, shellCommandName, locationOfShimDuringTransaction); - }, - rollback: locationOfShimDuringTransaction => - { - foreach (FilePath f in locationOfShimDuringTransaction) - { - if (File.Exists(f.Value)) - { - File.Delete(f.Value); - } - } - }); - - using (var transactionScope = new TransactionScope()) - { - Transaction.Current.EnlistVolatile(createShimTransaction, EnlistmentOptions.None); - createShimTransaction.CreateShim(); - - transactionScope.Complete(); - } - } - - private void PlaceShim(FilePath packageExecutable, string shellCommandName, List locationOfShimDuringTransaction) - { - FilePath shimPath = GetShimPath(shellCommandName); - - if (!Directory.Exists(shimPath.GetDirectoryPath().Value)) - { - Directory.CreateDirectory(shimPath.GetDirectoryPath().Value); - } - - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - FilePath windowsConfig = GetWindowsConfigPath(shellCommandName); - CreateConfigFile( - windowsConfig, - entryPoint: packageExecutable, - runner: "dotnet"); - - locationOfShimDuringTransaction.Add(windowsConfig); - - using (var shim = File.Create(shimPath.Value)) - using (var exe = typeof(ShellShimMaker).Assembly.GetManifestResourceStream(LauncherExeResourceName)) - { - exe.CopyTo(shim); - } - locationOfShimDuringTransaction.Add(shimPath); - } - else - { - var script = new StringBuilder(); - script.AppendLine("#!/bin/sh"); - script.AppendLine($"dotnet {packageExecutable.ToQuotedString()} \"$@\""); - - File.WriteAllText(shimPath.Value, script.ToString()); - locationOfShimDuringTransaction.Add(shimPath); - - SetUserExecutionPermissionToShimFile(shimPath); - } - } - - public void EnsureCommandNameUniqueness(string shellCommandName) - { - if (File.Exists(GetShimPath(shellCommandName).Value)) - { - throw new GracefulException( - string.Format(CommonLocalizableStrings.FailInstallToolSameName, - shellCommandName)); - } - } - - internal void CreateConfigFile(FilePath outputPath, FilePath entryPoint, string runner) - { - XDocument config; - using(var resource = typeof(ShellShimMaker).Assembly.GetManifestResourceStream(LauncherConfigResourceName)) - { - config = XDocument.Load(resource); - } - - var appSettings = config.Descendants("appSettings").First(); - appSettings.Add(new XElement("add", new XAttribute("key", "entryPoint"), new XAttribute("value", entryPoint.Value))); - appSettings.Add(new XElement("add", new XAttribute("key", "runner"), new XAttribute("value", runner ?? string.Empty))); - config.Save(outputPath.Value); - } - - public void Remove(string shellCommandName) - { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - File.Delete(GetWindowsConfigPath(shellCommandName).Value); - } - - File.Delete(GetShimPath(shellCommandName).Value); - } - - private FilePath GetShimPath(string shellCommandName) - { - var scriptPath = Path.Combine(_pathToPlaceShim, shellCommandName); - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - scriptPath += ".exe"; - } - - return new FilePath(scriptPath); - } - - private FilePath GetWindowsConfigPath(string shellCommandName) - { - return new FilePath(GetShimPath(shellCommandName).Value + ".config"); - } - - private static void SetUserExecutionPermissionToShimFile(FilePath scriptPath) - { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - return; - - CommandResult result = new CommandFactory() - .Create("chmod", new[] { "u+x", scriptPath.Value }) - .CaptureStdOut() - .CaptureStdErr() - .Execute(); - - if (result.ExitCode != 0) - { - throw new GracefulException( - string.Format(CommonLocalizableStrings.FailInstallToolPermission, result.StdErr, - result.StdOut)); - } - } - } -} diff --git a/src/dotnet/ShellShim/ShellShimRepository.cs b/src/dotnet/ShellShim/ShellShimRepository.cs new file mode 100644 index 000000000..92bb55f4b --- /dev/null +++ b/src/dotnet/ShellShim/ShellShimRepository.cs @@ -0,0 +1,213 @@ +// 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 System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Xml.Linq; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.Tools; +using Microsoft.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.ShellShim +{ + internal class ShellShimRepository : IShellShimRepository + { + private const string LauncherExeResourceName = "Microsoft.DotNet.Tools.Launcher.Executable"; + private const string LauncherConfigResourceName = "Microsoft.DotNet.Tools.Launcher.Config"; + + private readonly DirectoryPath _shimsDirectory; + + public ShellShimRepository(DirectoryPath shimsDirectory) + { + _shimsDirectory = shimsDirectory; + } + + public void CreateShim(FilePath targetExecutablePath, string commandName) + { + if (string.IsNullOrEmpty(targetExecutablePath.Value)) + { + throw new ShellShimException(CommonLocalizableStrings.CannotCreateShimForEmptyExecutablePath); + } + if (string.IsNullOrEmpty(commandName)) + { + throw new ShellShimException(CommonLocalizableStrings.CannotCreateShimForEmptyCommand); + } + + if (ShimExists(commandName)) + { + throw new ShellShimException( + string.Format( + CommonLocalizableStrings.ShellShimConflict, + commandName)); + } + + TransactionalAction.Run( + action: () => { + try + { + if (!Directory.Exists(_shimsDirectory.Value)) + { + Directory.CreateDirectory(_shimsDirectory.Value); + } + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + CreateConfigFile( + outputPath: GetWindowsConfigPath(commandName), + entryPoint: targetExecutablePath, + runner: "dotnet"); + + using (var shim = File.Create(GetWindowsShimPath(commandName).Value)) + using (var resource = typeof(ShellShimRepository).Assembly.GetManifestResourceStream(LauncherExeResourceName)) + { + resource.CopyTo(shim); + } + } + else + { + var script = new StringBuilder(); + script.AppendLine("#!/bin/sh"); + script.AppendLine($"dotnet {targetExecutablePath.ToQuotedString()} \"$@\""); + + var shimPath = GetPosixShimPath(commandName); + File.WriteAllText(shimPath.Value, script.ToString()); + + SetUserExecutionPermission(shimPath); + } + } + catch (Exception ex) when (ex is UnauthorizedAccessException || ex is IOException) + { + throw new ShellShimException( + string.Format( + CommonLocalizableStrings.FailedToCreateShellShim, + commandName, + ex.Message + ), + ex); + } + }, + rollback: () => { + foreach (var file in GetShimFiles(commandName).Where(f => File.Exists(f.Value))) + { + File.Delete(file.Value); + } + }); + } + + public void RemoveShim(string commandName) + { + var files = new Dictionary(); + TransactionalAction.Run( + action: () => { + try + { + foreach (var file in GetShimFiles(commandName).Where(f => File.Exists(f.Value))) + { + var tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); + File.Move(file.Value, tempPath); + files[file.Value] = tempPath; + } + } + catch (Exception ex) when (ex is UnauthorizedAccessException || ex is IOException) + { + throw new ShellShimException( + string.Format( + CommonLocalizableStrings.FailedToRemoveShellShim, + commandName, + ex.Message + ), + ex); + } + }, + commit: () => { + foreach (var value in files.Values) + { + File.Delete(value); + } + }, + rollback: () => { + foreach (var kvp in files) + { + File.Move(kvp.Value, kvp.Key); + } + }); + } + + internal void CreateConfigFile(FilePath outputPath, FilePath entryPoint, string runner) + { + XDocument config; + using (var resource = typeof(ShellShimRepository).Assembly.GetManifestResourceStream(LauncherConfigResourceName)) + { + config = XDocument.Load(resource); + } + + var appSettings = config.Descendants("appSettings").First(); + appSettings.Add(new XElement("add", new XAttribute("key", "entryPoint"), new XAttribute("value", entryPoint.Value))); + appSettings.Add(new XElement("add", new XAttribute("key", "runner"), new XAttribute("value", runner ?? string.Empty))); + config.Save(outputPath.Value); + } + + private bool ShimExists(string commandName) + { + return GetShimFiles(commandName).Any(p => File.Exists(p.Value)); + } + + private IEnumerable GetShimFiles(string commandName) + { + if (string.IsNullOrEmpty(commandName)) + { + yield break; + } + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + yield return GetWindowsShimPath(commandName); + yield return GetWindowsConfigPath(commandName); + } + else + { + yield return GetPosixShimPath(commandName); + } + } + + private FilePath GetPosixShimPath(string commandName) + { + return _shimsDirectory.WithFile(commandName); + } + + private FilePath GetWindowsShimPath(string commandName) + { + return new FilePath(_shimsDirectory.WithFile(commandName).Value + ".exe"); + } + + private FilePath GetWindowsConfigPath(string commandName) + { + return new FilePath(GetWindowsShimPath(commandName).Value + ".config"); + } + + private static void SetUserExecutionPermission(FilePath path) + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + return; + } + + CommandResult result = new CommandFactory() + .Create("chmod", new[] { "u+x", path.Value }) + .CaptureStdOut() + .CaptureStdErr() + .Execute(); + + if (result.ExitCode != 0) + { + throw new ShellShimException( + string.Format(CommonLocalizableStrings.FailedSettingShimPermissions, result.StdErr)); + } + } + } +} diff --git a/src/dotnet/ShellShim/WindowsEnvironmentPath.cs b/src/dotnet/ShellShim/WindowsEnvironmentPath.cs index 3ad46b55e..b530e5935 100644 --- a/src/dotnet/ShellShim/WindowsEnvironmentPath.cs +++ b/src/dotnet/ShellShim/WindowsEnvironmentPath.cs @@ -70,8 +70,8 @@ namespace Microsoft.DotNet.ShellShim { _reporter.WriteLine( string.Format( - CommonLocalizableStrings.EnvironmentPathWindowsManualInstruction, - _packageExecutablePath, _packageExecutablePath)); + CommonLocalizableStrings.EnvironmentPathWindowsManualInstructions, + _packageExecutablePath)); } } } diff --git a/src/dotnet/ToolPackage/CommandSettings.cs b/src/dotnet/ToolPackage/CommandSettings.cs new file mode 100644 index 000000000..822d634b2 --- /dev/null +++ b/src/dotnet/ToolPackage/CommandSettings.cs @@ -0,0 +1,24 @@ +// 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.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.ToolPackage +{ + internal class CommandSettings + { + public CommandSettings(string name, string runner, FilePath executable) + { + Name = name ?? throw new ArgumentNullException(nameof(name)); + Runner = runner ?? throw new ArgumentNullException(nameof(runner)); + Executable = executable; + } + + public string Name { get; private set; } + + public string Runner { get; private set; } + + public FilePath Executable { get; private set; } + } +} diff --git a/src/dotnet/ToolPackage/IProjectRestorer.cs b/src/dotnet/ToolPackage/IProjectRestorer.cs index ef68a78a0..86aa06e57 100644 --- a/src/dotnet/ToolPackage/IProjectRestorer.cs +++ b/src/dotnet/ToolPackage/IProjectRestorer.cs @@ -9,10 +9,10 @@ namespace Microsoft.DotNet.ToolPackage internal interface IProjectRestorer { void Restore( - FilePath projectPath, - DirectoryPath assetJsonOutput, - FilePath? nugetconfig, - string source, - string verbosity); + FilePath project, + DirectoryPath assetJsonOutput, + FilePath? nugetConfig = null, + string source = null, + string verbosity = null); } } diff --git a/src/dotnet/ToolPackage/IToolPackage.cs b/src/dotnet/ToolPackage/IToolPackage.cs new file mode 100644 index 000000000..3ee968cb9 --- /dev/null +++ b/src/dotnet/ToolPackage/IToolPackage.cs @@ -0,0 +1,22 @@ +// 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 System.Collections.Generic; +using Microsoft.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.ToolPackage +{ + internal interface IToolPackage + { + string PackageId { get; } + + string PackageVersion { get; } + + DirectoryPath PackageDirectory { get; } + + IReadOnlyList Commands { get; } + + void Uninstall(); + } +} diff --git a/src/dotnet/ToolPackage/IToolPackageObtainer.cs b/src/dotnet/ToolPackage/IToolPackageInstaller.cs similarity index 58% rename from src/dotnet/ToolPackage/IToolPackageObtainer.cs rename to src/dotnet/ToolPackage/IToolPackageInstaller.cs index 5bc95c669..d8501d22d 100644 --- a/src/dotnet/ToolPackage/IToolPackageObtainer.cs +++ b/src/dotnet/ToolPackage/IToolPackageInstaller.cs @@ -1,18 +1,19 @@ // 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 System.Collections.Generic; using Microsoft.Extensions.EnvironmentAbstractions; namespace Microsoft.DotNet.ToolPackage { - internal interface IToolPackageObtainer + internal interface IToolPackageInstaller { - ToolConfigurationAndExecutablePath ObtainAndReturnExecutablePath( - string packageId, - string packageVersion = null, - FilePath? nugetconfig = null, - string targetframework = null, + IToolPackage InstallPackage( + string packageId, + string packageVersion = null, + string targetFramework = null, + FilePath? nugetConfig = null, string source = null, string verbosity = null); } diff --git a/src/dotnet/ToolPackage/IToolPackageStore.cs b/src/dotnet/ToolPackage/IToolPackageStore.cs new file mode 100644 index 000000000..31bea417f --- /dev/null +++ b/src/dotnet/ToolPackage/IToolPackageStore.cs @@ -0,0 +1,16 @@ +// 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 System.Collections.Generic; +using Microsoft.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.ToolPackage +{ + internal interface IToolPackageStore + { + DirectoryPath Root { get; } + + IEnumerable GetInstalledPackages(string packageId); + } +} diff --git a/src/dotnet/ToolPackage/PackageVersion.cs b/src/dotnet/ToolPackage/PackageVersion.cs deleted file mode 100644 index d66748ad1..000000000 --- a/src/dotnet/ToolPackage/PackageVersion.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.IO; - -namespace Microsoft.DotNet.ToolPackage -{ - internal class PackageVersion - { - public PackageVersion(string packageVersion) - { - if (packageVersion == null) - { - Value = Path.GetRandomFileName(); - IsPlaceholder = true; - } - else - { - Value = packageVersion; - IsPlaceholder = false; - } - } - - public bool IsPlaceholder { get; } - public string Value { get; } - public bool IsConcreteValue => !IsPlaceholder; - } -} diff --git a/src/dotnet/ToolPackage/ToolConfigurationAndExecutablePath.cs b/src/dotnet/ToolPackage/ToolConfigurationAndExecutablePath.cs deleted file mode 100644 index b191155b2..000000000 --- a/src/dotnet/ToolPackage/ToolConfigurationAndExecutablePath.cs +++ /dev/null @@ -1,22 +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 Microsoft.Extensions.EnvironmentAbstractions; - -namespace Microsoft.DotNet.ToolPackage -{ - internal class ToolConfigurationAndExecutablePath - { - public ToolConfigurationAndExecutablePath( - ToolConfiguration toolConfiguration, - FilePath executable) - { - Configuration = toolConfiguration; - Executable = executable; - } - - public ToolConfiguration Configuration { get; } - - public FilePath Executable { get; } - } -} diff --git a/src/dotnet/ToolPackage/ToolConfigurationDeserializer.cs b/src/dotnet/ToolPackage/ToolConfigurationDeserializer.cs index 4b1a7a831..7d943c36e 100644 --- a/src/dotnet/ToolPackage/ToolConfigurationDeserializer.cs +++ b/src/dotnet/ToolPackage/ToolConfigurationDeserializer.cs @@ -18,21 +18,29 @@ namespace Microsoft.DotNet.ToolPackage DotNetCliTool dotNetCliTool; - using (var fs = new FileStream(pathToXml, FileMode.Open)) + try { - var reader = XmlReader.Create(fs); - - try + using (var fs = new FileStream(pathToXml, FileMode.Open)) { + var reader = XmlReader.Create(fs); dotNetCliTool = (DotNetCliTool)serializer.Deserialize(reader); } - catch (InvalidOperationException e) when (e.InnerException is XmlException) - { - throw new ToolConfigurationException( - string.Format( - CommonLocalizableStrings.ToolSettingsInvalidXml, - e.InnerException.Message)); - } + } + catch (InvalidOperationException ex) when (ex.InnerException is XmlException) + { + throw new ToolConfigurationException( + string.Format( + CommonLocalizableStrings.ToolSettingsInvalidXml, + ex.InnerException.Message), + ex.InnerException); + } + catch (Exception ex) when (ex is IOException || ex is UnauthorizedAccessException) + { + throw new ToolConfigurationException( + string.Format( + CommonLocalizableStrings.FailedToRetrieveToolConfiguration, + ex.Message), + ex); } if (dotNetCliTool.Commands.Length != 1) diff --git a/src/dotnet/ToolPackage/ToolConfigurationException.cs b/src/dotnet/ToolPackage/ToolConfigurationException.cs index 97c49b421..2a0710f08 100644 --- a/src/dotnet/ToolPackage/ToolConfigurationException.cs +++ b/src/dotnet/ToolPackage/ToolConfigurationException.cs @@ -5,10 +5,18 @@ using System; namespace Microsoft.DotNet.ToolPackage { - internal class ToolConfigurationException : ArgumentException + internal class ToolConfigurationException : Exception { + public ToolConfigurationException() + { + } + public ToolConfigurationException(string message) : base(message) { } + + public ToolConfigurationException(string message, Exception innerException) : base(message, innerException) + { + } } } diff --git a/src/dotnet/ToolPackage/PackageObtainException.cs b/src/dotnet/ToolPackage/ToolPackageException.cs similarity index 52% rename from src/dotnet/ToolPackage/PackageObtainException.cs rename to src/dotnet/ToolPackage/ToolPackageException.cs index b165e0e5d..a4bf8e68f 100644 --- a/src/dotnet/ToolPackage/PackageObtainException.cs +++ b/src/dotnet/ToolPackage/ToolPackageException.cs @@ -5,17 +5,17 @@ using System; namespace Microsoft.DotNet.ToolPackage { - internal class PackageObtainException : Exception + internal class ToolPackageException : Exception { - public PackageObtainException() + public ToolPackageException() { } - public PackageObtainException(string message) : base(message) + public ToolPackageException(string message) : base(message) { } - public PackageObtainException(string message, Exception innerException) : base(message, innerException) + public ToolPackageException(string message, Exception innerException) : base(message, innerException) { } } diff --git a/src/dotnet/ToolPackage/ToolPackageInstaller.cs b/src/dotnet/ToolPackage/ToolPackageInstaller.cs new file mode 100644 index 000000000..e30a4cc7e --- /dev/null +++ b/src/dotnet/ToolPackage/ToolPackageInstaller.cs @@ -0,0 +1,171 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Xml.Linq; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Configurer; +using Microsoft.DotNet.Tools; +using Microsoft.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.ToolPackage +{ + internal class ToolPackageInstaller : IToolPackageInstaller + { + public const string StagingDirectory = ".stage"; + + private readonly IToolPackageStore _store; + private readonly IProjectRestorer _projectRestorer; + private readonly FilePath? _tempProject; + private readonly DirectoryPath _offlineFeed; + + public ToolPackageInstaller( + IToolPackageStore store, + IProjectRestorer projectRestorer, + FilePath? tempProject = null, + DirectoryPath? offlineFeed = null) + { + _store = store ?? throw new ArgumentNullException(nameof(store)); + _projectRestorer = projectRestorer ?? throw new ArgumentNullException(nameof(projectRestorer)); + _tempProject = tempProject; + _offlineFeed = offlineFeed ?? new DirectoryPath(new CliFolderPathCalculator().CliFallbackFolderPath); + } + + public IToolPackage InstallPackage( + string packageId, + string packageVersion = null, + string targetFramework = null, + FilePath? nugetConfig = null, + string source = null, + string verbosity = null) + { + if (packageId == null) + { + throw new ArgumentNullException(nameof(packageId)); + } + + var packageRootDirectory = _store.Root.WithSubDirectories(packageId); + string rollbackDirectory = null; + + return TransactionalAction.Run( + action: () => { + try + { + + var stageDirectory = _store.Root.WithSubDirectories(StagingDirectory, Path.GetRandomFileName()); + Directory.CreateDirectory(stageDirectory.Value); + rollbackDirectory = stageDirectory.Value; + + var tempProject = CreateTempProject( + packageId: packageId, + packageVersion: packageVersion, + targetFramework: targetFramework ?? BundledTargetFramework.GetTargetFrameworkMoniker(), + restoreDirectory: stageDirectory); + + try + { + _projectRestorer.Restore( + tempProject, + stageDirectory, + nugetConfig, + source, + verbosity); + } + finally + { + File.Delete(tempProject.Value); + } + + packageVersion = Path.GetFileName( + Directory.EnumerateDirectories( + stageDirectory.WithSubDirectories(packageId).Value).Single()); + + var packageDirectory = packageRootDirectory.WithSubDirectories(packageVersion); + if (Directory.Exists(packageDirectory.Value)) + { + throw new ToolPackageException( + string.Format( + CommonLocalizableStrings.ToolPackageConflictPackageId, + packageId, + packageVersion)); + } + + Directory.CreateDirectory(packageRootDirectory.Value); + Directory.Move(stageDirectory.Value, packageDirectory.Value); + rollbackDirectory = packageDirectory.Value; + + return new ToolPackageInstance( + _store, + packageId, + packageVersion, + packageDirectory); + } + catch (Exception ex) when (ex is UnauthorizedAccessException || ex is IOException) + { + throw new ToolPackageException( + string.Format( + CommonLocalizableStrings.FailedToInstallToolPackage, + packageId, + ex.Message), + ex); + } + }, + rollback: () => { + if (!string.IsNullOrEmpty(rollbackDirectory) && Directory.Exists(rollbackDirectory)) + { + Directory.Delete(rollbackDirectory, true); + } + + // Delete the root if it is empty + if (Directory.Exists(packageRootDirectory.Value) && + !Directory.EnumerateFileSystemEntries(packageRootDirectory.Value).Any()) + { + Directory.Delete(packageRootDirectory.Value, false); + } + }); + } + + private FilePath CreateTempProject( + string packageId, + string packageVersion, + string targetFramework, + DirectoryPath restoreDirectory) + { + var tempProject = _tempProject ?? new DirectoryPath(Path.GetTempPath()) + .WithSubDirectories(Path.GetRandomFileName()) + .WithFile(Path.GetRandomFileName() + ".csproj"); + + if (Path.GetExtension(tempProject.Value) != "csproj") + { + tempProject = new FilePath(Path.ChangeExtension(tempProject.Value, "csproj")); + } + + Directory.CreateDirectory(tempProject.GetDirectoryPath().Value); + + var tempProjectContent = new XDocument( + new XElement("Project", + new XAttribute("Sdk", "Microsoft.NET.Sdk"), + new XElement("PropertyGroup", + new XElement("TargetFramework", targetFramework), + new XElement("RestorePackagesPath", restoreDirectory.Value), + new XElement("RestoreProjectStyle", "DotnetToolReference"), // without it, project cannot reference tool package + new XElement("RestoreRootConfigDirectory", Directory.GetCurrentDirectory()), // config file probing start directory + new XElement("DisableImplicitFrameworkReferences", "true"), // no Microsoft.NETCore.App in tool folder + new XElement("RestoreFallbackFolders", "clear"), // do not use fallbackfolder, tool package need to be copied to tool folder + new XElement("RestoreAdditionalProjectSources", // use fallbackfolder as feed to enable offline + Directory.Exists(_offlineFeed.Value) ? _offlineFeed.Value : string.Empty), + new XElement("RestoreAdditionalProjectFallbackFolders", string.Empty), // block other + new XElement("RestoreAdditionalProjectFallbackFoldersExcludes", string.Empty), // block other + new XElement("DisableImplicitNuGetFallbackFolder", "true")), // disable SDK side implicit NuGetFallbackFolder + new XElement("ItemGroup", + new XElement("PackageReference", + new XAttribute("Include", packageId), + new XAttribute("Version", packageVersion ?? "*") // nuget will restore * for latest + )) + )); + + File.WriteAllText(tempProject.Value, tempProjectContent.ToString()); + return tempProject; + } + } +} diff --git a/src/dotnet/ToolPackage/ToolPackageInstance.cs b/src/dotnet/ToolPackage/ToolPackageInstance.cs new file mode 100644 index 000000000..0d28cfe97 --- /dev/null +++ b/src/dotnet/ToolPackage/ToolPackageInstance.cs @@ -0,0 +1,174 @@ +using System; +using System.IO; +using System.Linq; +using System.Collections.Generic; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Tools; +using Microsoft.Extensions.EnvironmentAbstractions; +using NuGet.ProjectModel; + +namespace Microsoft.DotNet.ToolPackage +{ + // This is named "ToolPackageInstance" because "ToolPackage" would conflict with the namespace + internal class ToolPackageInstance : IToolPackage + { + private IToolPackageStore _store; + private Lazy> _commands; + + public ToolPackageInstance( + IToolPackageStore store, + string packageId, + string packageVersion, + DirectoryPath packageDirectory) + { + _store = store ?? throw new ArgumentNullException(nameof(store)); + PackageId = packageId ?? throw new ArgumentNullException(nameof(packageId)); + PackageVersion = packageVersion ?? throw new ArgumentNullException(nameof(packageVersion)); + PackageDirectory = packageDirectory; + _commands = new Lazy>(GetCommands); + } + + public string PackageId { get; private set; } + + public string PackageVersion { get; private set; } + + public DirectoryPath PackageDirectory { get; private set; } + + public IReadOnlyList Commands + { + get + { + return _commands.Value; + } + } + + public void Uninstall() + { + var rootDirectory = PackageDirectory.GetParentPath(); + string tempPackageDirectory = null; + + TransactionalAction.Run( + action: () => { + try + { + if (Directory.Exists(PackageDirectory.Value)) + { + // Use the same staging directory for uninstall instead of temp + // This prevents cross-device moves when temp is mounted to a different device + var tempPath = _store + .Root + .WithSubDirectories(ToolPackageInstaller.StagingDirectory) + .WithFile(Path.GetRandomFileName()) + .Value; + Directory.Move(PackageDirectory.Value, tempPath); + tempPackageDirectory = tempPath; + } + + if (Directory.Exists(rootDirectory.Value) && + !Directory.EnumerateFileSystemEntries(rootDirectory.Value).Any()) + { + Directory.Delete(rootDirectory.Value, false); + } + } + catch (Exception ex) when (ex is UnauthorizedAccessException || ex is IOException) + { + throw new ToolPackageException( + string.Format( + CommonLocalizableStrings.FailedToUninstallToolPackage, + PackageId, + ex.Message), + ex); + } + }, + commit: () => { + if (tempPackageDirectory != null) + { + Directory.Delete(tempPackageDirectory, true); + } + }, + rollback: () => { + if (tempPackageDirectory != null) + { + Directory.CreateDirectory(rootDirectory.Value); + Directory.Move(tempPackageDirectory, PackageDirectory.Value); + } + }); + } + + private IReadOnlyList GetCommands() + { + const string AssetsFileName = "project.assets.json"; + const string ToolSettingsFileName = "DotnetToolSettings.xml"; + + try + { + var commands = new List(); + var lockFile = new LockFileFormat().Read(PackageDirectory.WithFile(AssetsFileName).Value); + + var library = FindLibraryInLockFile(lockFile); + var dotnetToolSettings = FindItemInTargetLibrary(library, ToolSettingsFileName); + if (dotnetToolSettings == null) + { + throw new ToolPackageException( + string.Format( + CommonLocalizableStrings.ToolPackageMissingSettingsFile, + PackageId)); + } + + var toolConfigurationPath = + PackageDirectory + .WithSubDirectories( + PackageId, + library.Version.ToNormalizedString()) + .WithFile(dotnetToolSettings.Path); + + var configuration = ToolConfigurationDeserializer.Deserialize(toolConfigurationPath.Value); + + var entryPointFromLockFile = FindItemInTargetLibrary(library, configuration.ToolAssemblyEntryPoint); + if (entryPointFromLockFile == null) + { + throw new ToolPackageException( + string.Format( + CommonLocalizableStrings.ToolPackageMissingEntryPointFile, + PackageId, + configuration.ToolAssemblyEntryPoint)); + } + + // Currently only "dotnet" commands are supported + commands.Add(new CommandSettings( + configuration.CommandName, + "dotnet", + PackageDirectory + .WithSubDirectories( + PackageId, + library.Version.ToNormalizedString()) + .WithFile(entryPointFromLockFile.Path))); + + return commands; + } + catch (Exception ex) when (ex is UnauthorizedAccessException || ex is IOException) + { + throw new ToolPackageException( + string.Format( + CommonLocalizableStrings.FailedToRetrieveToolConfiguration, + PackageId, + ex.Message), + ex); + } + } + + private LockFileTargetLibrary FindLibraryInLockFile(LockFile lockFile) + { + return lockFile + ?.Targets?.SingleOrDefault(t => t.RuntimeIdentifier != null) + ?.Libraries?.SingleOrDefault(l => l.Name == PackageId); + } + + private static LockFileItem FindItemInTargetLibrary(LockFileTargetLibrary library, string targetRelativeFilePath) + { + return library + ?.ToolsAssemblies + ?.SingleOrDefault(t => LockFileMatcher.MatchesFile(t, targetRelativeFilePath)); + } + } +} diff --git a/src/dotnet/ToolPackage/ToolPackageObtainTransaction.cs b/src/dotnet/ToolPackage/ToolPackageObtainTransaction.cs deleted file mode 100644 index 3a161669e..000000000 --- a/src/dotnet/ToolPackage/ToolPackageObtainTransaction.cs +++ /dev/null @@ -1,52 +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 System.Collections.Generic; -using System.Transactions; -using Microsoft.Extensions.EnvironmentAbstractions; - -namespace Microsoft.DotNet.ToolPackage -{ - internal class ToolPackageObtainTransaction : IEnlistmentNotification - { - private readonly Func, ToolConfigurationAndExecutablePath> _obtainAndReturnExecutablePath; - private readonly Action> _rollback; - private List _locationOfPackageDuringTransaction = new List(); - - public ToolPackageObtainTransaction( - Func, ToolConfigurationAndExecutablePath> obtainAndReturnExecutablePath, - Action> rollback) - { - _obtainAndReturnExecutablePath = obtainAndReturnExecutablePath ?? throw new ArgumentNullException(nameof(obtainAndReturnExecutablePath)); - _rollback = rollback ?? throw new ArgumentNullException(nameof(rollback)); - } - - public ToolConfigurationAndExecutablePath ObtainAndReturnExecutablePath() - { - return _obtainAndReturnExecutablePath(_locationOfPackageDuringTransaction); - } - - public void Commit(Enlistment enlistment) - { - enlistment.Done(); - } - - public void InDoubt(Enlistment enlistment) - { - Rollback(enlistment); - } - - public void Prepare(PreparingEnlistment preparingEnlistment) - { - preparingEnlistment.Done(); - } - - public void Rollback(Enlistment enlistment) - { - _rollback(_locationOfPackageDuringTransaction); - - enlistment.Done(); - } - } -} diff --git a/src/dotnet/ToolPackage/ToolPackageObtainer.cs b/src/dotnet/ToolPackage/ToolPackageObtainer.cs deleted file mode 100644 index ae78b94f4..000000000 --- a/src/dotnet/ToolPackage/ToolPackageObtainer.cs +++ /dev/null @@ -1,278 +0,0 @@ -using System; -using System.IO; -using System.Linq; -using System.Transactions; -using System.Xml.Linq; -using Microsoft.DotNet.Cli; -using Microsoft.DotNet.Cli.Utils; -using Microsoft.DotNet.Tools; -using Microsoft.Extensions.EnvironmentAbstractions; -using NuGet.ProjectModel; - -namespace Microsoft.DotNet.ToolPackage -{ - internal class ToolPackageObtainer : IToolPackageObtainer - { - private readonly Lazy _bundledTargetFrameworkMoniker; - private readonly Func _getTempProjectPath; - private readonly IProjectRestorer _projectRestorer; - private readonly DirectoryPath _toolsPath; - private readonly DirectoryPath _offlineFeedPath; - - public ToolPackageObtainer( - DirectoryPath toolsPath, - DirectoryPath offlineFeedPath, - Func getTempProjectPath, - Lazy bundledTargetFrameworkMoniker, - IProjectRestorer projectRestorer - ) - { - _getTempProjectPath = getTempProjectPath; - _bundledTargetFrameworkMoniker = bundledTargetFrameworkMoniker; - _projectRestorer = projectRestorer ?? throw new ArgumentNullException(nameof(projectRestorer)); - _toolsPath = toolsPath; - _offlineFeedPath = offlineFeedPath; - } - - public ToolConfigurationAndExecutablePath ObtainAndReturnExecutablePath( - string packageId, - string packageVersion = null, - FilePath? nugetconfig = null, - string targetframework = null, - string source = null, - string verbosity = null) - { - var stageDirectory = _toolsPath.WithSubDirectories(".stage", Path.GetRandomFileName()); - - var toolPackageObtainTransaction = new ToolPackageObtainTransaction( - obtainAndReturnExecutablePath: (locationOfPackageDuringTransaction) => - { - if (Directory.Exists(_toolsPath.WithSubDirectories(packageId).Value)) - { - throw new PackageObtainException( - string.Format(CommonLocalizableStrings.ToolPackageConflictPackageId, packageId)); - } - - locationOfPackageDuringTransaction.Add(stageDirectory); - var toolConfigurationAndExecutablePath = ObtainAndReturnExecutablePathInStageFolder( - packageId, - stageDirectory, - packageVersion, - nugetconfig, - targetframework, - source, - verbosity); - - DirectoryPath destinationDirectory = _toolsPath.WithSubDirectories(packageId); - - Directory.Move( - stageDirectory.Value, - destinationDirectory.Value); - - locationOfPackageDuringTransaction.Clear(); - locationOfPackageDuringTransaction.Add(destinationDirectory); - - return toolConfigurationAndExecutablePath; - }, - rollback: (locationOfPackageDuringTransaction) => - { - foreach (DirectoryPath l in locationOfPackageDuringTransaction) - { - if (Directory.Exists(l.Value)) - { - Directory.Delete(l.Value, recursive: true); - } - } - } - ); - - using (var transactionScope = new TransactionScope()) - { - Transaction.Current.EnlistVolatile(toolPackageObtainTransaction, EnlistmentOptions.None); - var toolConfigurationAndExecutablePath = toolPackageObtainTransaction.ObtainAndReturnExecutablePath(); - - transactionScope.Complete(); - return toolConfigurationAndExecutablePath; - } - } - - private ToolConfigurationAndExecutablePath ObtainAndReturnExecutablePathInStageFolder( - string packageId, - DirectoryPath stageDirectory, - string packageVersion = null, - FilePath? nugetconfig = null, - string targetframework = null, - string source = null, - string verbosity = null) - { - if (packageId == null) - { - throw new ArgumentNullException(nameof(packageId)); - } - - if (nugetconfig != null) - { - if (!File.Exists(nugetconfig.Value.Value)) - { - throw new PackageObtainException( - string.Format(CommonLocalizableStrings.NuGetConfigurationFileDoesNotExist, - Path.GetFullPath(nugetconfig.Value.Value))); - } - } - - if (targetframework == null) - { - targetframework = _bundledTargetFrameworkMoniker.Value; - } - - var packageVersionOrPlaceHolder = new PackageVersion(packageVersion); - - DirectoryPath nugetSandboxDirectory = - CreateNugetSandboxDirectory(packageVersionOrPlaceHolder, stageDirectory); - - FilePath tempProjectPath = CreateTempProject( - packageId, - packageVersionOrPlaceHolder, - targetframework, - nugetSandboxDirectory); - - _projectRestorer.Restore(tempProjectPath, nugetSandboxDirectory, nugetconfig, source, verbosity); - - if (packageVersionOrPlaceHolder.IsPlaceholder) - { - var concreteVersion = - new DirectoryInfo( - Directory.GetDirectories( - nugetSandboxDirectory.WithSubDirectories(packageId).Value).Single()).Name; - DirectoryPath versioned = - nugetSandboxDirectory.GetParentPath().WithSubDirectories(concreteVersion); - - MoveToVersionedDirectory(versioned, nugetSandboxDirectory); - - nugetSandboxDirectory = versioned; - packageVersion = concreteVersion; - } - - LockFile lockFile = new LockFileFormat() - .ReadWithLock(nugetSandboxDirectory.WithFile("project.assets.json").Value) - .Result; - - LockFileItem dotnetToolSettings = FindAssetInLockFile(lockFile, "DotnetToolSettings.xml", packageId); - - if (dotnetToolSettings == null) - { - throw new PackageObtainException( - string.Format(CommonLocalizableStrings.ToolPackageMissingSettingsFile, packageId)); - } - - FilePath toolConfigurationPath = - nugetSandboxDirectory - .WithSubDirectories(packageId, packageVersion) - .WithFile(dotnetToolSettings.Path); - - ToolConfiguration toolConfiguration = - ToolConfigurationDeserializer.Deserialize(toolConfigurationPath.Value); - - var entryPointFromLockFile = - FindAssetInLockFile(lockFile, toolConfiguration.ToolAssemblyEntryPoint, packageId); - - if (entryPointFromLockFile == null) - { - throw new PackageObtainException(string.Format(CommonLocalizableStrings.ToolPackageMissingEntryPointFile, - packageId, toolConfiguration.ToolAssemblyEntryPoint)); - } - - return new ToolConfigurationAndExecutablePath( - toolConfiguration, - _toolsPath.WithSubDirectories( - packageId, - packageVersion, - packageId, - packageVersion) - .WithFile(entryPointFromLockFile.Path)); - } - - private static LockFileItem FindAssetInLockFile( - LockFile lockFile, - string targetRelativeFilePath, string packageId) - { - return lockFile - .Targets?.SingleOrDefault(t => t.RuntimeIdentifier != null) - ?.Libraries?.SingleOrDefault(l => l.Name == packageId) - ?.ToolsAssemblies - ?.SingleOrDefault(t => LockFileMatcher.MatchesFile(t, targetRelativeFilePath)); - } - - private static void MoveToVersionedDirectory( - DirectoryPath versioned, - DirectoryPath temporary) - { - if (Directory.Exists(versioned.Value)) - { - Directory.Delete(versioned.Value, recursive: true); - } - - Directory.Move(temporary.Value, versioned.Value); - } - - private FilePath CreateTempProject( - string packageId, - PackageVersion packageVersion, - string targetframework, - DirectoryPath individualToolVersion) - { - FilePath tempProjectPath = _getTempProjectPath(); - if (Path.GetExtension(tempProjectPath.Value) != "csproj") - { - tempProjectPath = new FilePath(Path.ChangeExtension(tempProjectPath.Value, "csproj")); - } - - EnsureDirectoryExists(tempProjectPath.GetDirectoryPath()); - var tempProjectContent = new XDocument( - new XElement("Project", - new XAttribute("Sdk", "Microsoft.NET.Sdk"), - new XElement("PropertyGroup", - new XElement("TargetFramework", targetframework), - new XElement("RestorePackagesPath", individualToolVersion.Value), // tool package will restore to tool folder - new XElement("RestoreProjectStyle", "DotnetToolReference"), // without it, project cannot reference tool package - new XElement("RestoreRootConfigDirectory", Directory.GetCurrentDirectory()), // config file probing start directory - new XElement("DisableImplicitFrameworkReferences", "true"), // no Microsoft.NETCore.App in tool folder - new XElement("RestoreFallbackFolders", "clear"), // do not use fallbackfolder, tool package need to be copied to tool folder - new XElement("RestoreAdditionalProjectSources", // use fallbackfolder as feed to enable offline - Directory.Exists(_offlineFeedPath.Value) ? _offlineFeedPath.Value : string.Empty), - new XElement("RestoreAdditionalProjectFallbackFolders", string.Empty), // block other - new XElement("RestoreAdditionalProjectFallbackFoldersExcludes", string.Empty), // block other - new XElement("DisableImplicitNuGetFallbackFolder", "true")), // disable SDK side implicit NuGetFallbackFolder - new XElement("ItemGroup", - new XElement("PackageReference", - new XAttribute("Include", packageId), - new XAttribute("Version", packageVersion.IsConcreteValue ? packageVersion.Value : "*") // nuget will restore * for latest - )) - )); - - - File.WriteAllText(tempProjectPath.Value, - tempProjectContent.ToString()); - - return tempProjectPath; - } - - private DirectoryPath CreateNugetSandboxDirectory( - PackageVersion packageVersion, - DirectoryPath stageDirectory - ) - { - DirectoryPath individualToolVersion = stageDirectory.WithSubDirectories(packageVersion.Value); - EnsureDirectoryExists(individualToolVersion); - return individualToolVersion; - } - - private static void EnsureDirectoryExists(DirectoryPath path) - { - if (!Directory.Exists(path.Value)) - { - Directory.CreateDirectory(path.Value); - } - } - } -} diff --git a/src/dotnet/ToolPackage/ToolPackageStore.cs b/src/dotnet/ToolPackage/ToolPackageStore.cs new file mode 100644 index 000000000..d2a9f79f1 --- /dev/null +++ b/src/dotnet/ToolPackage/ToolPackageStore.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Microsoft.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.ToolPackage +{ + internal class ToolPackageStore : IToolPackageStore + { + public ToolPackageStore(DirectoryPath root) + { + Root = root; + } + + public DirectoryPath Root { get; private set; } + + public IEnumerable GetInstalledPackages(string packageId) + { + if (packageId == null) + { + throw new ArgumentNullException(nameof(packageId)); + } + + var packageRootDirectory = Root.WithSubDirectories(packageId); + if (!Directory.Exists(packageRootDirectory.Value)) + { + yield break; + } + + foreach (var subdirectory in Directory.EnumerateDirectories(packageRootDirectory.Value)) + { + var version = Path.GetFileName(subdirectory); + yield return new ToolPackageInstance( + this, + packageId, + version, + packageRootDirectory.WithSubDirectories(version)); + } + } + } +} diff --git a/src/dotnet/TransactionalAction.cs b/src/dotnet/TransactionalAction.cs new file mode 100644 index 000000000..087b98311 --- /dev/null +++ b/src/dotnet/TransactionalAction.cs @@ -0,0 +1,94 @@ +// 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 System.Transactions; + +namespace Microsoft.DotNet.Cli +{ + public sealed class TransactionalAction + { + private class EnlistmentNotification : IEnlistmentNotification + { + private Action _commit; + private Action _rollback; + + public EnlistmentNotification(Action commit, Action rollback) + { + _commit = commit; + _rollback = rollback; + } + + public void Commit(Enlistment enlistment) + { + if (_commit != null) + { + _commit(); + _commit = null; + } + + enlistment.Done(); + } + + public void InDoubt(Enlistment enlistment) + { + Rollback(enlistment); + } + + public void Prepare(PreparingEnlistment enlistment) + { + enlistment.Prepared(); + } + + public void Rollback(Enlistment enlistment) + { + if (_rollback != null) + { + _rollback(); + _rollback = null; + } + + enlistment.Done(); + } + } + + public static T Run( + Func action, + Action commit = null, + Action rollback = null) + { + if (action == null) + { + throw new ArgumentNullException(nameof(action)); + } + + // This automatically inherits any ambient transaction + // If a transaction is inherited, completing this scope will be a no-op + T result = default(T); + using (var scope = new TransactionScope( + TransactionScopeOption.Required, + TimeSpan.Zero)) + { + Transaction.Current.EnlistVolatile( + new EnlistmentNotification(commit, rollback), + EnlistmentOptions.None); + + result = action(); + + scope.Complete(); + } + return result; + } + + public static void Run( + Action action, + Action commit = null, + Action rollback = null) + { + Run( + action: () => { action(); return null; }, + commit: commit, + rollback: rollback); + } + } +} diff --git a/src/dotnet/commands/dotnet-help/HelpUsageText.cs b/src/dotnet/commands/dotnet-help/HelpUsageText.cs index 51688af71..1dc376171 100644 --- a/src/dotnet/commands/dotnet-help/HelpUsageText.cs +++ b/src/dotnet/commands/dotnet-help/HelpUsageText.cs @@ -29,6 +29,7 @@ path-to-application: vstest {LocalizableStrings.VsTestDefinition} store {LocalizableStrings.StoreDefinition} install {LocalizableStrings.InstallDefinition} + uninstall {LocalizableStrings.UninstallDefinition} help {LocalizableStrings.HelpDefinition} {LocalizableStrings.CommonOptions}: diff --git a/src/dotnet/commands/dotnet-help/LocalizableStrings.resx b/src/dotnet/commands/dotnet-help/LocalizableStrings.resx index a8fded7b1..8b0c84730 100644 --- a/src/dotnet/commands/dotnet-help/LocalizableStrings.resx +++ b/src/dotnet/commands/dotnet-help/LocalizableStrings.resx @@ -270,4 +270,7 @@ Installs an item into the development environment. + + Uninstalls a tool from the development environment. + diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf index 31b6a6293..b348a5041 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf @@ -257,6 +257,11 @@ Nainstaluje položku do vývojového prostředí. + + Uninstalls a tool from the development environment. + Uninstalls a tool from the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf index c7d6ce3f0..c56460685 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf @@ -257,6 +257,11 @@ Installiert ein Element in der Entwicklungsumgebung. + + Uninstalls a tool from the development environment. + Uninstalls a tool from the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf index 84d72d556..6752e1b76 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf @@ -257,6 +257,11 @@ Instala un elemento en el entorno de desarrollo. + + Uninstalls a tool from the development environment. + Uninstalls a tool from the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf index 0cfb2d136..d1de6fd3a 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf @@ -257,6 +257,11 @@ Installe un élément dans l'environnement de développement. + + Uninstalls a tool from the development environment. + Uninstalls a tool from the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf index 86c18a6cc..d6b573506 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf @@ -257,6 +257,11 @@ Installa un elemento nell'ambiente di sviluppo. + + Uninstalls a tool from the development environment. + Uninstalls a tool from the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf index d65d68b4f..056874d3f 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf @@ -257,6 +257,11 @@ 項目を開発環境にインストールします。 + + Uninstalls a tool from the development environment. + Uninstalls a tool from the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf index 04844d4b5..c3dbcdf18 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf @@ -257,6 +257,11 @@ 개발 환경에 항목을 설치합니다. + + Uninstalls a tool from the development environment. + Uninstalls a tool from the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf index 59b34f3f8..304b215d0 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf @@ -257,6 +257,11 @@ Instaluje element w środowisku deweloperskim. + + Uninstalls a tool from the development environment. + Uninstalls a tool from the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf index 49d800c64..a3a00faee 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf @@ -257,6 +257,11 @@ Instala um item no ambiente de desenvolvimento. + + Uninstalls a tool from the development environment. + Uninstalls a tool from the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf index 4a4285f98..5a64011ec 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf @@ -257,6 +257,11 @@ Устанавливает элемент в среде разработки. + + Uninstalls a tool from the development environment. + Uninstalls a tool from the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf index be0b5c71b..0654c6eaa 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf @@ -257,6 +257,11 @@ Bir öğeyi geliştirme ortamına yükler. + + Uninstalls a tool from the development environment. + Uninstalls a tool from the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf index 56d6cd5cf..78a9319a0 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf @@ -257,6 +257,11 @@ 将项目安装到开发环境中。 + + Uninstalls a tool from the development environment. + Uninstalls a tool from the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf index 9f60a5996..98b0bb991 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf @@ -257,6 +257,11 @@ 將項目安裝至部署環境。 + + Uninstalls a tool from the development environment. + Uninstalls a tool from the development environment. + + \ No newline at end of file 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 0001d460c..881f81491 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs @@ -18,9 +18,10 @@ namespace Microsoft.DotNet.Tools.Install.Tool { internal class InstallToolCommand : CommandBase { - private readonly IToolPackageObtainer _toolPackageObtainer; + private readonly IToolPackageStore _toolPackageStore; + private readonly IToolPackageInstaller _toolPackageInstaller; + private readonly IShellShimRepository _shellShimRepository; private readonly IEnvironmentPathInstruction _environmentPathInstruction; - private readonly IShellShimMaker _shellShimMaker; private readonly IReporter _reporter; private readonly IReporter _errorReporter; @@ -35,8 +36,9 @@ namespace Microsoft.DotNet.Tools.Install.Tool public InstallToolCommand( AppliedOption appliedCommand, ParseResult parseResult, - IToolPackageObtainer toolPackageObtainer = null, - IShellShimMaker shellShimMaker = null, + IToolPackageStore toolPackageStore = null, + IToolPackageInstaller toolPackageInstaller = null, + IShellShimRepository shellShimRepository = null, IEnvironmentPathInstruction environmentPathInstruction = null, IReporter reporter = null) : base(parseResult) @@ -55,21 +57,20 @@ namespace Microsoft.DotNet.Tools.Install.Tool _verbosity = appliedCommand.SingleArgumentOrDefault("verbosity"); var cliFolderPathCalculator = new CliFolderPathCalculator(); - var offlineFeedPath = new DirectoryPath(cliFolderPathCalculator.CliFallbackFolderPath); - _toolPackageObtainer = toolPackageObtainer ?? new ToolPackageObtainer( - new DirectoryPath(cliFolderPathCalculator.ToolsPackagePath), - offlineFeedPath, - () => new DirectoryPath(Path.GetTempPath()) - .WithSubDirectories(Path.GetRandomFileName()) - .WithFile(Path.GetRandomFileName() + ".csproj"), - new Lazy(BundledTargetFramework.GetTargetFrameworkMoniker), - new ProjectRestorer(reporter)); + + _toolPackageStore = toolPackageStore + ?? new ToolPackageStore(new DirectoryPath(cliFolderPathCalculator.ToolsPackagePath)); + + _toolPackageInstaller = toolPackageInstaller + ?? new ToolPackageInstaller( + _toolPackageStore, + new ProjectRestorer(_reporter)); _environmentPathInstruction = environmentPathInstruction - ?? EnvironmentPathFactory - .CreateEnvironmentPathInstruction(); + ?? EnvironmentPathFactory.CreateEnvironmentPathInstruction(); - _shellShimMaker = shellShimMaker ?? new ShellShimMaker(cliFolderPathCalculator.ToolsShimPath); + _shellShimRepository = shellShimRepository + ?? new ShellShimRepository(new DirectoryPath(cliFolderPathCalculator.ToolsShimPath)); _reporter = (reporter ?? Reporter.Output); _errorReporter = (reporter ?? Reporter.Error); @@ -82,46 +83,78 @@ namespace Microsoft.DotNet.Tools.Install.Tool throw new GracefulException(LocalizableStrings.InstallToolCommandOnlySupportGlobal); } + if (_configFilePath != null && !File.Exists(_configFilePath)) + { + throw new GracefulException( + string.Format( + LocalizableStrings.NuGetConfigurationFileDoesNotExist, + Path.GetFullPath(_configFilePath))); + } + + // Prevent installation if any version of the package is installed + if (_toolPackageStore.GetInstalledPackages(_packageId).FirstOrDefault() != null) + { + _errorReporter.WriteLine(string.Format(LocalizableStrings.ToolAlreadyInstalled, _packageId).Red()); + return 1; + } + + FilePath? configFile = null; + if (_configFilePath != null) + { + configFile = new FilePath(_configFilePath); + } + try { - FilePath? configFile = null; - if (_configFilePath != null) + IToolPackage package = null; + using (var scope = new TransactionScope( + TransactionScopeOption.Required, + TimeSpan.Zero)) { - configFile = new FilePath(_configFilePath); - } - - using (var transactionScope = new TransactionScope()) - { - var toolConfigurationAndExecutablePath = _toolPackageObtainer.ObtainAndReturnExecutablePath( + package = _toolPackageInstaller.InstallPackage( packageId: _packageId, packageVersion: _packageVersion, - nugetconfig: configFile, - targetframework: _framework, + targetFramework: _framework, + nugetConfig: configFile, source: _source, verbosity: _verbosity); - var commandName = toolConfigurationAndExecutablePath.Configuration.CommandName; + foreach (var command in package.Commands) + { + _shellShimRepository.CreateShim(command.Executable, command.Name); + } - _shellShimMaker.CreateShim( - toolConfigurationAndExecutablePath.Executable, - commandName); - - _environmentPathInstruction - .PrintAddPathInstructionIfPathDoesNotExist(); - - _reporter.WriteLine( - string.Format(LocalizableStrings.InstallationSucceeded, commandName)); - transactionScope.Complete(); + scope.Complete(); } + + _environmentPathInstruction.PrintAddPathInstructionIfPathDoesNotExist(); + + _reporter.WriteLine( + string.Format( + LocalizableStrings.InstallationSucceeded, + string.Join(", ", package.Commands.Select(c => c.Name)), + package.PackageId, + package.PackageVersion).Green()); + return 0; } - catch (PackageObtainException ex) + catch (ToolPackageException ex) { + if (Reporter.IsVerbose) + { + Reporter.Verbose.WriteLine(ex.ToString().Red()); + } + _errorReporter.WriteLine(ex.Message.Red()); _errorReporter.WriteLine(string.Format(LocalizableStrings.ToolInstallationFailed, _packageId).Red()); return 1; } catch (ToolConfigurationException ex) { + if (Reporter.IsVerbose) + { + Reporter.Verbose.WriteLine(ex.ToString().Red()); + } + _errorReporter.WriteLine( string.Format( LocalizableStrings.InvalidToolConfiguration, @@ -129,8 +162,21 @@ namespace Microsoft.DotNet.Tools.Install.Tool _errorReporter.WriteLine(string.Format(LocalizableStrings.ToolInstallationFailedContactAuthor, _packageId).Red()); return 1; } + catch (ShellShimException ex) + { + if (Reporter.IsVerbose) + { + Reporter.Verbose.WriteLine(ex.ToString().Red()); + } - return 0; + _errorReporter.WriteLine( + string.Format( + LocalizableStrings.FailedToCreateToolShim, + _packageId, + ex.Message).Red()); + _errorReporter.WriteLine(string.Format(LocalizableStrings.ToolInstallationFailed, _packageId).Red()); + return 1; + } } } } 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 7d543cab8..8d366537c 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/LocalizableStrings.resx +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/LocalizableStrings.resx @@ -144,15 +144,12 @@ The target framework to install the tool for. - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} + + NuGet configuration file '{0}' does not exist. - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} + If there were no additional instructions, you can type the following command to invoke the tool: {0} +Tool '{1}' (version '{2}') was successfully installed. Install user wide. @@ -175,4 +172,10 @@ The installation succeeded. If there are no further instructions, you can type t The tool package could not be restored. + + Tool '{0}' is already installed. + + + Failed to create shell shim for tool '{0}': {1} + \ 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 ba4548c2d..760168517 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/ProjectRestorer.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/ProjectRestorer.cs @@ -14,27 +14,27 @@ namespace Microsoft.DotNet.Tools.Install.Tool { internal class ProjectRestorer : IProjectRestorer { - private IReporter _reporter; + private readonly IReporter _reporter; - public ProjectRestorer(IReporter reporter) + public ProjectRestorer(IReporter reporter = null) { _reporter = reporter; } public void Restore( - FilePath projectPath, + FilePath project, DirectoryPath assetJsonOutput, - FilePath? nugetconfig, + FilePath? nugetConfig = null, string source = null, string verbosity = null) { var argsToPassToRestore = new List(); - argsToPassToRestore.Add(projectPath.Value); - if (nugetconfig != null) + argsToPassToRestore.Add(project.Value); + if (nugetConfig != null) { argsToPassToRestore.Add("--configfile"); - argsToPassToRestore.Add(nugetconfig.Value.Value); + argsToPassToRestore.Add(nugetConfig.Value.Value); } if (source != null) @@ -65,7 +65,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool var result = command.Execute(); if (result.ExitCode != 0) { - throw new PackageObtainException(LocalizableStrings.ToolInstallationRestoreFailed); + throw new ToolPackageException(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 c889a65aa..888f9abcb 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 @@ -13,23 +13,12 @@ - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - + If there were no additional instructions, you can type the following command to invoke the tool: {0} +Tool '{1}' (version '{2}') was successfully installed. + Instalace byla úspěšná. Pokud nejsou další pokyny, můžete přímo do jádra napsat následující příkaz k vyvolání: {0} - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Nepovedlo se přidat balíček. -WorkingDirectory: {0} -Argumenty: {1} -Výstup: {2}{3} - - NuGet Package Id of the tool to install. ID balíčku NuGet nástroje, který se má nainstalovat @@ -95,6 +84,21 @@ Výstup: {2}{3} Tool '{0}' failed to install. Please contact the tool author for assistance. + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + + + Failed to create shell shim for tool '{0}': {1} + Failed to create shell shim for tool '{0}': {1} + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + The tool package could not be restored. The tool package could not be restored. 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 6fbfd600c..7483dac63 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 @@ -13,23 +13,12 @@ - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - + If there were no additional instructions, you can type the following command to invoke the tool: {0} +Tool '{1}' (version '{2}') was successfully installed. + Die Installation war erfolgreich. Sofern keine weiteren Anweisungen vorliegen, können Sie für den Aufruf den folgenden Befehl direkt in der Shell eingeben: {0} - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Fehler beim Hinzufügen des Pakets. -WorkingDirectory: {0} -Argumente: {1} -Ausgabe: {2}{3} - - NuGet Package Id of the tool to install. NuGet-Paket-ID des zu installierenden Tools. @@ -95,6 +84,21 @@ Ausgabe: {2}{3} Tool '{0}' failed to install. Please contact the tool author for assistance. + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + + + Failed to create shell shim for tool '{0}': {1} + Failed to create shell shim for tool '{0}': {1} + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + The tool package could not be restored. The tool package could not be restored. 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 23069ae18..f2c30b5e0 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 @@ -13,23 +13,12 @@ - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - + If there were no additional instructions, you can type the following command to invoke the tool: {0} +Tool '{1}' (version '{2}') was successfully installed. + La instalación se completó correctamente. Si no hay más instrucciones, puede escribir el comando siguiente en el shell directamente para invocar: {0} - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - No se pudo agregar el paquete. -Directorio de trabajo: {0} -Argumentos: {1} -Salida: {2}{3} - - NuGet Package Id of the tool to install. Id. del paquete de NuGet que se instalará. @@ -95,6 +84,21 @@ Salida: {2}{3} Tool '{0}' failed to install. Please contact the tool author for assistance. + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + + + Failed to create shell shim for tool '{0}': {1} + Failed to create shell shim for tool '{0}': {1} + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + The tool package could not be restored. The tool package could not be restored. 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 7ab81e13e..5d626ea96 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 @@ -13,23 +13,12 @@ - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - + If there were no additional instructions, you can type the following command to invoke the tool: {0} +Tool '{1}' (version '{2}') was successfully installed. + L'installation a réussi. En l'absence d'instructions supplémentaires, vous pouvez taper directement la commande suivante dans l'interpréteur de commandes pour appeler : {0} - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Échec de l'ajout du package. -WorkingDirectory : {0} -Arguments : {1} -Sortie : {2}{3} - - NuGet Package Id of the tool to install. ID de package NuGet de l'outil à installer. @@ -95,6 +84,21 @@ Sortie : {2}{3} Tool '{0}' failed to install. Please contact the tool author for assistance. + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + + + Failed to create shell shim for tool '{0}': {1} + Failed to create shell shim for tool '{0}': {1} + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + The tool package could not be restored. The tool package could not be restored. 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 b8cad55c8..324a466ff 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 @@ -13,23 +13,12 @@ - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - + If there were no additional instructions, you can type the following command to invoke the tool: {0} +Tool '{1}' (version '{2}') was successfully installed. + L'installazione è riuscita. Se non ci sono altre istruzioni, è possibile digitare direttamente nella shell il comando seguente da richiamare: {0} - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Non è stato possibile aggiungere il pacchetto. -Directory di lavoro: {0} -Argomenti: {1} -Output: {2}{3} - - NuGet Package Id of the tool to install. ID pacchetto NuGet dello strumento da installare. @@ -95,6 +84,21 @@ Output: {2}{3} Tool '{0}' failed to install. Please contact the tool author for assistance. + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + + + Failed to create shell shim for tool '{0}': {1} + Failed to create shell shim for tool '{0}': {1} + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + The tool package could not be restored. The tool package could not be restored. 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 54dd306a9..61431c1ba 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 @@ -13,23 +13,12 @@ - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - + If there were no additional instructions, you can type the following command to invoke the tool: {0} +Tool '{1}' (version '{2}') was successfully installed. + インストールは成功しました。追加の指示がなければ、シェルに次のコマンドを直接入力して呼び出すことができます: {0} - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - パッケージを追加できませんでした。 -作業ディレクトリ: {0} -引数: {1} -出力: {2}{3} - - NuGet Package Id of the tool to install. インストールするツールの NuGet パッケージ ID。 @@ -95,6 +84,21 @@ Output: {2}{3} Tool '{0}' failed to install. Please contact the tool author for assistance. + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + + + Failed to create shell shim for tool '{0}': {1} + Failed to create shell shim for tool '{0}': {1} + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + The tool package could not be restored. The tool package could not be restored. 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 1d2bc2f7d..5c341d639 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 @@ -13,23 +13,12 @@ - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - + If there were no additional instructions, you can type the following command to invoke the tool: {0} +Tool '{1}' (version '{2}') was successfully installed. + 설치했습니다. 추가 지침이 없는 경우 셸에 다음 명령을 직접 입력하여 {0}을(를) 호출할 수 있습니다. - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - 패키지를 추가하지 못했습니다. -작업 디렉터리: {0} -인수: {1} -출력: {2}{3} - - NuGet Package Id of the tool to install. 설치할 도구의 NuGet 패키지 ID입니다. @@ -95,6 +84,21 @@ Output: {2}{3} Tool '{0}' failed to install. Please contact the tool author for assistance. + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + + + Failed to create shell shim for tool '{0}': {1} + Failed to create shell shim for tool '{0}': {1} + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + The tool package could not be restored. The tool package could not be restored. 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 c476ee314..fdb248906 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 @@ -13,23 +13,12 @@ - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - + If there were no additional instructions, you can type the following command to invoke the tool: {0} +Tool '{1}' (version '{2}') was successfully installed. + Instalacja powiodła się. Jeśli nie ma dodatkowych instrukcji, możesz wpisać następujące polecenie bezpośrednio w powłoce, aby wywołać: {0} - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Nie można dodać pakietu. -Katalog roboczy: {0} -Argumenty: {1} -Dane wyjściowe: {2}{3} - - NuGet Package Id of the tool to install. Identyfikator pakietu NuGet narzędzia do zainstalowania. @@ -95,6 +84,21 @@ Dane wyjściowe: {2}{3} Tool '{0}' failed to install. Please contact the tool author for assistance. + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + + + Failed to create shell shim for tool '{0}': {1} + Failed to create shell shim for tool '{0}': {1} + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + The tool package could not be restored. The tool package could not be restored. 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 567f57822..482d836a9 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 @@ -13,23 +13,12 @@ - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - + If there were no additional instructions, you can type the following command to invoke the tool: {0} +Tool '{1}' (version '{2}') was successfully installed. + A instalação foi bem-sucedida. Se não houver outras instruções, digite o seguinte comando no shell diretamente para invocar: {0} - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Falha ao adicionar pacote. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - - NuGet Package Id of the tool to install. A ID do pacote NuGet da ferramenta a ser instalada. @@ -95,6 +84,21 @@ Output: {2}{3} Tool '{0}' failed to install. Please contact the tool author for assistance. + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + + + Failed to create shell shim for tool '{0}': {1} + Failed to create shell shim for tool '{0}': {1} + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + The tool package could not be restored. The tool package could not be restored. 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 995a10f1a..b9e680f21 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 @@ -13,23 +13,12 @@ - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - + If there were no additional instructions, you can type the following command to invoke the tool: {0} +Tool '{1}' (version '{2}') was successfully installed. + Установка завершена. Если других действий не требуется, вы можете непосредственно в оболочке ввести для вызова следующую команду: {0}. - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Не удалось добавить пакет. -Рабочий каталог: {0} -Аргументы: {1} -Выходные данные: {2}{3} - - NuGet Package Id of the tool to install. Идентификатор пакета NuGet устанавливаемого инструмента. @@ -95,6 +84,21 @@ Output: {2}{3} Tool '{0}' failed to install. Please contact the tool author for assistance. + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + + + Failed to create shell shim for tool '{0}': {1} + Failed to create shell shim for tool '{0}': {1} + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + The tool package could not be restored. The tool package could not be restored. 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 fd1f8fa3c..7a474d29c 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 @@ -13,23 +13,12 @@ - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - + If there were no additional instructions, you can type the following command to invoke the tool: {0} +Tool '{1}' (version '{2}') was successfully installed. + Yükleme başarılı oldu. Daha fazla yönerge yoksa, çağırmak için şu komutu doğrudan kabuğa yazabilirsiniz: {0} - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Paket eklenemedi. -WorkingDirectory: {0} -Bağımsız değişkenler: {1} -Çıkış: {2}{3} - - NuGet Package Id of the tool to install. Yüklenecek aracın NuGet Paket Kimliği. @@ -95,6 +84,21 @@ Bağımsız değişkenler: {1} Tool '{0}' failed to install. Please contact the tool author for assistance. + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + + + Failed to create shell shim for tool '{0}': {1} + Failed to create shell shim for tool '{0}': {1} + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + The tool package could not be restored. The tool package could not be restored. 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 3e374ff8b..1c13cca76 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 @@ -13,23 +13,12 @@ - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - + If there were no additional instructions, you can type the following command to invoke the tool: {0} +Tool '{1}' (version '{2}') was successfully installed. + 安装成功。如果没有进一步的说明,则可直接在 shell 中键入以下命令进行调用: {0} - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - 未能添加包。 -WorkingDirectory: {0} -参数: {1} -输出: {2}{3} - - NuGet Package Id of the tool to install. 要安装的工具的 NuGet 包 ID。 @@ -95,6 +84,21 @@ WorkingDirectory: {0} Tool '{0}' failed to install. Please contact the tool author for assistance. + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + + + Failed to create shell shim for tool '{0}': {1} + Failed to create shell shim for tool '{0}': {1} + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + The tool package could not be restored. The tool package could not be restored. 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 da0e13c89..2e4e348f4 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 @@ -13,23 +13,12 @@ - -The installation succeeded. If there are no further instructions, you can type the following command in shell directly to invoke: {0} - + If there were no additional instructions, you can type the following command to invoke the tool: {0} +Tool '{1}' (version '{2}') was successfully installed. + 安裝已成功。如果沒有進一步指示,您可以直接在命令介面中鍵入下列命令,以叫用: {0} - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - 無法新增套件。 -WorkingDirectory: {0} -引數: {1} -輸出: {2}{3} - - NuGet Package Id of the tool to install. 要安裝之工具的 NuGet 套件識別碼。 @@ -95,6 +84,21 @@ WorkingDirectory: {0} Tool '{0}' failed to install. Please contact the tool author for assistance. + + Tool '{0}' is already installed. + Tool '{0}' is already installed. + + + + Failed to create shell shim for tool '{0}': {1} + Failed to create shell shim for tool '{0}': {1} + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + The tool package could not be restored. The tool package could not be restored. diff --git a/src/dotnet/commands/dotnet-uninstall/LocalizableStrings.resx b/src/dotnet/commands/dotnet-uninstall/LocalizableStrings.resx new file mode 100644 index 000000000..99440a870 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/LocalizableStrings.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + .NET Uninstall Command + + + Uninstalls an item from the development environment. + + + The NuGet package identifier of the tool to uninstall. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/UninstallCommand.cs b/src/dotnet/commands/dotnet-uninstall/UninstallCommand.cs new file mode 100644 index 000000000..46f6231af --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/UninstallCommand.cs @@ -0,0 +1,31 @@ +// 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 System.Collections.Generic; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.CommandLine; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.Tools.Uninstall.Tool; + +namespace Microsoft.DotNet.Tools.Uninstall +{ + public class UninstallCommand : DotNetTopLevelCommandBase + { + protected override string CommandName => "uninstall"; + protected override string FullCommandNameLocalized => LocalizableStrings.UninstallFullCommandName; + protected override string ArgumentName => Constants.ToolPackageArgumentName; + protected override string ArgumentDescriptionLocalized => LocalizableStrings.UninstallArgumentDescription; + + internal override Dictionary> SubCommands => + new Dictionary> + { + ["tool"] = options => new UninstallToolCommand(options["tool"], ParseResult) + }; + + public static int Run(string[] args) + { + return new UninstallCommand().RunCommand(args); + } + } +} diff --git a/src/dotnet/commands/dotnet-uninstall/UninstallCommandParser.cs b/src/dotnet/commands/dotnet-uninstall/UninstallCommandParser.cs new file mode 100644 index 000000000..ec6f4aa6a --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/UninstallCommandParser.cs @@ -0,0 +1,21 @@ +// 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.CommandLine; +using LocalizableStrings = Microsoft.DotNet.Tools.Uninstall.LocalizableStrings; + +namespace Microsoft.DotNet.Cli +{ + internal static class UninstallCommandParser + { + public static Command Uninstall() + { + return Create.Command( + "uninstall", + LocalizableStrings.CommandDescription, + Accept.NoArguments(), + CommonOptions.HelpOption(), + UninstallToolCommandParser.UninstallTool()); + } + } +} diff --git a/src/dotnet/commands/dotnet-uninstall/tool/LocalizableStrings.resx b/src/dotnet/commands/dotnet-uninstall/tool/LocalizableStrings.resx new file mode 100644 index 000000000..bbca43b66 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/LocalizableStrings.resx @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + PACKAGE_ID + + + NuGet Package Id of the tool to uninstall. + + + Please specify one tool Package Id to uninstall. + + + Uninstalls a tool. + + + Uninstall user wide. + + + The --global switch (-g) is currently required because only user wide tools are supported. + + + Tool '{0}' (version '{1}') was successfully uninstalled. + + + Tool '{0}' is not currently installed. + + + Tool '{0}' has multiple versions installed and cannot be uninstalled. + + + Failed to uninstall tool '{0}': {1} + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs new file mode 100644 index 000000000..c9778cd7a --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs @@ -0,0 +1,125 @@ +// 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 System.IO; +using System.Linq; +using System.Transactions; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.CommandLine; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.Configurer; +using Microsoft.DotNet.ShellShim; +using Microsoft.DotNet.ToolPackage; +using Microsoft.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.Tools.Uninstall.Tool +{ + internal class UninstallToolCommand : CommandBase + { + private readonly AppliedOption _options; + private readonly IToolPackageStore _toolPackageStore; + private readonly IShellShimRepository _shellShimRepository; + private readonly IReporter _reporter; + private readonly IReporter _errorReporter; + + public UninstallToolCommand( + AppliedOption options, + ParseResult result, + IToolPackageStore toolPackageStore = null, + IShellShimRepository shellShimRepository = null, + IReporter reporter = null) + : base(result) + { + var pathCalculator = new CliFolderPathCalculator(); + + _options = options ?? throw new ArgumentNullException(nameof(options)); + _toolPackageStore = toolPackageStore ?? new ToolPackageStore( + new DirectoryPath(pathCalculator.ToolsPackagePath)); + _shellShimRepository = shellShimRepository ?? new ShellShimRepository( + new DirectoryPath(pathCalculator.ToolsShimPath)); + _reporter = reporter ?? Reporter.Output; + _errorReporter = reporter ?? Reporter.Error; + } + + public override int Execute() + { + if (!_options.ValueOrDefault("global")) + { + throw new GracefulException(LocalizableStrings.UninstallToolCommandOnlySupportsGlobal); + } + + var packageId = _options.Arguments.Single(); + IToolPackage package = null; + + try + { + package = _toolPackageStore.GetInstalledPackages(packageId).SingleOrDefault(); + if (package == null) + { + _errorReporter.WriteLine( + string.Format( + LocalizableStrings.ToolNotInstalled, + packageId).Red()); + return 1; + } + } + catch (InvalidOperationException) + { + _errorReporter.WriteLine( + string.Format( + LocalizableStrings.ToolHasMultipleVersionsInstalled, + packageId).Red()); + return 1; + } + + try + { + using (var scope = new TransactionScope( + TransactionScopeOption.Required, + TimeSpan.Zero)) + { + foreach (var command in package.Commands) + { + _shellShimRepository.RemoveShim(command.Name); + } + + package.Uninstall(); + + scope.Complete(); + } + + _reporter.WriteLine( + string.Format( + LocalizableStrings.UninstallSucceeded, + package.PackageId, + package.PackageVersion).Green()); + return 0; + } + catch (ToolPackageException ex) + { + if (Reporter.IsVerbose) + { + Reporter.Verbose.WriteLine(ex.ToString().Red()); + } + + _errorReporter.WriteLine(ex.Message.Red()); + return 1; + } + catch (Exception ex) when (ex is ToolConfigurationException || ex is ShellShimException) + { + if (Reporter.IsVerbose) + { + Reporter.Verbose.WriteLine(ex.ToString().Red()); + } + + _errorReporter.WriteLine( + string.Format( + LocalizableStrings.FailedToUninstallTool, + packageId, + ex.Message).Red()); + return 1; + } + } + } +} diff --git a/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommandParser.cs b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommandParser.cs new file mode 100644 index 000000000..61fca31dc --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommandParser.cs @@ -0,0 +1,25 @@ +// 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.CommandLine; +using LocalizableStrings = Microsoft.DotNet.Tools.Uninstall.Tool.LocalizableStrings; + +namespace Microsoft.DotNet.Cli +{ + internal static class UninstallToolCommandParser + { + public static Command UninstallTool() + { + return Create.Command("tool", + LocalizableStrings.CommandDescription, + Accept.ExactlyOneArgument(errorMessage: o => LocalizableStrings.SpecifyExactlyOnePackageId) + .With(name: LocalizableStrings.PackageIdArgumentName, + description: LocalizableStrings.PackageIdArgumentDescription), + Create.Option( + "-g|--global", + LocalizableStrings.GlobalOptionDescription, + Accept.NoArguments()), + CommonOptions.HelpOption()); + } + } +} diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.cs.xlf new file mode 100644 index 000000000..b826078e4 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.cs.xlf @@ -0,0 +1,57 @@ + + + + + + NuGet Package Id of the tool to uninstall. + NuGet Package Id of the tool to uninstall. + + + + Uninstalls a tool. + Uninstalls a tool. + + + + PACKAGE_ID + PACKAGE_ID + + + + Please specify one tool Package Id to uninstall. + Please specify one tool Package Id to uninstall. + + + + Uninstall user wide. + Uninstall user wide. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Tool '{0}' (version '{1}') was successfully uninstalled. + Tool '{0}' (version '{1}') was successfully uninstalled. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' has multiple versions installed and cannot be uninstalled. + Tool '{0}' has multiple versions installed and cannot be uninstalled. + + + + Failed to uninstall tool '{0}': {1} + Failed to uninstall tool '{0}': {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.de.xlf new file mode 100644 index 000000000..82291d6a6 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.de.xlf @@ -0,0 +1,57 @@ + + + + + + NuGet Package Id of the tool to uninstall. + NuGet Package Id of the tool to uninstall. + + + + Uninstalls a tool. + Uninstalls a tool. + + + + PACKAGE_ID + PACKAGE_ID + + + + Please specify one tool Package Id to uninstall. + Please specify one tool Package Id to uninstall. + + + + Uninstall user wide. + Uninstall user wide. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Tool '{0}' (version '{1}') was successfully uninstalled. + Tool '{0}' (version '{1}') was successfully uninstalled. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' has multiple versions installed and cannot be uninstalled. + Tool '{0}' has multiple versions installed and cannot be uninstalled. + + + + Failed to uninstall tool '{0}': {1} + Failed to uninstall tool '{0}': {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.es.xlf new file mode 100644 index 000000000..fdadddde1 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.es.xlf @@ -0,0 +1,57 @@ + + + + + + NuGet Package Id of the tool to uninstall. + NuGet Package Id of the tool to uninstall. + + + + Uninstalls a tool. + Uninstalls a tool. + + + + PACKAGE_ID + PACKAGE_ID + + + + Please specify one tool Package Id to uninstall. + Please specify one tool Package Id to uninstall. + + + + Uninstall user wide. + Uninstall user wide. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Tool '{0}' (version '{1}') was successfully uninstalled. + Tool '{0}' (version '{1}') was successfully uninstalled. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' has multiple versions installed and cannot be uninstalled. + Tool '{0}' has multiple versions installed and cannot be uninstalled. + + + + Failed to uninstall tool '{0}': {1} + Failed to uninstall tool '{0}': {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.fr.xlf new file mode 100644 index 000000000..07535f668 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.fr.xlf @@ -0,0 +1,57 @@ + + + + + + NuGet Package Id of the tool to uninstall. + NuGet Package Id of the tool to uninstall. + + + + Uninstalls a tool. + Uninstalls a tool. + + + + PACKAGE_ID + PACKAGE_ID + + + + Please specify one tool Package Id to uninstall. + Please specify one tool Package Id to uninstall. + + + + Uninstall user wide. + Uninstall user wide. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Tool '{0}' (version '{1}') was successfully uninstalled. + Tool '{0}' (version '{1}') was successfully uninstalled. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' has multiple versions installed and cannot be uninstalled. + Tool '{0}' has multiple versions installed and cannot be uninstalled. + + + + Failed to uninstall tool '{0}': {1} + Failed to uninstall tool '{0}': {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.it.xlf new file mode 100644 index 000000000..39fb58449 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.it.xlf @@ -0,0 +1,57 @@ + + + + + + NuGet Package Id of the tool to uninstall. + NuGet Package Id of the tool to uninstall. + + + + Uninstalls a tool. + Uninstalls a tool. + + + + PACKAGE_ID + PACKAGE_ID + + + + Please specify one tool Package Id to uninstall. + Please specify one tool Package Id to uninstall. + + + + Uninstall user wide. + Uninstall user wide. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Tool '{0}' (version '{1}') was successfully uninstalled. + Tool '{0}' (version '{1}') was successfully uninstalled. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' has multiple versions installed and cannot be uninstalled. + Tool '{0}' has multiple versions installed and cannot be uninstalled. + + + + Failed to uninstall tool '{0}': {1} + Failed to uninstall tool '{0}': {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ja.xlf new file mode 100644 index 000000000..47e7895c4 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ja.xlf @@ -0,0 +1,57 @@ + + + + + + NuGet Package Id of the tool to uninstall. + NuGet Package Id of the tool to uninstall. + + + + Uninstalls a tool. + Uninstalls a tool. + + + + PACKAGE_ID + PACKAGE_ID + + + + Please specify one tool Package Id to uninstall. + Please specify one tool Package Id to uninstall. + + + + Uninstall user wide. + Uninstall user wide. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Tool '{0}' (version '{1}') was successfully uninstalled. + Tool '{0}' (version '{1}') was successfully uninstalled. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' has multiple versions installed and cannot be uninstalled. + Tool '{0}' has multiple versions installed and cannot be uninstalled. + + + + Failed to uninstall tool '{0}': {1} + Failed to uninstall tool '{0}': {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ko.xlf new file mode 100644 index 000000000..a44f80a79 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ko.xlf @@ -0,0 +1,57 @@ + + + + + + NuGet Package Id of the tool to uninstall. + NuGet Package Id of the tool to uninstall. + + + + Uninstalls a tool. + Uninstalls a tool. + + + + PACKAGE_ID + PACKAGE_ID + + + + Please specify one tool Package Id to uninstall. + Please specify one tool Package Id to uninstall. + + + + Uninstall user wide. + Uninstall user wide. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Tool '{0}' (version '{1}') was successfully uninstalled. + Tool '{0}' (version '{1}') was successfully uninstalled. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' has multiple versions installed and cannot be uninstalled. + Tool '{0}' has multiple versions installed and cannot be uninstalled. + + + + Failed to uninstall tool '{0}': {1} + Failed to uninstall tool '{0}': {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.pl.xlf new file mode 100644 index 000000000..d02afe79a --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.pl.xlf @@ -0,0 +1,57 @@ + + + + + + NuGet Package Id of the tool to uninstall. + NuGet Package Id of the tool to uninstall. + + + + Uninstalls a tool. + Uninstalls a tool. + + + + PACKAGE_ID + PACKAGE_ID + + + + Please specify one tool Package Id to uninstall. + Please specify one tool Package Id to uninstall. + + + + Uninstall user wide. + Uninstall user wide. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Tool '{0}' (version '{1}') was successfully uninstalled. + Tool '{0}' (version '{1}') was successfully uninstalled. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' has multiple versions installed and cannot be uninstalled. + Tool '{0}' has multiple versions installed and cannot be uninstalled. + + + + Failed to uninstall tool '{0}': {1} + Failed to uninstall tool '{0}': {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.pt-BR.xlf new file mode 100644 index 000000000..6b7e490f5 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.pt-BR.xlf @@ -0,0 +1,57 @@ + + + + + + NuGet Package Id of the tool to uninstall. + NuGet Package Id of the tool to uninstall. + + + + Uninstalls a tool. + Uninstalls a tool. + + + + PACKAGE_ID + PACKAGE_ID + + + + Please specify one tool Package Id to uninstall. + Please specify one tool Package Id to uninstall. + + + + Uninstall user wide. + Uninstall user wide. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Tool '{0}' (version '{1}') was successfully uninstalled. + Tool '{0}' (version '{1}') was successfully uninstalled. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' has multiple versions installed and cannot be uninstalled. + Tool '{0}' has multiple versions installed and cannot be uninstalled. + + + + Failed to uninstall tool '{0}': {1} + Failed to uninstall tool '{0}': {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ru.xlf new file mode 100644 index 000000000..e98348039 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ru.xlf @@ -0,0 +1,57 @@ + + + + + + NuGet Package Id of the tool to uninstall. + NuGet Package Id of the tool to uninstall. + + + + Uninstalls a tool. + Uninstalls a tool. + + + + PACKAGE_ID + PACKAGE_ID + + + + Please specify one tool Package Id to uninstall. + Please specify one tool Package Id to uninstall. + + + + Uninstall user wide. + Uninstall user wide. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Tool '{0}' (version '{1}') was successfully uninstalled. + Tool '{0}' (version '{1}') was successfully uninstalled. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' has multiple versions installed and cannot be uninstalled. + Tool '{0}' has multiple versions installed and cannot be uninstalled. + + + + Failed to uninstall tool '{0}': {1} + Failed to uninstall tool '{0}': {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.tr.xlf new file mode 100644 index 000000000..208741783 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.tr.xlf @@ -0,0 +1,57 @@ + + + + + + NuGet Package Id of the tool to uninstall. + NuGet Package Id of the tool to uninstall. + + + + Uninstalls a tool. + Uninstalls a tool. + + + + PACKAGE_ID + PACKAGE_ID + + + + Please specify one tool Package Id to uninstall. + Please specify one tool Package Id to uninstall. + + + + Uninstall user wide. + Uninstall user wide. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Tool '{0}' (version '{1}') was successfully uninstalled. + Tool '{0}' (version '{1}') was successfully uninstalled. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' has multiple versions installed and cannot be uninstalled. + Tool '{0}' has multiple versions installed and cannot be uninstalled. + + + + Failed to uninstall tool '{0}': {1} + Failed to uninstall tool '{0}': {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.zh-Hans.xlf new file mode 100644 index 000000000..e57075c58 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.zh-Hans.xlf @@ -0,0 +1,57 @@ + + + + + + NuGet Package Id of the tool to uninstall. + NuGet Package Id of the tool to uninstall. + + + + Uninstalls a tool. + Uninstalls a tool. + + + + PACKAGE_ID + PACKAGE_ID + + + + Please specify one tool Package Id to uninstall. + Please specify one tool Package Id to uninstall. + + + + Uninstall user wide. + Uninstall user wide. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Tool '{0}' (version '{1}') was successfully uninstalled. + Tool '{0}' (version '{1}') was successfully uninstalled. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' has multiple versions installed and cannot be uninstalled. + Tool '{0}' has multiple versions installed and cannot be uninstalled. + + + + Failed to uninstall tool '{0}': {1} + Failed to uninstall tool '{0}': {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.zh-Hant.xlf new file mode 100644 index 000000000..fc809894b --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.zh-Hant.xlf @@ -0,0 +1,57 @@ + + + + + + NuGet Package Id of the tool to uninstall. + NuGet Package Id of the tool to uninstall. + + + + Uninstalls a tool. + Uninstalls a tool. + + + + PACKAGE_ID + PACKAGE_ID + + + + Please specify one tool Package Id to uninstall. + Please specify one tool Package Id to uninstall. + + + + Uninstall user wide. + Uninstall user wide. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Tool '{0}' (version '{1}') was successfully uninstalled. + Tool '{0}' (version '{1}') was successfully uninstalled. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' has multiple versions installed and cannot be uninstalled. + Tool '{0}' has multiple versions installed and cannot be uninstalled. + + + + Failed to uninstall tool '{0}': {1} + Failed to uninstall tool '{0}': {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.cs.xlf new file mode 100644 index 000000000..2aa39fc98 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.cs.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Uninstall Command + .NET Uninstall Command + + + + The NuGet package identifier of the tool to uninstall. + The NuGet package identifier of the tool to uninstall. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.de.xlf new file mode 100644 index 000000000..d73382dab --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.de.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Uninstall Command + .NET Uninstall Command + + + + The NuGet package identifier of the tool to uninstall. + The NuGet package identifier of the tool to uninstall. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.es.xlf new file mode 100644 index 000000000..ee061aa4a --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.es.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Uninstall Command + .NET Uninstall Command + + + + The NuGet package identifier of the tool to uninstall. + The NuGet package identifier of the tool to uninstall. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.fr.xlf new file mode 100644 index 000000000..0a37b8974 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.fr.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Uninstall Command + .NET Uninstall Command + + + + The NuGet package identifier of the tool to uninstall. + The NuGet package identifier of the tool to uninstall. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.it.xlf new file mode 100644 index 000000000..beb220cdf --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.it.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Uninstall Command + .NET Uninstall Command + + + + The NuGet package identifier of the tool to uninstall. + The NuGet package identifier of the tool to uninstall. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.ja.xlf new file mode 100644 index 000000000..35fa420ff --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.ja.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Uninstall Command + .NET Uninstall Command + + + + The NuGet package identifier of the tool to uninstall. + The NuGet package identifier of the tool to uninstall. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.ko.xlf new file mode 100644 index 000000000..f8fc7ef14 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.ko.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Uninstall Command + .NET Uninstall Command + + + + The NuGet package identifier of the tool to uninstall. + The NuGet package identifier of the tool to uninstall. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.pl.xlf new file mode 100644 index 000000000..d573f8f3f --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.pl.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Uninstall Command + .NET Uninstall Command + + + + The NuGet package identifier of the tool to uninstall. + The NuGet package identifier of the tool to uninstall. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.pt-BR.xlf new file mode 100644 index 000000000..ba5d9acb4 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.pt-BR.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Uninstall Command + .NET Uninstall Command + + + + The NuGet package identifier of the tool to uninstall. + The NuGet package identifier of the tool to uninstall. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.ru.xlf new file mode 100644 index 000000000..cfd97f776 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.ru.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Uninstall Command + .NET Uninstall Command + + + + The NuGet package identifier of the tool to uninstall. + The NuGet package identifier of the tool to uninstall. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.tr.xlf new file mode 100644 index 000000000..1d52db404 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.tr.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Uninstall Command + .NET Uninstall Command + + + + The NuGet package identifier of the tool to uninstall. + The NuGet package identifier of the tool to uninstall. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.zh-Hans.xlf new file mode 100644 index 000000000..69296cfe6 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.zh-Hans.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Uninstall Command + .NET Uninstall Command + + + + The NuGet package identifier of the tool to uninstall. + The NuGet package identifier of the tool to uninstall. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.zh-Hant.xlf new file mode 100644 index 000000000..3e2ac319b --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/xlf/LocalizableStrings.zh-Hant.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Uninstall Command + .NET Uninstall Command + + + + The NuGet package identifier of the tool to uninstall. + The NuGet package identifier of the tool to uninstall. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + + \ No newline at end of file diff --git a/src/dotnet/dotnet.csproj b/src/dotnet/dotnet.csproj index 0b640f004..35bdbeaf9 100644 --- a/src/dotnet/dotnet.csproj +++ b/src/dotnet/dotnet.csproj @@ -41,6 +41,8 @@ + + diff --git a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf index b5761157a..2df0d6d66 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf @@ -680,85 +680,21 @@ {0} - - NuGet configuration file {0} does not exist. - Konfigurační soubor NuGet {0} neexistuje. - - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. Právě jste nainstalovali sadu .NET Core SDK, bude proto nutné před spuštěním nainstalovaného nástroje se odhlásit nebo restartovat relaci. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - Nejde najít cestu ke spustitelnému souboru nástrojů. Zkontrolujte, jestli v cestě (PATH) máte přidaný {0}. -Pokud používáte bash, můžete to provést spuštěním následujícího příkazu: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. Právě jste nainstalovali sadu .NET Core SDK, bude proto nutné před spuštěním nainstalovaného nástroje znovu otevřít terminál. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - Nejde najít cestu ke spustitelnému souboru nástrojů. Zkontrolujte, jestli v cestě (PATH) máte přidaný {0}. -Pokud používáte bash, můžete to provést spuštěním následujícího příkazu: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - - - Failed to install tool {0}. A command with the same name already exists. - Instalace nástroje {0} byla neúspěšná. Už existuje příkaz se stejným názvem. - - - - Failed to change permission: -Error: {0} -Output: {1} - Změna oprávnění byla neúspěšná: -Chyba: {0} -Výstup: {1} - - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. Právě jste nainstalovali sadu .NET Core SDK, bude proto nutné před spuštěním nainstalovaného nástroje znovu otevřít okno příkazového řádku. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: - -setx PATH "%PATH%;{1}" - Nejde najít cestu ke spustitelnému souboru nástrojů. Zkontrolujte, jestli v cestě (PATH) máte přidaný {0}. -Můžete to provést spuštěním následujícího příkazu: - -setx PATH "%PATH%;{1}" - - Package '{0}' is missing entry point file {1}. V balíčku {0} chybí soubor vstupního bodu {1}. @@ -795,8 +731,122 @@ setx PATH "%PATH%;{1}" - Tool '{0}' is already installed. - Tool '{0}' is already installed. + Tool '{0}' (version '{1}') is already installed. + Tool '{0}' (version '{1}') is already installed. + + + + Command '{0}' conflicts with an existing command from another tool. + Command '{0}' conflicts with an existing command from another tool. + + + + Cannot create shell shim for an empty executable path. + Cannot create shell shim for an empty executable path. + + + + Cannot create shell shim for an empty command. + Cannot create shell shim for an empty command. + + + + Failed to retrieve tool configuration: {0} + Failed to retrieve tool configuration: {0} + + + + Failed to create tool shim for command '{0}': {1} + Failed to create tool shim for command '{0}': {1} + + + + Failed to remove tool shim for command '{0}': {1} + Failed to remove tool shim for command '{0}': {1} + + + + Failed to set user executable permissions for shell shim: {0} + Failed to set user executable permissions for shell shim: {0} + + + + Failed to install tool package '{0}': {1} + Failed to install tool package '{0}': {1} + + + + Failed to uninstall tool package '{0}': {1} + Failed to uninstall tool package '{0}': {1} + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + diff --git a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf index a33593c75..931f8c4b0 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf @@ -680,85 +680,21 @@ {0} - - NuGet configuration file {0} does not exist. - Die NuGet-Konfigurationsdatei "{0}" ist nicht vorhanden. - - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. Da Sie gerade das .NET Core SDK installiert haben, müssen Sie sich abmelden oder Ihre Sitzung neu starten, bevor Sie das installierte Tool ausführen. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - Der Pfad für die Toolausführung wurde nicht gefunden. Stellen Sie sicher, dass "{0}" zu PATH hinzugefügt wurde. -Bei Verwendung von Bash können Sie hierzu den folgenden Befehl ausführen: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. Da Sie gerade das .NET Core SDK installiert haben, müssen Sie das Terminal neu öffnen, bevor Sie das installierte Tool ausführen. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - Der Pfad für die Toolausführung wurde nicht gefunden. Stellen Sie sicher, dass "{0}" zu PATH hinzugefügt wurde. -Bei Verwendung von Bash können Sie hierzu den folgenden Befehl ausführen: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - - - Failed to install tool {0}. A command with the same name already exists. - Fehler beim Installieren von Tool "{0}". Es ist bereits ein Befehl mit diesem Namen vorhanden. - - - - Failed to change permission: -Error: {0} -Output: {1} - Fehler beim Ändern der Berechtigung: -Fehler: {0} -Ausgabe: {1} - - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. Da Sie gerade das .NET Core SDK installiert haben, müssen Sie das Eingabeaufforderungsfenster neu öffnen, bevor Sie das installierte Tool ausführen. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: - -setx PATH "%PATH%;{1}" - Der Pfad für die Toolausführung wurde nicht gefunden. Stellen Sie sicher, dass "{0}" zu PATH hinzugefügt wurde. -Sie können hierzu den folgenden Befehl ausführen: - -setx PATH "%PATH%;{1}" - - Package '{0}' is missing entry point file {1}. Im Paket "{0}" fehlt die Einstiegspunktdatei "{1}". @@ -795,8 +731,122 @@ setx PATH "%PATH%;{1}" - Tool '{0}' is already installed. - Tool '{0}' is already installed. + Tool '{0}' (version '{1}') is already installed. + Tool '{0}' (version '{1}') is already installed. + + + + Command '{0}' conflicts with an existing command from another tool. + Command '{0}' conflicts with an existing command from another tool. + + + + Cannot create shell shim for an empty executable path. + Cannot create shell shim for an empty executable path. + + + + Cannot create shell shim for an empty command. + Cannot create shell shim for an empty command. + + + + Failed to retrieve tool configuration: {0} + Failed to retrieve tool configuration: {0} + + + + Failed to create tool shim for command '{0}': {1} + Failed to create tool shim for command '{0}': {1} + + + + Failed to remove tool shim for command '{0}': {1} + Failed to remove tool shim for command '{0}': {1} + + + + Failed to set user executable permissions for shell shim: {0} + Failed to set user executable permissions for shell shim: {0} + + + + Failed to install tool package '{0}': {1} + Failed to install tool package '{0}': {1} + + + + Failed to uninstall tool package '{0}': {1} + Failed to uninstall tool package '{0}': {1} + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + diff --git a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf index a945b317e..1cb12fe4f 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf @@ -680,85 +680,21 @@ {0} - - NuGet configuration file {0} does not exist. - El archivo de configuración de NuGet {0} no existe. - - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. Dado que acaba de instalar el SDK de .Net Core, tendrá que cerrar sesión o reiniciarla antes de ejecutar la herramienta instalada. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - No se encuentra la ruta de acceso del ejecutable de las herramientas. Compruebe que se ha agregado {0} a su valor PATH. -Si usa bash, puede hacerlo con la ejecución del comando siguiente: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. Dado que acaba de instalar el SDK de .Net Core, tendrá que volver a abrir la terminal antes de ejecutar la herramienta instalada. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - No se encuentra la ruta de acceso del ejecutable de las herramientas. Compruebe que se ha agregado {0} a su valor PATH. -Si usa bash, puede hacerlo con la ejecución del comando siguiente: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - - - Failed to install tool {0}. A command with the same name already exists. - No se pudo instalar la herramienta {0}. Ya existe un comando con el mismo nombre. - - - - Failed to change permission: -Error: {0} -Output: {1} - No se pudo cambiar el permiso: -Error: {0} -Salida: {1} - - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. Dado que acaba de instalar el SDK de .Net Core, tendrá que volver a abrir la ventana del símbolo del sistema antes de ejecutar la herramienta instalada. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: - -setx PATH "%PATH%;{1}" - No se encuentra la ruta de acceso del ejecutable de las herramientas. Compruebe que se ha agregado {0} a su valor PATH. -Para ello, puede ejecutar el comando siguiente: - -setx PATH "%PATH%;{1}" - - Package '{0}' is missing entry point file {1}. Al paquete "{0}" le falta el archivo de punto de entrada {1}. @@ -795,8 +731,122 @@ setx PATH "%PATH%;{1}" - Tool '{0}' is already installed. - Tool '{0}' is already installed. + Tool '{0}' (version '{1}') is already installed. + Tool '{0}' (version '{1}') is already installed. + + + + Command '{0}' conflicts with an existing command from another tool. + Command '{0}' conflicts with an existing command from another tool. + + + + Cannot create shell shim for an empty executable path. + Cannot create shell shim for an empty executable path. + + + + Cannot create shell shim for an empty command. + Cannot create shell shim for an empty command. + + + + Failed to retrieve tool configuration: {0} + Failed to retrieve tool configuration: {0} + + + + Failed to create tool shim for command '{0}': {1} + Failed to create tool shim for command '{0}': {1} + + + + Failed to remove tool shim for command '{0}': {1} + Failed to remove tool shim for command '{0}': {1} + + + + Failed to set user executable permissions for shell shim: {0} + Failed to set user executable permissions for shell shim: {0} + + + + Failed to install tool package '{0}': {1} + Failed to install tool package '{0}': {1} + + + + Failed to uninstall tool package '{0}': {1} + Failed to uninstall tool package '{0}': {1} + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + diff --git a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf index d2e4894b5..1fcbc1f42 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf @@ -680,85 +680,21 @@ {0} - - NuGet configuration file {0} does not exist. - Le fichier config NuGet {0} n'existe pas. - - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. Dans la mesure où vous venez d'installer le kit SDK .NET Core, vous devez vous déconnecter ou redémarrer votre session avant d'exécuter l'outil que vous avez installé. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - Le chemin des exécutables des outils est introuvable. Vérifiez que {0} est ajouté à PATH. -Si vous utilisez Bash, utilisez la commande suivante : - -cat << EOF >> ~/.bash_profile -# Ajouter les outils du kit SDK .NET Core -export PATH="$PATH:{1}" -EOF - - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. Dans la mesure où vous venez d'installer le kit SDK .NET Core, vous devez rouvrir le terminal avant d'exécuter l'outil que vous avez installé. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - Le chemin des exécutables des outils est introuvable. Vérifiez que {0} est ajouté à PATH. -Si vous utilisez Bash, utilisez la commande suivante : - -cat << EOF >> ~/.bash_profile -# Ajouter les outils du kit SDK .NET Core -export PATH="$PATH:{1}" -EOF - - - - Failed to install tool {0}. A command with the same name already exists. - Échec de l'installation de l'outil {0}. Une commande portant le même nom existe déjà. - - - - Failed to change permission: -Error: {0} -Output: {1} - Échec du changement de l'autorisation : -Erreur : {0} -Sortie : {1} - - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. Dans la mesure où vous venez d'installer le kit SDK .NET Core, vous devez rouvrir la fenêtre d'invite de commandes avant d'exécuter l'outil que vous avez installé. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: - -setx PATH "%PATH%;{1}" - Le chemin des exécutables des outils est introuvable. Vérifiez que {0} est ajouté à PATH. -Utilisez la commande suivante : - -setx PATH "%PATH%;{1}" - - Package '{0}' is missing entry point file {1}. Le package '{0}' ne contient pas le fichier de point d'entrée {1}. @@ -795,8 +731,122 @@ setx PATH "%PATH%;{1}" - Tool '{0}' is already installed. - Tool '{0}' is already installed. + Tool '{0}' (version '{1}') is already installed. + Tool '{0}' (version '{1}') is already installed. + + + + Command '{0}' conflicts with an existing command from another tool. + Command '{0}' conflicts with an existing command from another tool. + + + + Cannot create shell shim for an empty executable path. + Cannot create shell shim for an empty executable path. + + + + Cannot create shell shim for an empty command. + Cannot create shell shim for an empty command. + + + + Failed to retrieve tool configuration: {0} + Failed to retrieve tool configuration: {0} + + + + Failed to create tool shim for command '{0}': {1} + Failed to create tool shim for command '{0}': {1} + + + + Failed to remove tool shim for command '{0}': {1} + Failed to remove tool shim for command '{0}': {1} + + + + Failed to set user executable permissions for shell shim: {0} + Failed to set user executable permissions for shell shim: {0} + + + + Failed to install tool package '{0}': {1} + Failed to install tool package '{0}': {1} + + + + Failed to uninstall tool package '{0}': {1} + Failed to uninstall tool package '{0}': {1} + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + diff --git a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf index 0ffa11a5c..7854bfddf 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf @@ -680,85 +680,21 @@ {0} - - NuGet configuration file {0} does not exist. - Il file di configurazione NuGet {0} non esiste. - - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. Dal momento che è stato appena installato .NET Core SDK, è necessario disconnettersi o riavviare la sessione prima di eseguire lo strumento installato. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - Il percorso dell'eseguibile degli strumenti non è stato trovato. Assicurarsi che {0} sia stato aggiunto a PATH. -Se si usa bash, è possibile verificarlo eseguendo il comando seguente: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. Dal momento che è stato appena installato .NET Core SDK, è necessario riaprire il terminale prima di eseguire lo strumento installato. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - Il percorso dell'eseguibile degli strumenti non è stato trovato. Assicurarsi che {0} sia stato aggiunto a PATH. -Se si usa bash, è possibile verificarlo eseguendo il comando seguente: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - - - Failed to install tool {0}. A command with the same name already exists. - Non è stato possibile installare lo strumento {0}. Esiste già un comando con lo stesso nome. - - - - Failed to change permission: -Error: {0} -Output: {1} - Non è stato possibile cambiare l'autorizzazione: -Errore: {0} -Output: {1} - - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. Dal momento che è stato appena installato .NET Core SDK, è necessario riaprire la finestra del prompt dei comandi prima di eseguire lo strumento installato. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: - -setx PATH "%PATH%;{1}" - Il percorso dell'eseguibile degli strumenti non è stato trovato. Assicurarsi che {0} sia stato aggiunto a PATH. -Per verificarlo, eseguire il comando seguente: - -setx PATH "%PATH%;{1}" - - Package '{0}' is missing entry point file {1}. Nel pacchetto '{0}' manca il file del punto di ingresso {1}. @@ -795,8 +731,122 @@ setx PATH "%PATH%;{1}" - Tool '{0}' is already installed. - Tool '{0}' is already installed. + Tool '{0}' (version '{1}') is already installed. + Tool '{0}' (version '{1}') is already installed. + + + + Command '{0}' conflicts with an existing command from another tool. + Command '{0}' conflicts with an existing command from another tool. + + + + Cannot create shell shim for an empty executable path. + Cannot create shell shim for an empty executable path. + + + + Cannot create shell shim for an empty command. + Cannot create shell shim for an empty command. + + + + Failed to retrieve tool configuration: {0} + Failed to retrieve tool configuration: {0} + + + + Failed to create tool shim for command '{0}': {1} + Failed to create tool shim for command '{0}': {1} + + + + Failed to remove tool shim for command '{0}': {1} + Failed to remove tool shim for command '{0}': {1} + + + + Failed to set user executable permissions for shell shim: {0} + Failed to set user executable permissions for shell shim: {0} + + + + Failed to install tool package '{0}': {1} + Failed to install tool package '{0}': {1} + + + + Failed to uninstall tool package '{0}': {1} + Failed to uninstall tool package '{0}': {1} + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf index 881f40655..34a4a3615 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf @@ -680,85 +680,21 @@ {0} - - NuGet configuration file {0} does not exist. - NuGet 構成ファイル {0} は存在しません。 - - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. .NET Core SDK をインストールしたばかりなので、インストールしたツールを実行する前に、ログアウトするか、セッションを再起動する必要があります。 - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - ツールの実行可能パスが見つかりません。{0} が PATH に追加されていることを確認してください。 -bash を使用している場合、次のコマンドを実行してこれを行えます: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. .NET Core SDK をインストールしたばかりなので、インストールしたツールを実行する前に、端末を再び開く必要があります。 - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - ツールの実行可能パスが見つかりません。{0} が PATH に追加されていることを確認してください。 -bash を使用している場合、次のコマンドを実行してこれを行えます: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - - - Failed to install tool {0}. A command with the same name already exists. - ツール {0} をインストールできませんでした。同じ名前のコマンドが既に存在しています。 - - - - Failed to change permission: -Error: {0} -Output: {1} - アクセス許可を変更できませんでした: -エラー: {0} -出力: {1} - - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. .NET Core SDK をインストールしたばかりなので、インストールしたツールを実行する前に、コマンド プロンプト ウィンドウを再び開く必要があります。 - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: - -setx PATH "%PATH%;{1}" - ツールの実行可能パスが見つかりません。{0} が PATH に追加されていることを確認してください。 -次のコマンドを実行してこれを行えます: - -setx PATH "%PATH%;{1}" - - Package '{0}' is missing entry point file {1}. パッケージ '{0}' にエントリ ポイント ファイル {1} がありません。 @@ -795,8 +731,122 @@ setx PATH "%PATH%;{1}" - Tool '{0}' is already installed. - Tool '{0}' is already installed. + Tool '{0}' (version '{1}') is already installed. + Tool '{0}' (version '{1}') is already installed. + + + + Command '{0}' conflicts with an existing command from another tool. + Command '{0}' conflicts with an existing command from another tool. + + + + Cannot create shell shim for an empty executable path. + Cannot create shell shim for an empty executable path. + + + + Cannot create shell shim for an empty command. + Cannot create shell shim for an empty command. + + + + Failed to retrieve tool configuration: {0} + Failed to retrieve tool configuration: {0} + + + + Failed to create tool shim for command '{0}': {1} + Failed to create tool shim for command '{0}': {1} + + + + Failed to remove tool shim for command '{0}': {1} + Failed to remove tool shim for command '{0}': {1} + + + + Failed to set user executable permissions for shell shim: {0} + Failed to set user executable permissions for shell shim: {0} + + + + Failed to install tool package '{0}': {1} + Failed to install tool package '{0}': {1} + + + + Failed to uninstall tool package '{0}': {1} + Failed to uninstall tool package '{0}': {1} + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf index fd686308d..364171f17 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf @@ -680,85 +680,21 @@ {0} - - NuGet configuration file {0} does not exist. - NuGet 구성 파일 {0}이(가) 없습니다. - - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. .NET Core SDK를 방금 설치했기 때문에 설치한 도구를 실행하기 전에 로그아웃하거나 세션을 다시 시작해야 합니다. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - 도구 실행 파일 경로를 찾을 수 없습니다. {0}이(가) 경로에 추가되었는지 확인하세요. -Bash를 사용하는 경우 다음 명령을 실행하여 이 작업을 수행할 수 있습니다. - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. .NET Core SDK를 방금 설치했기 때문에 설치한 도구를 실행하기 전에 터미널을 다시 열어야 합니다. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - 도구 실행 파일 경로를 찾을 수 없습니다. {0}이(가) 경로에 추가되었는지 확인하세요. -Bash를 사용하는 경우 다음 명령을 실행하여 이 작업을 수행할 수 있습니다. - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - - - Failed to install tool {0}. A command with the same name already exists. - {0} 도구를 설치하지 못했습니다. 이름이 같은 명령이 이미 존재합니다. - - - - Failed to change permission: -Error: {0} -Output: {1} - 권한을 변경하지 못했습니다. -오류: {0} -출력: {1} - - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. .NET Core SDK를 방금 설치했기 때문에 설치한 도구를 실행하기 전에 명령 프롬프트 창을 다시 열어야 합니다. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: - -setx PATH "%PATH%;{1}" - 도구 실행 파일 경로를 찾을 수 없습니다. {0}이(가) 경로에 추가되었는지 확인하세요. -다음 명령을 실행하여 이 작업을 수행할 수 있습니다. - -setx PATH "%PATH%;{1}" - - Package '{0}' is missing entry point file {1}. 패키지 '{0}'이(가) 누락된 진입점 파일 {1}입니다. @@ -795,8 +731,122 @@ setx PATH "%PATH%;{1}" - Tool '{0}' is already installed. - Tool '{0}' is already installed. + Tool '{0}' (version '{1}') is already installed. + Tool '{0}' (version '{1}') is already installed. + + + + Command '{0}' conflicts with an existing command from another tool. + Command '{0}' conflicts with an existing command from another tool. + + + + Cannot create shell shim for an empty executable path. + Cannot create shell shim for an empty executable path. + + + + Cannot create shell shim for an empty command. + Cannot create shell shim for an empty command. + + + + Failed to retrieve tool configuration: {0} + Failed to retrieve tool configuration: {0} + + + + Failed to create tool shim for command '{0}': {1} + Failed to create tool shim for command '{0}': {1} + + + + Failed to remove tool shim for command '{0}': {1} + Failed to remove tool shim for command '{0}': {1} + + + + Failed to set user executable permissions for shell shim: {0} + Failed to set user executable permissions for shell shim: {0} + + + + Failed to install tool package '{0}': {1} + Failed to install tool package '{0}': {1} + + + + Failed to uninstall tool package '{0}': {1} + Failed to uninstall tool package '{0}': {1} + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + diff --git a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf index 350066dcd..3a30b7039 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf @@ -680,85 +680,21 @@ {0} - - NuGet configuration file {0} does not exist. - Plik konfiguracji pakietu NuGet {0} nie istnieje. - - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. Właśnie zainstalowano zestaw .NET Core SDK, dlatego należy wylogować się lub uruchomić ponownie sesję przed uruchomieniem zainstalowanego narzędzia. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - Nie można odnaleźć ścieżki do pliku wykonywalnego narzędzi. Upewnij się, że dodano wartość {0} do zmiennej środowiskowej PATH. -W powłoce bash można to zrobić, wykonując następujące polecenie: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. Właśnie zainstalowano zestaw .NET Core SDK, dlatego należy ponownie otworzyć terminal przed uruchomieniem zainstalowanego narzędzia. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - Nie można odnaleźć ścieżki do pliku wykonywalnego narzędzi. Upewnij się, że dodano wartość {0} do zmiennej środowiskowej PATH. -W powłoce bash można to zrobić, wykonując następujące polecenie: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - - - Failed to install tool {0}. A command with the same name already exists. - Nie można zainstalować narzędzia {0}. Polecenie o tej samej nazwie już istnieje. - - - - Failed to change permission: -Error: {0} -Output: {1} - Nie można zmienić uprawnienia: -Błąd: {0} -Dane wyjściowe: {1} - - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. Właśnie zainstalowano zestaw .NET Core SDK, dlatego należy ponownie otworzyć okno wiersza polecenia przed uruchomieniem zainstalowanego narzędzia. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: - -setx PATH "%PATH%;{1}" - Nie można odnaleźć ścieżki do pliku wykonywalnego narzędzi. Upewnij się, że dodano wartość {0} do zmiennej środowiskowej PATH. -Można to zrobić, uruchamiając następujące polecenie: - -setx PATH "%PATH%;{1}" - - Package '{0}' is missing entry point file {1}. Brak pliku punktu wejściowego {1} w pakiecie „{0}”. @@ -795,8 +731,122 @@ setx PATH "%PATH%;{1}" - Tool '{0}' is already installed. - Tool '{0}' is already installed. + Tool '{0}' (version '{1}') is already installed. + Tool '{0}' (version '{1}') is already installed. + + + + Command '{0}' conflicts with an existing command from another tool. + Command '{0}' conflicts with an existing command from another tool. + + + + Cannot create shell shim for an empty executable path. + Cannot create shell shim for an empty executable path. + + + + Cannot create shell shim for an empty command. + Cannot create shell shim for an empty command. + + + + Failed to retrieve tool configuration: {0} + Failed to retrieve tool configuration: {0} + + + + Failed to create tool shim for command '{0}': {1} + Failed to create tool shim for command '{0}': {1} + + + + Failed to remove tool shim for command '{0}': {1} + Failed to remove tool shim for command '{0}': {1} + + + + Failed to set user executable permissions for shell shim: {0} + Failed to set user executable permissions for shell shim: {0} + + + + Failed to install tool package '{0}': {1} + Failed to install tool package '{0}': {1} + + + + Failed to uninstall tool package '{0}': {1} + Failed to uninstall tool package '{0}': {1} + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + diff --git a/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf b/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf index 2d29fb71f..5b5c6c68d 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf @@ -680,85 +680,21 @@ {0} - - NuGet configuration file {0} does not exist. - O arquivo de configuração {0} do NuGet não existe. - - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. Já que você acabou de instalar o SDK do .NET Core, você ainda precisará fazer logoff ou reiniciar a sessão antes de executar a ferramenta instalada. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - Não é possível encontrar o caminho do executável da ferramenta. Verifique se {0} foi adicionado ao PATH. -Se estiver usando o Bash, faça isso executando o seguinte comando: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. Já que você acabou de instalar o SDK do .NET Core, você ainda precisará reabrir o terminal antes de executar a ferramenta instalada. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - Não é possível encontrar o caminho do executável da ferramenta. Verifique se {0} foi adicionado ao PATH. -Se estiver usando o Bash, faça isso executando o seguinte comando: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - - - Failed to install tool {0}. A command with the same name already exists. - Falha ao instalar a ferramenta {0}. Já existe um comando com o mesmo nome. - - - - Failed to change permission: -Error: {0} -Output: {1} - Falha ao alterar permissão: -Error: {0} -Output: {1} - - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. Já que você acabou de instalar o SDK do .NET Core, você ainda precisará reabrir a janela do Prompt de Comando antes de executar a ferramenta instalada. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: - -setx PATH "%PATH%;{1}" - Não é possível encontrar o caminho do executável da ferramenta. Verifique se {0} foi adicionado ao PATH. -Faça isso executando o seguinte comando: - -setx PATH "%PATH%;{1}" - - Package '{0}' is missing entry point file {1}. O arquivo de ponto de entrada {1} está ausente do pacote '{0}'. @@ -795,8 +731,122 @@ setx PATH "%PATH%;{1}" - Tool '{0}' is already installed. - Tool '{0}' is already installed. + Tool '{0}' (version '{1}') is already installed. + Tool '{0}' (version '{1}') is already installed. + + + + Command '{0}' conflicts with an existing command from another tool. + Command '{0}' conflicts with an existing command from another tool. + + + + Cannot create shell shim for an empty executable path. + Cannot create shell shim for an empty executable path. + + + + Cannot create shell shim for an empty command. + Cannot create shell shim for an empty command. + + + + Failed to retrieve tool configuration: {0} + Failed to retrieve tool configuration: {0} + + + + Failed to create tool shim for command '{0}': {1} + Failed to create tool shim for command '{0}': {1} + + + + Failed to remove tool shim for command '{0}': {1} + Failed to remove tool shim for command '{0}': {1} + + + + Failed to set user executable permissions for shell shim: {0} + Failed to set user executable permissions for shell shim: {0} + + + + Failed to install tool package '{0}': {1} + Failed to install tool package '{0}': {1} + + + + Failed to uninstall tool package '{0}': {1} + Failed to uninstall tool package '{0}': {1} + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf index 8d10fd480..452fbb176 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf @@ -680,85 +680,21 @@ {0} - - NuGet configuration file {0} does not exist. - Файл конфигурации NuGet {0} не существует. - - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. Так как вы только что установили пакет SDK для .NET Core, перед его запуском нужно выйти из системы или перезапустить сеанс. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - Не удается найти путь к исполняемому файлу инструмента. Проверьте, что PATH содержит {0}. -Если вы используете Bash, выполните для этого следующую команду: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. Так как вы только что установили пакет SDK для .NET Core, перед его запуском нужно заново открыть терминал. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - Не удается найти путь к исполняемому файлу инструмента. Проверьте, что PATH содержит {0}. -Если вы используете Bash, выполните для этого следующую команду: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - - - Failed to install tool {0}. A command with the same name already exists. - Не удалось установить инструмент {0}. Команда с таким именем уже существует. - - - - Failed to change permission: -Error: {0} -Output: {1} - Не удалось изменить разрешение: -Ошибка: {0} -Выходные данные: {1} - - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. Так как вы только что установили пакет SDK для .NET Core, перед его запуском нужно заново открыть окно командной строки. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: - -setx PATH "%PATH%;{1}" - Не удается найти путь к исполняемому файлу инструмента. Проверьте, что PATH содержит {0}. -Для этого выполните следующую команду: - -setx PATH "%PATH%;{1}" - - Package '{0}' is missing entry point file {1}. В пакете "{0}" отсутствует файл точки входа {1}. @@ -795,8 +731,122 @@ setx PATH "%PATH%;{1}" - Tool '{0}' is already installed. - Tool '{0}' is already installed. + Tool '{0}' (version '{1}') is already installed. + Tool '{0}' (version '{1}') is already installed. + + + + Command '{0}' conflicts with an existing command from another tool. + Command '{0}' conflicts with an existing command from another tool. + + + + Cannot create shell shim for an empty executable path. + Cannot create shell shim for an empty executable path. + + + + Cannot create shell shim for an empty command. + Cannot create shell shim for an empty command. + + + + Failed to retrieve tool configuration: {0} + Failed to retrieve tool configuration: {0} + + + + Failed to create tool shim for command '{0}': {1} + Failed to create tool shim for command '{0}': {1} + + + + Failed to remove tool shim for command '{0}': {1} + Failed to remove tool shim for command '{0}': {1} + + + + Failed to set user executable permissions for shell shim: {0} + Failed to set user executable permissions for shell shim: {0} + + + + Failed to install tool package '{0}': {1} + Failed to install tool package '{0}': {1} + + + + Failed to uninstall tool package '{0}': {1} + Failed to uninstall tool package '{0}': {1} + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + diff --git a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf index 7e7c3d8e3..723e0bb4f 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf @@ -680,85 +680,21 @@ {0} - - NuGet configuration file {0} does not exist. - NuGet yapılandırma dosyası {0} yok. - - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. .NET Core SDK’sını yüklediğinizden, yüklediğiniz aracı çalıştırmadan önce oturumunuzu kapatmanız veya oturumu yeniden başlatmanız gerekiyor. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - Aracın yürütülebilir yolu bulunamıyor. Lütfen {0} öğesinin PATH’e eklendiğinden emin olun. -Bash kullanıyorsanız, bunu şu komutu çalıştırarak gerçekleştirebilirsiniz: - -cat << EOF >> ~/.bash_profile -# .NET Core SDK araçlarını ekle -export PATH="$PATH:{1}" -EOF - - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. .NET Core SDK’sını yüklediğinizden, yüklediğiniz aracı çalıştırmadan önce terminali yeniden açmanız gerekiyor. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - Aracın yürütülebilir yolu bulunamıyor. Lütfen {0} öğesinin PATH’e eklendiğinden emin olun. -Bash kullanıyorsanız, bunu şu komutu çalıştırarak gerçekleştirebilirsiniz: - -cat << EOF >> ~/.bash_profile -# .NET Core SDK araçlarını ekle -export PATH="$PATH:{1}" -EOF - - - - Failed to install tool {0}. A command with the same name already exists. - {0} aracı yüklenemedi. Aynı ada sahip bir komut zaten var. - - - - Failed to change permission: -Error: {0} -Output: {1} - İzin değiştirilemedi: -Hata: {0} -Çıkış: {1} - - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. .NET Core SDK’sını yüklediğinizden, yüklediğiniz aracı çalıştırmadan önce Komut İstemi penceresini yeniden açmanız gerekiyor. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: - -setx PATH "%PATH%;{1}" - Aracın yürütülebilir yolu bulunamıyor. Lütfen {0} öğesinin PATH’e eklendiğinden emin olun. -Bunu şu komutu çalıştırarak gerçekleştirebilirsiniz: - -setx PATH "%PATH%;{1}" - - Package '{0}' is missing entry point file {1}. '{0}' paketinde {1} giriş noktası dosyası eksik. @@ -795,8 +731,122 @@ setx PATH "%PATH%;{1}" - Tool '{0}' is already installed. - Tool '{0}' is already installed. + Tool '{0}' (version '{1}') is already installed. + Tool '{0}' (version '{1}') is already installed. + + + + Command '{0}' conflicts with an existing command from another tool. + Command '{0}' conflicts with an existing command from another tool. + + + + Cannot create shell shim for an empty executable path. + Cannot create shell shim for an empty executable path. + + + + Cannot create shell shim for an empty command. + Cannot create shell shim for an empty command. + + + + Failed to retrieve tool configuration: {0} + Failed to retrieve tool configuration: {0} + + + + Failed to create tool shim for command '{0}': {1} + Failed to create tool shim for command '{0}': {1} + + + + Failed to remove tool shim for command '{0}': {1} + Failed to remove tool shim for command '{0}': {1} + + + + Failed to set user executable permissions for shell shim: {0} + Failed to set user executable permissions for shell shim: {0} + + + + Failed to install tool package '{0}': {1} + Failed to install tool package '{0}': {1} + + + + Failed to uninstall tool package '{0}': {1} + Failed to uninstall tool package '{0}': {1} + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + diff --git a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf index b91e47ca1..4e102d03a 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf @@ -680,85 +680,21 @@ {0} - - NuGet configuration file {0} does not exist. - NuGet 配置文件 {0} 不存在。 - - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. 由于刚安装了 .NET Core SDK,因此在运行安装的工具之前,需要注销或重新启动会话。 - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - 找不到工具可执行文件路径。请确保已将 {0} 添加到 PATH。 -如果使用 bash,可通过运行以下命令来执行此操作: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. 由于刚安装了 .NET Core SDK,因此在运行安装的工具之前,需要重新打开终端。 - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - 找不到工具可执行文件路径。请确保已将 {0} 添加到 PATH。 -如果使用 bash,可通过运行以下命令来执行此操作: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - - - Failed to install tool {0}. A command with the same name already exists. - 未能安装工具 {0}。已存在同名的命令。 - - - - Failed to change permission: -Error: {0} -Output: {1} - 未能更改权限: -错误: {0} -输出: {1} - - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. 由于刚安装了 .NET Core SDK,因此在运行安装的工具之前,需要重新打开命令提示符窗口。 - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: - -setx PATH "%PATH%;{1}" - 找不到工具可执行文件路径。请确保已将 {0} 添加到 PATH。 -可通过运行以下命令来执行此操作: - -setx PATH "%PATH%;{1}" - - Package '{0}' is missing entry point file {1}. 包“{0}”缺少入口点文件 {1}。 @@ -795,8 +731,122 @@ setx PATH "%PATH%;{1}" - Tool '{0}' is already installed. - Tool '{0}' is already installed. + Tool '{0}' (version '{1}') is already installed. + Tool '{0}' (version '{1}') is already installed. + + + + Command '{0}' conflicts with an existing command from another tool. + Command '{0}' conflicts with an existing command from another tool. + + + + Cannot create shell shim for an empty executable path. + Cannot create shell shim for an empty executable path. + + + + Cannot create shell shim for an empty command. + Cannot create shell shim for an empty command. + + + + Failed to retrieve tool configuration: {0} + Failed to retrieve tool configuration: {0} + + + + Failed to create tool shim for command '{0}': {1} + Failed to create tool shim for command '{0}': {1} + + + + Failed to remove tool shim for command '{0}': {1} + Failed to remove tool shim for command '{0}': {1} + + + + Failed to set user executable permissions for shell shim: {0} + Failed to set user executable permissions for shell shim: {0} + + + + Failed to install tool package '{0}': {1} + Failed to install tool package '{0}': {1} + + + + Failed to uninstall tool package '{0}': {1} + Failed to uninstall tool package '{0}': {1} + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + diff --git a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf index 27f480310..3fd062b03 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf @@ -680,85 +680,21 @@ {0} - - NuGet configuration file {0} does not exist. - NuGet 組態檔 {0} 不存在。 - - Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed. 因為您剛才安裝了 .NET Core SDK,您必須先登出或重新啟動,才能執行您安裝的工具。 - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash. You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - 找不到工具的可執行路徑。請確定已將 {0} 新增到您的 PATH。 -如果您正在使用 Bash,可執行下列命令以完成上述動作: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed. 因為您剛才安裝了 .NET Core SDK,您必須先重新開啟終端機,才能執行您安裝的工具。 - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -If you are using bash, You can do this by running the following command: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - 找不到工具的可執行路徑。請確定已將 {0} 新增到您的 PATH。 -如果您正在使用 Bash,可執行下列命令以完成上述動作: - -cat << EOF >> ~/.bash_profile -# Add .NET Core SDK tools -export PATH="$PATH:{1}" -EOF - - - - Failed to install tool {0}. A command with the same name already exists. - 無法安裝工具 {0}。相同名稱的命令已經存在。 - - - - Failed to change permission: -Error: {0} -Output: {1} - 無法變更權限: -錯誤: {0} -輸出: {1} - - Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed. 因為您剛才安裝了 .NET Core SDK,您必須先重新開啟 [命令提示字元] 視窗,才能執行您安裝的工具。 - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: - -setx PATH "%PATH%;{1}" - 找不到工具的可執行路徑。請確定已將 {0} 新增到您的 PATH。 -您可執行下列命令以完成上述動作: - -setx PATH "%PATH%;{1}" - - Package '{0}' is missing entry point file {1}. 套件 '{0}' 缺少進入點檔案 {1}。 @@ -795,8 +731,122 @@ setx PATH "%PATH%;{1}" - Tool '{0}' is already installed. - Tool '{0}' is already installed. + Tool '{0}' (version '{1}') is already installed. + Tool '{0}' (version '{1}') is already installed. + + + + Command '{0}' conflicts with an existing command from another tool. + Command '{0}' conflicts with an existing command from another tool. + + + + Cannot create shell shim for an empty executable path. + Cannot create shell shim for an empty executable path. + + + + Cannot create shell shim for an empty command. + Cannot create shell shim for an empty command. + + + + Failed to retrieve tool configuration: {0} + Failed to retrieve tool configuration: {0} + + + + Failed to create tool shim for command '{0}': {1} + Failed to create tool shim for command '{0}': {1} + + + + Failed to remove tool shim for command '{0}': {1} + Failed to remove tool shim for command '{0}': {1} + + + + Failed to set user executable permissions for shell shim: {0} + Failed to set user executable permissions for shell shim: {0} + + + + Failed to install tool package '{0}': {1} + Failed to install tool package '{0}': {1} + + + + Failed to uninstall tool package '{0}': {1} + Failed to uninstall tool package '{0}': {1} + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. +If you are using bash, you can add it to your profile by running the following command: + +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF + +You can add it to the current session by running the following command: + +export PATH="$PATH:{0}" + + + + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + + Tools directory '{0}' is not currently on the PATH environment variable. + +You can add the directory to the PATH by running the following command: + +setx PATH "%PATH%;{0}" + diff --git a/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFirstTimeUseNoticeSentinel.cs b/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFirstTimeUseNoticeSentinel.cs index 19bba6c2b..8db9bc780 100644 --- a/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFirstTimeUseNoticeSentinel.cs +++ b/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFirstTimeUseNoticeSentinel.cs @@ -155,7 +155,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests throw new NotImplementedException(); } - public IEnumerable GetFiles(string path, string searchPattern) + public IEnumerable EnumerateFileSystemEntries(string path) + { + throw new NotImplementedException(); + } + + public IEnumerable EnumerateFileSystemEntries(string path, string searchPattern) { throw new NotImplementedException(); } @@ -175,6 +180,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests { throw new NotImplementedException(); } + + public void Move(string source, string destination) + { + throw new NotImplementedException(); + } } } } diff --git a/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFunctionReturnStringAndFakeFileSystem.cs b/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFunctionReturnStringAndFakeFileSystem.cs index 8062ecb07..8b22e15ca 100644 --- a/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFunctionReturnStringAndFakeFileSystem.cs +++ b/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFunctionReturnStringAndFakeFileSystem.cs @@ -125,6 +125,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests throw new UnauthorizedAccessException(); } + public void Move(string source, string destination) + { + throw new UnauthorizedAccessException(); + } + public void Delete(string path) { throw new UnauthorizedAccessException(); @@ -139,7 +144,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests throw new NotImplementedException(); } - public IEnumerable GetFiles(string path, string searchPattern) + public IEnumerable EnumerateFileSystemEntries(string path) + { + throw new UnauthorizedAccessException(); + } + + public IEnumerable EnumerateFileSystemEntries(string path, string searchPattern) { throw new UnauthorizedAccessException(); } @@ -163,13 +173,17 @@ namespace Microsoft.DotNet.Configurer.UnitTests { throw new NotImplementedException(); } + + public void Move(string source, string destination) + { + throw new NotImplementedException(); + } } private class Counter { public int Count { get; private set; } public void Increase() { Count++; } - } } } diff --git a/test/Microsoft.DotNet.Configurer.UnitTests/GivenANuGetCacheSentinel.cs b/test/Microsoft.DotNet.Configurer.UnitTests/GivenANuGetCacheSentinel.cs index 36800bcd2..ba76fb58b 100644 --- a/test/Microsoft.DotNet.Configurer.UnitTests/GivenANuGetCacheSentinel.cs +++ b/test/Microsoft.DotNet.Configurer.UnitTests/GivenANuGetCacheSentinel.cs @@ -183,7 +183,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests throw new NotImplementedException(); } - public IEnumerable GetFiles(string path, string searchPattern) + public IEnumerable EnumerateFileSystemEntries(string path) + { + throw new NotImplementedException(); + } + + public IEnumerable EnumerateFileSystemEntries(string path, string searchPattern) { throw new NotImplementedException(); } @@ -202,6 +207,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests { throw new NotImplementedException(); } + + public void Move(string source, string destination) + { + throw new NotImplementedException(); + } } private class FileMock : IFile @@ -262,6 +272,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests throw new NotImplementedException(); } + public void Move(string source, string destination) + { + throw new NotImplementedException(); + } + public void Delete(string path) { throw new NotImplementedException(); diff --git a/test/Microsoft.DotNet.ShellShim.Tests/FakeFile.cs b/test/Microsoft.DotNet.ShellShim.Tests/FakeFile.cs index f9d8d414d..9b46dc2f4 100644 --- a/test/Microsoft.DotNet.ShellShim.Tests/FakeFile.cs +++ b/test/Microsoft.DotNet.ShellShim.Tests/FakeFile.cs @@ -39,7 +39,6 @@ namespace Microsoft.DotNet.ShellShim.Tests throw new NotImplementedException(); } - public void CreateEmptyFile(string path) { _files.Add(path, String.Empty); @@ -50,6 +49,11 @@ namespace Microsoft.DotNet.ShellShim.Tests _files[path] = content; } + public void Move(string source, string destination) + { + throw new NotImplementedException(); + } + public void Delete(string path) { throw new NotImplementedException(); diff --git a/test/Microsoft.DotNet.ShellShim.Tests/LinuxEnvironmentPathTests.cs b/test/Microsoft.DotNet.ShellShim.Tests/LinuxEnvironmentPathTests.cs index 1457e6274..17b26b38b 100644 --- a/test/Microsoft.DotNet.ShellShim.Tests/LinuxEnvironmentPathTests.cs +++ b/test/Microsoft.DotNet.ShellShim.Tests/LinuxEnvironmentPathTests.cs @@ -35,8 +35,8 @@ namespace Microsoft.DotNet.ShellShim.Tests // similar to https://code.visualstudio.com/docs/setup/mac reporter.Lines.Should().Equal( string.Format( - CommonLocalizableStrings.EnvironmentPathLinuxManualInstruction, - "/myhome/executable/path", "/myhome/executable/path")); + CommonLocalizableStrings.EnvironmentPathLinuxManualInstructions, + "/myhome/executable/path")); } [Fact] diff --git a/test/Microsoft.DotNet.ShellShim.Tests/OsxEnvironmentPathTests.cs b/test/Microsoft.DotNet.ShellShim.Tests/OsxEnvironmentPathTests.cs index df37a6b15..dfab68062 100644 --- a/test/Microsoft.DotNet.ShellShim.Tests/OsxEnvironmentPathTests.cs +++ b/test/Microsoft.DotNet.ShellShim.Tests/OsxEnvironmentPathTests.cs @@ -35,8 +35,8 @@ namespace Microsoft.DotNet.ShellShim.Tests // similar to https://code.visualstudio.com/docs/setup/mac reporter.Lines.Should().Equal( string.Format( - CommonLocalizableStrings.EnvironmentPathOSXManualInstruction, - "/myhome/executable/path", "/myhome/executable/path")); + CommonLocalizableStrings.EnvironmentPathOSXManualInstructions, + "/myhome/executable/path")); } [Theory] diff --git a/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs b/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs deleted file mode 100644 index 45c650e7a..000000000 --- a/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs +++ /dev/null @@ -1,324 +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 System.Diagnostics; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices; -using System.Transactions; -using System.Xml.Linq; -using FluentAssertions; -using Microsoft.DotNet.Cli.Utils; -using Microsoft.DotNet.TestFramework; -using Microsoft.DotNet.ToolPackage; -using Microsoft.DotNet.Tools; -using Microsoft.DotNet.Tools.Test.Utilities; -using Microsoft.DotNet.Tools.Tests.ComponentMocks; -using Microsoft.Extensions.EnvironmentAbstractions; -using Xunit; -using Xunit.Abstractions; - -namespace Microsoft.DotNet.ShellShim.Tests -{ - public class ShellShimMakerTests : TestBase - { - private readonly ITestOutputHelper _output; - - public ShellShimMakerTests(ITestOutputHelper output) - { - _output = output; - } - - [Theory] - [InlineData("my_native_app.exe", null)] - [InlineData("./my_native_app.js", "nodejs")] - [InlineData(@"C:\tools\my_native_app.dll", "dotnet")] - public void GivenAnRunnerOrEntryPointItCanCreateConfig(string entryPointPath, string runner) - { - var entryPoint = new FilePath(entryPointPath); - if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - return; - - var cleanFolderUnderTempRoot = GetNewCleanFolderUnderTempRoot(); - var shellShimMaker = new ShellShimMaker(cleanFolderUnderTempRoot); - - var tmpFile = new FilePath(Path.Combine(cleanFolderUnderTempRoot, Path.GetRandomFileName())); - - shellShimMaker.CreateConfigFile(tmpFile, entryPoint, runner); - - new FileInfo(tmpFile.Value).Should().Exist(); - - var generated = XDocument.Load(tmpFile.Value); - - generated.Descendants("appSettings") - .Descendants("add") - .Should() - .Contain(e => e.Attribute("key").Value == "runner" && e.Attribute("value").Value == (runner ?? string.Empty)) - .And - .Contain(e => e.Attribute("key").Value == "entryPoint" && e.Attribute("value").Value == entryPoint.Value); - } - - [Fact] - public void GivenAnExecutablePathItCanGenerateShimFile() - { - var outputDll = MakeHelloWorldExecutableDll(); - - var cleanFolderUnderTempRoot = GetNewCleanFolderUnderTempRoot(); - var shellShimMaker = new ShellShimMaker(cleanFolderUnderTempRoot); - var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); - - shellShimMaker.CreateShim(outputDll, shellCommandName); - - var stdOut = ExecuteInShell(shellCommandName, cleanFolderUnderTempRoot); - - stdOut.Should().Contain("Hello World"); - } - - [Fact] - public void GivenAnExecutablePathItCanGenerateShimFileInTransaction() - { - var outputDll = MakeHelloWorldExecutableDll(); - - var cleanFolderUnderTempRoot = GetNewCleanFolderUnderTempRoot(); - var shellShimMaker = new ShellShimMaker(cleanFolderUnderTempRoot); - var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); - - using (var transactionScope = new TransactionScope()) - { - shellShimMaker.CreateShim(outputDll, shellCommandName); - transactionScope.Complete(); - } - - var stdOut = ExecuteInShell(shellCommandName, cleanFolderUnderTempRoot); - - stdOut.Should().Contain("Hello World"); - } - - [Fact] - public void GivenAnExecutablePathDirectoryThatDoesNotExistItCanGenerateShimFile() - { - var outputDll = MakeHelloWorldExecutableDll(); - var extraNonExistDirectory = Path.GetRandomFileName(); - var shellShimMaker = new ShellShimMaker(Path.Combine(TempRoot.Root, extraNonExistDirectory)); - var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); - - Action a = () => shellShimMaker.CreateShim(outputDll, shellCommandName); - - a.ShouldNotThrow(); - } - - [Theory] - [InlineData("arg1 arg2", new[] { "arg1", "arg2" })] - [InlineData(" \"arg1 with space\" arg2", new[] { "arg1 with space", "arg2" })] - [InlineData(" \"arg with ' quote\" ", new[] { "arg with ' quote" })] - public void GivenAShimItPassesThroughArguments(string arguments, string[] expectedPassThru) - { - var outputDll = MakeHelloWorldExecutableDll(); - - var cleanFolderUnderTempRoot = GetNewCleanFolderUnderTempRoot(); - var shellShimMaker = new ShellShimMaker(cleanFolderUnderTempRoot); - var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); - - shellShimMaker.CreateShim(outputDll, shellCommandName); - - var stdOut = ExecuteInShell(shellCommandName, cleanFolderUnderTempRoot, arguments); - - for (int i = 0; i < expectedPassThru.Length; i++) - { - stdOut.Should().Contain($"{i} = {expectedPassThru[i]}"); - } - } - - [Theory] - [InlineData(false)] - [InlineData(true)] - public void GivenAnExecutablePathWithExistingSameNameShimItThrows(bool testMockBehaviorIsInSync) - { - var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); - var cleanFolderUnderTempRoot = GetNewCleanFolderUnderTempRoot(); - MakeNameConflictingCommand(cleanFolderUnderTempRoot, shellCommandName); - - IShellShimMaker shellShimMaker; - if (testMockBehaviorIsInSync) - { - shellShimMaker = new ShellShimMakerMock(cleanFolderUnderTempRoot); - } - else - { - shellShimMaker = new ShellShimMaker(cleanFolderUnderTempRoot); - } - - Action a = () => shellShimMaker.EnsureCommandNameUniqueness(shellCommandName); - a.ShouldThrow() - .And.Message - .Should().Contain( - string.Format(CommonLocalizableStrings.FailInstallToolSameName, shellCommandName)); - } - - [Theory] - [InlineData(false)] - [InlineData(true)] - public void GivenAnExecutablePathWithExistingSameNameShimItRollsBack(bool testMockBehaviorIsInSync) - { - var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); - - var pathToShim = GetNewCleanFolderUnderTempRoot(); - MakeNameConflictingCommand(pathToShim, shellCommandName); - - IShellShimMaker shellShimMaker; - if (testMockBehaviorIsInSync) - { - shellShimMaker = new ShellShimMakerMock(pathToShim); - } - else - { - shellShimMaker = new ShellShimMaker(pathToShim); - } - - Action a = () => - { - using (var t = new TransactionScope()) - { - shellShimMaker.CreateShim(new FilePath("dummy.dll"), shellCommandName); - - t.Complete(); - } - }; - a.ShouldThrow(); - - Directory.GetFiles(pathToShim).Should().HaveCount(1, "there is only intent conflicted command"); - } - - [Theory] - [InlineData(false)] - [InlineData(true)] - public void GivenAnExecutablePathErrorHappensItRollsBack(bool testMockBehaviorIsInSync) - { - var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); - - var pathToShim = GetNewCleanFolderUnderTempRoot(); - - IShellShimMaker shellShimMaker; - if (testMockBehaviorIsInSync) - { - shellShimMaker = new ShellShimMakerMock(pathToShim); - } - else - { - shellShimMaker = new ShellShimMaker(pathToShim); - } - - Action intendedError = () => throw new PackageObtainException(); - - Action a = () => - { - using (var t = new TransactionScope()) - { - shellShimMaker.CreateShim(new FilePath("dummy.dll"), shellCommandName); - - intendedError(); - t.Complete(); - } - }; - a.ShouldThrow(); - - Directory.GetFiles(pathToShim).Should().BeEmpty(); - } - - [Theory] - [InlineData(false)] - [InlineData(true)] - public void GivenAnExecutablePathWithoutExistingSameNameShimItShouldNotThrow(bool testMockBehaviorIsInSync) - { - var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); - var cleanFolderUnderTempRoot = GetNewCleanFolderUnderTempRoot(); - - IShellShimMaker shellShimMaker; - if (testMockBehaviorIsInSync) - { - shellShimMaker = new ShellShimMakerMock(cleanFolderUnderTempRoot); - } - else - { - shellShimMaker = new ShellShimMaker(cleanFolderUnderTempRoot); - } - - Action a = () => shellShimMaker.EnsureCommandNameUniqueness(shellCommandName); - a.ShouldNotThrow(); - } - - private static void MakeNameConflictingCommand(string pathToPlaceShim, string shellCommandName) - { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - shellCommandName = shellCommandName + ".exe"; - } - - File.WriteAllText(Path.Combine(pathToPlaceShim, shellCommandName), string.Empty); - } - - private string ExecuteInShell(string shellCommandName, string cleanFolderUnderTempRoot, string arguments = "") - { - ProcessStartInfo processStartInfo; - - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - var file = Path.Combine(cleanFolderUnderTempRoot, shellCommandName + ".exe"); - processStartInfo = new ProcessStartInfo - { - FileName = file, - UseShellExecute = false, - Arguments = arguments, - }; - } - else - { - processStartInfo = new ProcessStartInfo - { - FileName = "sh", - Arguments = shellCommandName + " " + arguments, - UseShellExecute = false - }; - } - - _output.WriteLine($"Launching '{processStartInfo.FileName} {processStartInfo.Arguments}'"); - processStartInfo.WorkingDirectory = cleanFolderUnderTempRoot; - processStartInfo.EnvironmentVariables["PATH"] = Path.GetDirectoryName(new Muxer().MuxerPath); - - processStartInfo.ExecuteAndCaptureOutput(out var stdOut, out var stdErr); - - stdErr.Should().BeEmpty(); - - return stdOut ?? ""; - } - - private static FilePath MakeHelloWorldExecutableDll() - { - const string testAppName = "TestAppSimple"; - const string emptySpaceToTestSpaceInPath = " "; - const string directoryNamePostFix = "Test"; - TestAssetInstance testInstance = TestAssets.Get(testAppName) - .CreateInstance(testAppName + emptySpaceToTestSpaceInPath + directoryNamePostFix) - .UseCurrentRuntimeFrameworkVersion() - .WithRestoreFiles() - .WithBuildFiles(); - - var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; - - FileInfo outputDll = testInstance.Root.GetDirectory("bin", configuration) - .GetDirectories().Single() - .GetFile($"{testAppName}.dll"); - - return new FilePath(outputDll.FullName); - } - - private static string GetNewCleanFolderUnderTempRoot() - { - DirectoryInfo CleanFolderUnderTempRoot = new DirectoryInfo(Path.Combine(TempRoot.Root, "cleanfolder" + Path.GetRandomFileName())); - CleanFolderUnderTempRoot.Create(); - - return CleanFolderUnderTempRoot.FullName; - } - } -} diff --git a/test/Microsoft.DotNet.ShellShim.Tests/ShellShimRepositoryTests.cs b/test/Microsoft.DotNet.ShellShim.Tests/ShellShimRepositoryTests.cs new file mode 100644 index 000000000..cf3599b54 --- /dev/null +++ b/test/Microsoft.DotNet.ShellShim.Tests/ShellShimRepositoryTests.cs @@ -0,0 +1,409 @@ +// 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 System.Diagnostics; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Transactions; +using System.Xml.Linq; +using FluentAssertions; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.TestFramework; +using Microsoft.DotNet.ToolPackage; +using Microsoft.DotNet.Tools; +using Microsoft.DotNet.Tools.Test.Utilities; +using Microsoft.DotNet.Tools.Tests.ComponentMocks; +using Microsoft.Extensions.EnvironmentAbstractions; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.DotNet.ShellShim.Tests +{ + public class ShellShimRepositoryTests : TestBase + { + private readonly ITestOutputHelper _output; + + public ShellShimRepositoryTests(ITestOutputHelper output) + { + _output = output; + } + + [WindowsOnlyTheory] + [InlineData("my_native_app.exe", null)] + [InlineData("./my_native_app.js", "nodejs")] + [InlineData(@"C:\tools\my_native_app.dll", "dotnet")] + public void GivenAnRunnerOrEntryPointItCanCreateConfig(string entryPointPath, string runner) + { + var pathToShim = GetNewCleanFolderUnderTempRoot(); + var shellShimRepository = new ShellShimRepository(new DirectoryPath(pathToShim)); + var tmpFile = new FilePath(Path.Combine(pathToShim, Path.GetRandomFileName())); + + shellShimRepository.CreateConfigFile(tmpFile, new FilePath(entryPointPath), runner); + + new FileInfo(tmpFile.Value).Should().Exist(); + + var generated = XDocument.Load(tmpFile.Value); + + generated.Descendants("appSettings") + .Descendants("add") + .Should() + .Contain(e => e.Attribute("key").Value == "runner" && e.Attribute("value").Value == (runner ?? string.Empty)) + .And + .Contain(e => e.Attribute("key").Value == "entryPoint" && e.Attribute("value").Value == entryPointPath); + } + + [Fact] + public void GivenAnExecutablePathItCanGenerateShimFile() + { + var outputDll = MakeHelloWorldExecutableDll(); + var pathToShim = GetNewCleanFolderUnderTempRoot(); + var shellShimRepository = new ShellShimRepository(new DirectoryPath(pathToShim)); + var shellCommandName = nameof(ShellShimRepositoryTests) + Path.GetRandomFileName(); + + shellShimRepository.CreateShim(outputDll, shellCommandName); + + var stdOut = ExecuteInShell(shellCommandName, pathToShim); + + stdOut.Should().Contain("Hello World"); + } + + [Fact] + public void GivenAnExecutablePathItCanGenerateShimFileInTransaction() + { + var outputDll = MakeHelloWorldExecutableDll(); + var pathToShim = GetNewCleanFolderUnderTempRoot(); + var shellShimRepository = new ShellShimRepository(new DirectoryPath(pathToShim)); + var shellCommandName = nameof(ShellShimRepositoryTests) + Path.GetRandomFileName(); + + using (var transactionScope = new TransactionScope( + TransactionScopeOption.Required, + TimeSpan.Zero)) + { + shellShimRepository.CreateShim(outputDll, shellCommandName); + transactionScope.Complete(); + } + + var stdOut = ExecuteInShell(shellCommandName, pathToShim); + + stdOut.Should().Contain("Hello World"); + } + + [Fact] + public void GivenAnExecutablePathDirectoryThatDoesNotExistItCanGenerateShimFile() + { + var outputDll = MakeHelloWorldExecutableDll(); + var extraNonExistDirectory = Path.GetRandomFileName(); + var shellShimRepository = new ShellShimRepository(new DirectoryPath(Path.Combine(TempRoot.Root, extraNonExistDirectory))); + var shellCommandName = nameof(ShellShimRepositoryTests) + Path.GetRandomFileName(); + + Action a = () => shellShimRepository.CreateShim(outputDll, shellCommandName); + + a.ShouldNotThrow(); + } + + [Theory] + [InlineData("arg1 arg2", new[] { "arg1", "arg2" })] + [InlineData(" \"arg1 with space\" arg2", new[] { "arg1 with space", "arg2" })] + [InlineData(" \"arg with ' quote\" ", new[] { "arg with ' quote" })] + public void GivenAShimItPassesThroughArguments(string arguments, string[] expectedPassThru) + { + var outputDll = MakeHelloWorldExecutableDll(); + var pathToShim = GetNewCleanFolderUnderTempRoot(); + var shellShimRepository = new ShellShimRepository(new DirectoryPath(pathToShim)); + var shellCommandName = nameof(ShellShimRepositoryTests) + Path.GetRandomFileName(); + + shellShimRepository.CreateShim(outputDll, shellCommandName); + + var stdOut = ExecuteInShell(shellCommandName, pathToShim, arguments); + + for (int i = 0; i < expectedPassThru.Length; i++) + { + stdOut.Should().Contain($"{i} = {expectedPassThru[i]}"); + } + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAShimConflictItWillRollback(bool testMockBehaviorIsInSync) + { + var shellCommandName = nameof(ShellShimRepositoryTests) + Path.GetRandomFileName(); + var pathToShim = GetNewCleanFolderUnderTempRoot(); + MakeNameConflictingCommand(pathToShim, shellCommandName); + + IShellShimRepository shellShimRepository; + if (testMockBehaviorIsInSync) + { + shellShimRepository = new ShellShimRepositoryMock(new DirectoryPath(pathToShim)); + } + else + { + shellShimRepository = new ShellShimRepository(new DirectoryPath(pathToShim)); + } + + Action a = () => + { + using (var scope = new TransactionScope( + TransactionScopeOption.Required, + TimeSpan.Zero)) + { + shellShimRepository.CreateShim(new FilePath("dummy.dll"), shellCommandName); + + scope.Complete(); + } + }; + + a.ShouldThrow().Where( + ex => ex.Message == + string.Format( + CommonLocalizableStrings.ShellShimConflict, + shellCommandName)); + + Directory + .EnumerateFileSystemEntries(pathToShim) + .Should() + .HaveCount(1, "should only be the original conflicting command"); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAnExceptionItWillRollback(bool testMockBehaviorIsInSync) + { + var shellCommandName = nameof(ShellShimRepositoryTests) + Path.GetRandomFileName(); + var pathToShim = GetNewCleanFolderUnderTempRoot(); + + IShellShimRepository shellShimRepository; + if (testMockBehaviorIsInSync) + { + shellShimRepository = new ShellShimRepositoryMock(new DirectoryPath(pathToShim)); + } + else + { + shellShimRepository = new ShellShimRepository(new DirectoryPath(pathToShim)); + } + + Action intendedError = () => throw new ToolPackageException("simulated error"); + + Action a = () => + { + using (var scope = new TransactionScope( + TransactionScopeOption.Required, + TimeSpan.Zero)) + { + shellShimRepository.CreateShim(new FilePath("dummy.dll"), shellCommandName); + + intendedError(); + scope.Complete(); + } + }; + a.ShouldThrow().WithMessage("simulated error"); + + Directory.EnumerateFileSystemEntries(pathToShim).Should().BeEmpty(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenANonexistentShimRemoveDoesNotThrow(bool testMockBehaviorIsInSync) + { + var shellCommandName = nameof(ShellShimRepositoryTests) + Path.GetRandomFileName(); + var pathToShim = GetNewCleanFolderUnderTempRoot(); + + IShellShimRepository shellShimRepository; + if (testMockBehaviorIsInSync) + { + shellShimRepository = new ShellShimRepositoryMock(new DirectoryPath(pathToShim)); + } + else + { + shellShimRepository = new ShellShimRepository(new DirectoryPath(pathToShim)); + } + + Directory.EnumerateFileSystemEntries(pathToShim).Should().BeEmpty(); + + shellShimRepository.RemoveShim(shellCommandName); + + Directory.EnumerateFileSystemEntries(pathToShim).Should().BeEmpty(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAnInstalledShimRemoveDeletesTheShimFiles(bool testMockBehaviorIsInSync) + { + var shellCommandName = nameof(ShellShimRepositoryTests) + Path.GetRandomFileName(); + var pathToShim = GetNewCleanFolderUnderTempRoot(); + + IShellShimRepository shellShimRepository; + if (testMockBehaviorIsInSync) + { + shellShimRepository = new ShellShimRepositoryMock(new DirectoryPath(pathToShim)); + } + else + { + shellShimRepository = new ShellShimRepository(new DirectoryPath(pathToShim)); + } + + Directory.EnumerateFileSystemEntries(pathToShim).Should().BeEmpty(); + + shellShimRepository.CreateShim(new FilePath("dummy.dll"), shellCommandName); + + Directory.EnumerateFileSystemEntries(pathToShim).Should().NotBeEmpty(); + + shellShimRepository.RemoveShim(shellCommandName); + + Directory.EnumerateFileSystemEntries(pathToShim).Should().BeEmpty(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAnInstalledShimRemoveRollsbackIfTransactionIsAborted(bool testMockBehaviorIsInSync) + { + var shellCommandName = nameof(ShellShimRepositoryTests) + Path.GetRandomFileName(); + var pathToShim = GetNewCleanFolderUnderTempRoot(); + + IShellShimRepository shellShimRepository; + if (testMockBehaviorIsInSync) + { + shellShimRepository = new ShellShimRepositoryMock(new DirectoryPath(pathToShim)); + } + else + { + shellShimRepository = new ShellShimRepository(new DirectoryPath(pathToShim)); + } + + Directory.EnumerateFileSystemEntries(pathToShim).Should().BeEmpty(); + + shellShimRepository.CreateShim(new FilePath("dummy.dll"), shellCommandName); + + Directory.EnumerateFileSystemEntries(pathToShim).Should().NotBeEmpty(); + + using (var scope = new TransactionScope( + TransactionScopeOption.Required, + TimeSpan.Zero)) + { + shellShimRepository.RemoveShim(shellCommandName); + + Directory.EnumerateFileSystemEntries(pathToShim).Should().BeEmpty(); + } + + Directory.EnumerateFileSystemEntries(pathToShim).Should().NotBeEmpty(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAnInstalledShimRemoveCommitsIfTransactionIsCompleted(bool testMockBehaviorIsInSync) + { + var shellCommandName = nameof(ShellShimRepositoryTests) + Path.GetRandomFileName(); + var pathToShim = GetNewCleanFolderUnderTempRoot(); + + IShellShimRepository shellShimRepository; + if (testMockBehaviorIsInSync) + { + shellShimRepository = new ShellShimRepositoryMock(new DirectoryPath(pathToShim)); + } + else + { + shellShimRepository = new ShellShimRepository(new DirectoryPath(pathToShim)); + } + + Directory.EnumerateFileSystemEntries(pathToShim).Should().BeEmpty(); + + shellShimRepository.CreateShim(new FilePath("dummy.dll"), shellCommandName); + + Directory.EnumerateFileSystemEntries(pathToShim).Should().NotBeEmpty(); + + using (var scope = new TransactionScope( + TransactionScopeOption.Required, + TimeSpan.Zero)) + { + shellShimRepository.RemoveShim(shellCommandName); + + Directory.EnumerateFileSystemEntries(pathToShim).Should().BeEmpty(); + + scope.Complete(); + } + + Directory.EnumerateFileSystemEntries(pathToShim).Should().BeEmpty(); + } + + private static void MakeNameConflictingCommand(string pathToPlaceShim, string shellCommandName) + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + shellCommandName = shellCommandName + ".exe"; + } + + File.WriteAllText(Path.Combine(pathToPlaceShim, shellCommandName), string.Empty); + } + + private string ExecuteInShell(string shellCommandName, string cleanFolderUnderTempRoot, string arguments = "") + { + ProcessStartInfo processStartInfo; + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + var file = Path.Combine(cleanFolderUnderTempRoot, shellCommandName + ".exe"); + processStartInfo = new ProcessStartInfo + { + FileName = file, + UseShellExecute = false, + Arguments = arguments, + }; + } + else + { + processStartInfo = new ProcessStartInfo + { + FileName = "sh", + Arguments = shellCommandName + " " + arguments, + UseShellExecute = false + }; + } + + _output.WriteLine($"Launching '{processStartInfo.FileName} {processStartInfo.Arguments}'"); + processStartInfo.WorkingDirectory = cleanFolderUnderTempRoot; + processStartInfo.EnvironmentVariables["PATH"] = Path.GetDirectoryName(new Muxer().MuxerPath); + + processStartInfo.ExecuteAndCaptureOutput(out var stdOut, out var stdErr); + + stdErr.Should().BeEmpty(); + + return stdOut ?? ""; + } + + private static FilePath MakeHelloWorldExecutableDll() + { + const string testAppName = "TestAppSimple"; + const string emptySpaceToTestSpaceInPath = " "; + const string directoryNamePostFix = "Test"; + TestAssetInstance testInstance = TestAssets.Get(testAppName) + .CreateInstance(testAppName + emptySpaceToTestSpaceInPath + directoryNamePostFix) + .UseCurrentRuntimeFrameworkVersion() + .WithRestoreFiles() + .WithBuildFiles(); + + var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; + + FileInfo outputDll = testInstance.Root.GetDirectory("bin", configuration) + .EnumerateDirectories() + .Single() + .GetFile($"{testAppName}.dll"); + + return new FilePath(outputDll.FullName); + } + + private static string GetNewCleanFolderUnderTempRoot() + { + DirectoryInfo CleanFolderUnderTempRoot = new DirectoryInfo(Path.Combine(TempRoot.Root, "cleanfolder" + Path.GetRandomFileName())); + CleanFolderUnderTempRoot.Create(); + + return CleanFolderUnderTempRoot.FullName; + } + } +} diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs b/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs index 977efdf35..4dc35e76b 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs +++ b/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs @@ -46,7 +46,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests { var invalidCommandName = "na\0me"; Action a = () => new ToolConfiguration(invalidCommandName, "my.dll"); - a.ShouldThrow() + a.ShouldThrow() .And.Message.Should() .Contain( string.Format( diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs new file mode 100644 index 000000000..9c4bf61f5 --- /dev/null +++ b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs @@ -0,0 +1,647 @@ +// 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 System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Transactions; +using FluentAssertions; +using Microsoft.DotNet.Tools.Test.Utilities; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.Tools; +using Microsoft.DotNet.Tools.Install.Tool; +using Microsoft.DotNet.Tools.Tests.ComponentMocks; +using Microsoft.Extensions.DependencyModel.Tests; +using Microsoft.Extensions.EnvironmentAbstractions; +using Xunit; + +namespace Microsoft.DotNet.ToolPackage.Tests +{ + public class ToolPackageInstallerTests : TestBase + { + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenNoFeedInstallFailsWithException(bool testMockBehaviorIsInSync) + { + var (store, installer, reporter, fileSystem) = Setup( + useMock: testMockBehaviorIsInSync, + feeds: new MockFeed[0]); + + Action a = () => installer.InstallPackage( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + targetFramework: _testTargetframework); + + a.ShouldThrow().WithMessage(LocalizableStrings.ToolInstallationRestoreFailed); + + reporter.Lines.Count.Should().Be(1); + reporter.Lines[0].Should().Contain(TestPackageId); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenOfflineFeedInstallSuceeds(bool testMockBehaviorIsInSync) + { + var (store, installer, reporter, fileSystem) = Setup( + useMock: testMockBehaviorIsInSync, + offlineFeed: new DirectoryPath(GetTestLocalFeedPath()), + feeds: GetOfflineMockFeed()); + + var package = installer.InstallPackage( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + targetFramework: _testTargetframework); + + AssertPackageInstall(reporter, fileSystem, package, store); + + package.Uninstall(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenNugetConfigInstallSucceeds(bool testMockBehaviorIsInSync) + { + var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); + + var (store, installer, reporter, fileSystem) = Setup( + useMock: testMockBehaviorIsInSync, + feeds: GetMockFeedsForConfigFile(nugetConfigPath)); + + var package = installer.InstallPackage( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + targetFramework: _testTargetframework, + nugetConfig: nugetConfigPath); + + AssertPackageInstall(reporter, fileSystem, package, store); + + package.Uninstall(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenNugetConfigInstallSucceedsInTransaction(bool testMockBehaviorIsInSync) + { + var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); + + var (store, installer, reporter, fileSystem) = Setup( + useMock: testMockBehaviorIsInSync, + feeds: GetMockFeedsForConfigFile(nugetConfigPath)); + + IToolPackage package = null; + using (var transactionScope = new TransactionScope( + TransactionScopeOption.Required, + TimeSpan.Zero)) + { + package = installer.InstallPackage( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + targetFramework: _testTargetframework, + nugetConfig: nugetConfigPath); + + transactionScope.Complete(); + } + + AssertPackageInstall(reporter, fileSystem, package, store); + + package.Uninstall(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenNugetConfigInstallCreatesAnAssetFile(bool testMockBehaviorIsInSync) + { + var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); + + var (store, installer, reporter, fileSystem) = Setup( + useMock: testMockBehaviorIsInSync, + feeds: GetMockFeedsForConfigFile(nugetConfigPath)); + + var package = installer.InstallPackage( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + targetFramework: _testTargetframework, + nugetConfig: nugetConfigPath); + + AssertPackageInstall(reporter, fileSystem, package, store); + + /* + From mytool.dll to project.assets.json + /packageid/version/packageid/version/tools/framework/rid/mytool.dll + /project.assets.json + */ + var assetJsonPath = package.Commands[0].Executable + .GetDirectoryPath() + .GetParentPath() + .GetParentPath() + .GetParentPath() + .GetParentPath() + .GetParentPath() + .WithFile("project.assets.json").Value; + + fileSystem.File.Exists(assetJsonPath).Should().BeTrue(); + + package.Uninstall(); + } + + [Fact] + public void GivenAConfigFileInCurrentDirectoryPackageInstallSucceeds() + { + var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); + + var (store, installer, reporter, fileSystem) = Setup(useMock: false); + + /* + * In test, we don't want NuGet to keep look up, so we point current directory to nugetconfig. + */ + Directory.SetCurrentDirectory(nugetConfigPath.GetDirectoryPath().Value); + + var package = installer.InstallPackage( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + targetFramework: _testTargetframework); + + AssertPackageInstall(reporter, fileSystem, package, store); + + package.Uninstall(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAllButNoPackageVersionItCanInstallThePackage(bool testMockBehaviorIsInSync) + { + var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); + + var (store, installer, reporter, fileSystem) = Setup( + useMock: testMockBehaviorIsInSync, + feeds: GetMockFeedsForConfigFile(nugetConfigPath)); + + var package = installer.InstallPackage( + packageId: TestPackageId, + targetFramework: _testTargetframework, + nugetConfig: nugetConfigPath); + + AssertPackageInstall(reporter, fileSystem, package, store); + + package.Uninstall(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAllButNoTargetFrameworkItCanDownloadThePackage(bool testMockBehaviorIsInSync) + { + var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); + + var (store, installer, reporter, fileSystem) = Setup( + useMock: testMockBehaviorIsInSync, + feeds: GetMockFeedsForConfigFile(nugetConfigPath)); + + var package = installer.InstallPackage( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + nugetConfig: nugetConfigPath); + + AssertPackageInstall(reporter, fileSystem, package, store); + + package.Uninstall(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenASourceInstallSucceeds(bool testMockBehaviorIsInSync) + { + var source = GetTestLocalFeedPath(); + + var (store, installer, reporter, fileSystem) = Setup( + useMock: testMockBehaviorIsInSync, + feeds: GetMockFeedsForSource(source)); + + var package = installer.InstallPackage( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + targetFramework: _testTargetframework, + source: source); + + AssertPackageInstall(reporter, fileSystem, package, store); + + package.Uninstall(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenFailedRestoreInstallWillRollback(bool testMockBehaviorIsInSync) + { + var (store, installer, reporter, fileSystem) = Setup( + useMock: testMockBehaviorIsInSync); + + Action a = () => { + using (var t = new TransactionScope( + TransactionScopeOption.Required, + TimeSpan.Zero)) + { + installer.InstallPackage("non.existent.package.id"); + + t.Complete(); + } + }; + + a.ShouldThrow().WithMessage(LocalizableStrings.ToolInstallationRestoreFailed); + + AssertInstallRollBack(fileSystem, store); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenFailureAfterRestoreInstallWillRollback(bool testMockBehaviorIsInSync) + { + var source = GetTestLocalFeedPath(); + + var (store, installer, reporter, fileSystem) = Setup( + useMock: testMockBehaviorIsInSync, + feeds: GetMockFeedsForSource(source)); + + void FailedStepAfterSuccessRestore() => throw new GracefulException("simulated error"); + + Action a = () => { + using (var t = new TransactionScope( + TransactionScopeOption.Required, + TimeSpan.Zero)) + { + installer.InstallPackage( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + targetFramework: _testTargetframework, + source: source); + + FailedStepAfterSuccessRestore(); + t.Complete(); + } + }; + + a.ShouldThrow().WithMessage("simulated error"); + + AssertInstallRollBack(fileSystem, store); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenSecondInstallInATransactionTheFirstInstallShouldRollback(bool testMockBehaviorIsInSync) + { + var source = GetTestLocalFeedPath(); + + var (store, installer, reporter, fileSystem) = Setup( + useMock: testMockBehaviorIsInSync, + feeds: GetMockFeedsForSource(source)); + + Action a = () => { + using (var t = new TransactionScope( + TransactionScopeOption.Required, + TimeSpan.Zero)) + { + Action first = () => installer.InstallPackage( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + targetFramework: _testTargetframework, + source: source); + + first.ShouldNotThrow(); + + installer.InstallPackage( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + targetFramework: _testTargetframework, + source: source); + + t.Complete(); + } + }; + + a.ShouldThrow().Where( + ex => ex.Message == + string.Format( + CommonLocalizableStrings.ToolPackageConflictPackageId, + TestPackageId, + TestPackageVersion)); + + AssertInstallRollBack(fileSystem, store); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenSecondInstallWithoutATransactionTheFirstShouldNotRollback(bool testMockBehaviorIsInSync) + { + var source = GetTestLocalFeedPath(); + + var (store, installer, reporter, fileSystem) = Setup( + useMock: testMockBehaviorIsInSync, + feeds: GetMockFeedsForSource(source)); + + var package = installer.InstallPackage( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + targetFramework: _testTargetframework, + source: source); + + AssertPackageInstall(reporter, fileSystem, package, store); + + Action secondCall = () => installer.InstallPackage( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + targetFramework: _testTargetframework, + source: source); + + reporter.Lines.Should().BeEmpty(); + + secondCall.ShouldThrow().Where( + ex => ex.Message == + string.Format( + CommonLocalizableStrings.ToolPackageConflictPackageId, + TestPackageId, + TestPackageVersion)); + + fileSystem + .Directory + .Exists(store.Root.WithSubDirectories(TestPackageId).Value) + .Should() + .BeTrue(); + + package.Uninstall(); + + fileSystem + .Directory + .EnumerateFileSystemEntries(store.Root.WithSubDirectories(".stage").Value) + .Should() + .BeEmpty(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAnInstalledPackageUninstallRemovesThePackage(bool testMockBehaviorIsInSync) + { + var source = GetTestLocalFeedPath(); + + var (store, installer, reporter, fileSystem) = Setup( + useMock: testMockBehaviorIsInSync, + feeds: GetMockFeedsForSource(source)); + + var package = installer.InstallPackage( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + targetFramework: _testTargetframework, + source: source); + + AssertPackageInstall(reporter, fileSystem, package, store); + + package.Uninstall(); + + store.GetInstalledPackages(TestPackageId).Should().BeEmpty(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAnInstalledPackageUninstallRollsbackWhenTransactionAborts(bool testMockBehaviorIsInSync) + { + var source = GetTestLocalFeedPath(); + + var (store, installer, reporter, fileSystem) = Setup( + useMock: testMockBehaviorIsInSync, + feeds: GetMockFeedsForSource(source)); + + var package = installer.InstallPackage( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + targetFramework: _testTargetframework, + source: source); + + AssertPackageInstall(reporter, fileSystem, package, store); + + using (var scope = new TransactionScope( + TransactionScopeOption.Required, + TimeSpan.Zero)) + { + package.Uninstall(); + + store.GetInstalledPackages(TestPackageId).Should().BeEmpty(); + } + + package = store.GetInstalledPackages(TestPackageId).First(); + + AssertPackageInstall(reporter, fileSystem, package, store); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAnInstalledPackageUninstallRemovesThePackageWhenTransactionCommits(bool testMockBehaviorIsInSync) + { + var source = GetTestLocalFeedPath(); + + var (store, installer, reporter, fileSystem) = Setup( + useMock: testMockBehaviorIsInSync, + feeds: GetMockFeedsForSource(source)); + + var package = installer.InstallPackage( + packageId: TestPackageId, + packageVersion: TestPackageVersion, + targetFramework: _testTargetframework, + source: source); + + AssertPackageInstall(reporter, fileSystem, package, store); + + using (var scope = new TransactionScope( + TransactionScopeOption.Required, + TimeSpan.Zero)) + { + package.Uninstall(); + scope.Complete(); + } + + store.GetInstalledPackages(TestPackageId).Should().BeEmpty(); + } + + private static void AssertPackageInstall( + BufferedReporter reporter, + IFileSystem fileSystem, + IToolPackage package, + IToolPackageStore store) + { + reporter.Lines.Should().BeEmpty(); + + package.PackageId.Should().Be(TestPackageId); + package.PackageVersion.Should().Be(TestPackageVersion); + package.PackageDirectory.Value.Should().Contain(store.Root.Value); + + store.GetInstalledPackages(TestPackageId).Select(p => p.PackageVersion).Should().Equal(TestPackageVersion); + + package.Commands.Count.Should().Be(1); + fileSystem.File.Exists(package.Commands[0].Executable.Value).Should().BeTrue($"{package.Commands[0].Executable.Value} should exist"); + package.Commands[0].Executable.Value.Should().Contain(store.Root.Value); + } + + private static void AssertInstallRollBack(IFileSystem fileSystem, IToolPackageStore store) + { + if (!fileSystem.Directory.Exists(store.Root.Value)) + { + return; + } + + fileSystem + .Directory + .EnumerateFileSystemEntries(store.Root.Value) + .Should() + .NotContain(e => Path.GetFileName(e) != ".stage"); + + fileSystem + .Directory + .EnumerateFileSystemEntries(store.Root.WithSubDirectories(".stage").Value) + .Should() + .BeEmpty(); + } + + private static FilePath GetUniqueTempProjectPathEachTest() + { + var tempProjectDirectory = + new DirectoryPath(Path.GetTempPath()).WithSubDirectories(Path.GetRandomFileName()); + var tempProjectPath = + tempProjectDirectory.WithFile(Path.GetRandomFileName() + ".csproj"); + return tempProjectPath; + } + + private static IEnumerable GetMockFeedsForConfigFile(FilePath nugetConfig) + { + return new MockFeed[] + { + new MockFeed + { + Type = MockFeedType.ExplicitNugetConfig, + Uri = nugetConfig.Value, + Packages = new List + { + new MockFeedPackage + { + PackageId = TestPackageId, + Version = TestPackageVersion + } + } + } + }; + } + + private static IEnumerable GetMockFeedsForSource(string source) + { + return new MockFeed[] + { + new MockFeed + { + Type = MockFeedType.Source, + Uri = source, + Packages = new List + { + new MockFeedPackage + { + PackageId = TestPackageId, + Version = TestPackageVersion + } + } + } + }; + } + + private static IEnumerable GetOfflineMockFeed() + { + return new MockFeed[] + { + new MockFeed + { + Type = MockFeedType.OfflineFeed, + Uri = GetTestLocalFeedPath(), + Packages = new List + { + new MockFeedPackage + { + PackageId = TestPackageId, + Version = TestPackageVersion + } + } + } + }; + } + + private static (IToolPackageStore, IToolPackageInstaller, BufferedReporter, IFileSystem) Setup( + bool useMock, + IEnumerable feeds = null, + FilePath? tempProject = null, + DirectoryPath? offlineFeed = null) + { + var root = new DirectoryPath(Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName())); + var reporter = new BufferedReporter(); + + IFileSystem fileSystem; + IToolPackageStore store; + IToolPackageInstaller installer; + if (useMock) + { + fileSystem = new FileSystemMockBuilder().Build(); + store = new ToolPackageStoreMock(root, fileSystem); + installer = new ToolPackageInstallerMock( + fileSystem: fileSystem, + store: store, + projectRestorer: new ProjectRestorerMock( + fileSystem: fileSystem, + reporter: reporter, + feeds: feeds)); + } + else + { + fileSystem = new FileSystemWrapper(); + store = new ToolPackageStore(root); + installer = new ToolPackageInstaller( + store: store, + projectRestorer: new ProjectRestorer(reporter), + tempProject: tempProject ?? GetUniqueTempProjectPathEachTest(), + offlineFeed: offlineFeed ?? new DirectoryPath("does not exist")); + } + + return (store, installer, reporter, fileSystem); + } + + private static FilePath WriteNugetConfigFileToPointToTheFeed() + { + var nugetConfigName = "nuget.config"; + + var tempPathForNugetConfigWithWhiteSpace = + Path.Combine(Path.GetTempPath(), + Path.GetRandomFileName() + " " + Path.GetRandomFileName()); + Directory.CreateDirectory(tempPathForNugetConfigWithWhiteSpace); + + NuGetConfig.Write( + directory: tempPathForNugetConfigWithWhiteSpace, + configname: nugetConfigName, + localFeedPath: GetTestLocalFeedPath()); + + return new FilePath(Path.GetFullPath(Path.Combine(tempPathForNugetConfigWithWhiteSpace, nugetConfigName))); + } + + private static string GetTestLocalFeedPath() => Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestAssetLocalNugetFeed"); + private readonly string _testTargetframework = BundledTargetFramework.GetTargetFrameworkMoniker(); + private const string TestPackageVersion = "1.0.4"; + private const string TestPackageId = "global.tool.console.demo"; + } +} diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs deleted file mode 100644 index 31b8c33b5..000000000 --- a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs +++ /dev/null @@ -1,640 +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 System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Transactions; -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; -using Microsoft.DotNet.Tools.Tests.ComponentMocks; - -namespace Microsoft.DotNet.ToolPackage.Tests -{ - public class ToolPackageObtainerTests : TestBase - { - [Fact] - public void GivenNoFeedItThrows() - { - var reporter = new BufferedReporter(); - var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); - - ToolPackageObtainer packageObtainer = - new ToolPackageObtainer( - new DirectoryPath(toolsPath), - new DirectoryPath("no such path"), - GetUniqueTempProjectPathEachTest, - new Lazy(), - new ProjectRestorer(reporter)); - - Action a = () => packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - 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 = - new ToolPackageObtainer( - toolsPath: new DirectoryPath(toolsPath), - offlineFeedPath: new DirectoryPath(GetTestLocalFeedPath()), - getTempProjectPath: GetUniqueTempProjectPathEachTest, - bundledTargetFrameworkMoniker: new Lazy(), - projectRestorer: new ProjectRestorer(reporter)); - - ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - targetframework: _testTargetframework); - - reporter.Lines.Should().BeEmpty(); - - var executable = toolConfigurationAndExecutablePath - .Executable; - - File.Exists(executable.Value) - .Should() - .BeTrue(executable + " should have the executable"); - - executable.Value.Should().NotContain(GetTestLocalFeedPath(), "Executable should not be still in fallbackfolder"); - executable.Value.Should().Contain(toolsPath, "Executable should be copied to tools Path"); - - File.Delete(executable.Value); - } - - [Theory] - [InlineData(false)] - [InlineData(true)] - public void GivenNugetConfigAndPackageNameAndVersionAndTargetFrameworkWhenCallItCanDownloadThePackage( - bool testMockBehaviorIsInSync) - { - var reporter = new BufferedReporter(); - FilePath nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); - var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); - - var packageObtainer = - ConstructDefaultPackageObtainer(toolsPath, reporter, testMockBehaviorIsInSync, nugetConfigPath.Value); - - ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath - = packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - nugetconfig: nugetConfigPath, - targetframework: _testTargetframework); - - reporter.Lines.Should().BeEmpty(); - - FilePath executable = toolConfigurationAndExecutablePath.Executable; - File.Exists(executable.Value) - .Should() - .BeTrue(executable + " should have the executable"); - - File.Delete(executable.Value); - } - - [Theory] - [InlineData(false)] - [InlineData(true)] - public void GivenNugetConfigAndPackageNameAndVersionAndTargetFrameworkWhenCallItCanDownloadThePackageInTransaction( - bool testMockBehaviorIsInSync) - { - var reporter = new BufferedReporter(); - FilePath nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); - var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); - - var packageObtainer = - ConstructDefaultPackageObtainer(toolsPath, reporter, testMockBehaviorIsInSync, nugetConfigPath.Value); - - ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath; - - using (var transactionScope = new TransactionScope()) - { - toolConfigurationAndExecutablePath - = packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - nugetconfig: nugetConfigPath, - targetframework: _testTargetframework); - - transactionScope.Complete(); - } - - reporter.Lines.Should().BeEmpty(); - - FilePath executable = toolConfigurationAndExecutablePath.Executable; - File.Exists(executable.Value) - .Should() - .BeTrue(executable + " should have the executable"); - - File.Delete(executable.Value); - } - - [Theory] - [InlineData(false)] - [InlineData(true)] - public void GivenNugetConfigAndPackageNameAndVersionAndTargetFrameworkWhenCallItCreateAssetFile( - bool testMockBehaviorIsInSync) - { - var reporter = new BufferedReporter(); - var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); - var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); - - var packageObtainer = - ConstructDefaultPackageObtainer(toolsPath, reporter, testMockBehaviorIsInSync, nugetConfigPath.Value); - - ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = - packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - nugetconfig: nugetConfigPath, - targetframework: _testTargetframework); - - reporter.Lines.Should().BeEmpty(); - - /* - From mytool.dll to project.assets.json - .dotnet/.tools/packageid/version/packageid/version/mytool.dll - /dependency1 package id/ - /dependency2 package id/ - /project.assets.json - */ - var assetJsonPath = toolConfigurationAndExecutablePath - .Executable - .GetDirectoryPath() - .GetParentPath() - .GetParentPath() - .GetParentPath() - .GetParentPath() - .GetParentPath() - .WithFile("project.assets.json").Value; - - File.Exists(assetJsonPath) - .Should() - .BeTrue(assetJsonPath + " should be created"); - - File.Delete(assetJsonPath); - } - - [Theory] - [InlineData(false)] - [InlineData(true)] - public void GivenAllButNoNugetConfigFilePathItCanDownloadThePackage(bool testMockBehaviorIsInSync) - { - var reporter = new BufferedReporter(); - var uniqueTempProjectPath = GetUniqueTempProjectPathEachTest(); - var tempProjectDirectory = uniqueTempProjectPath.GetDirectoryPath(); - var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); - var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); - - Directory.CreateDirectory(tempProjectDirectory.Value); - - /* - * In test, we don't want NuGet to keep look up, so we point current directory to nugetconfig. - */ - - Directory.SetCurrentDirectory(nugetConfigPath.GetDirectoryPath().Value); - - IToolPackageObtainer packageObtainer; - if (testMockBehaviorIsInSync) - { - packageObtainer = new ToolPackageObtainerMock(toolsPath: toolsPath); - } - else - { - packageObtainer = new ToolPackageObtainer( - new DirectoryPath(toolsPath), - new DirectoryPath("no such path"), - () => uniqueTempProjectPath, - new Lazy(), - new ProjectRestorer(reporter)); - } - - ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = - packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - targetframework: _testTargetframework); - - reporter.Lines.Should().BeEmpty(); - - var executable = toolConfigurationAndExecutablePath.Executable; - - File.Exists(executable.Value) - .Should() - .BeTrue(executable + " should have the executable"); - - File.Delete(executable.Value); - } - - [Theory] - [InlineData(false)] - [InlineData(true)] - public void GivenAllButNoPackageVersionItCanDownloadThePackage(bool testMockBehaviorIsInSync) - { - var reporter = new BufferedReporter(); - FilePath nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); - var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); - - var packageObtainer = - ConstructDefaultPackageObtainer(toolsPath, reporter, testMockBehaviorIsInSync, nugetConfigPath.Value); - - ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = - packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - nugetconfig: nugetConfigPath, - targetframework: _testTargetframework); - - reporter.Lines.Should().BeEmpty(); - - var executable = toolConfigurationAndExecutablePath.Executable; - - File.Exists(executable.Value) - .Should() - .BeTrue(executable + " should have the executable"); - - File.Delete(executable.Value); - } - - [Theory] - [InlineData(false)] - [InlineData(true)] - public void GivenAllButNoTargetFrameworkItCanDownloadThePackage(bool testMockBehaviorIsInSync) - { - var reporter = new BufferedReporter(); - var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); - var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); - - IToolPackageObtainer packageObtainer; - if (testMockBehaviorIsInSync) - { - packageObtainer = new ToolPackageObtainerMock(additionalFeeds: - new List - { - new MockFeed - { - Type = MockFeedType.ExplicitNugetConfig, - Uri = nugetConfigPath.Value, - Packages = new List - { - new MockFeedPackage - { - PackageId = TestPackageId, - Version = "1.0.4" - } - } - } - }, - toolsPath: toolsPath); - } - else - { - packageObtainer = new ToolPackageObtainer( - new DirectoryPath(toolsPath), - new DirectoryPath("no such path"), - GetUniqueTempProjectPathEachTest, - new Lazy(() => BundledTargetFramework.GetTargetFrameworkMoniker()), - new ProjectRestorer(reporter)); - } - ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = - packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - nugetconfig: nugetConfigPath); - - reporter.Lines.Should().BeEmpty(); - - var executable = toolConfigurationAndExecutablePath.Executable; - - File.Exists(executable.Value) - .Should() - .BeTrue(executable + " should have the executable"); - - File.Delete(executable.Value); - } - - [Theory] - [InlineData(false)] - [InlineData(true)] - public void GivenNonExistentNugetConfigFileItThrows(bool testMockBehaviorIsInSync) - { - var reporter = new BufferedReporter(); - var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); - - var packageObtainer = - ConstructDefaultPackageObtainer(toolsPath, reporter, testMockBehaviorIsInSync); - - var nonExistNugetConfigFile = new FilePath("NonExistent.file"); - Action a = () => - { - ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = - packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - nugetconfig: nonExistNugetConfigFile, - targetframework: _testTargetframework); - }; - - a.ShouldThrow() - .And - .Message.Should().Contain(string.Format( - CommonLocalizableStrings.NuGetConfigurationFileDoesNotExist, - Path.GetFullPath(nonExistNugetConfigFile.Value))); - - reporter.Lines.Should().BeEmpty(); - } - - [Theory] - [InlineData(false)] - [InlineData(true)] - public void GivenASourceItCanObtainThePackageFromThatSource(bool testMockBehaviorIsInSync) - { - var reporter = new BufferedReporter(); - var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); - - var packageObtainer = ConstructDefaultPackageObtainer( - toolsPath, - reporter, - testMockBehaviorIsInSync: testMockBehaviorIsInSync, - addSourceFeedWithFilePath: GetTestLocalFeedPath()); - ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = - packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - targetframework: _testTargetframework, - source: GetTestLocalFeedPath()); - - reporter.Lines.Should().BeEmpty(); - - var executable = toolConfigurationAndExecutablePath.Executable; - - File.Exists(executable.Value) - .Should() - .BeTrue(executable + " should have the executable"); - - File.Delete(executable.Value); - } - - [Theory] - [InlineData(false)] - [InlineData(true)] - public void GivenFailedRestoreItCanRollBack(bool testMockBehaviorIsInSync) - { - var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); - - var reporter = new BufferedReporter(); - var packageObtainer = ConstructDefaultPackageObtainer(toolsPath, reporter, testMockBehaviorIsInSync); - - try - { - using (var t = new TransactionScope()) - { - packageObtainer.ObtainAndReturnExecutablePath( - packageId: "non exist package id", - packageVersion: TestPackageVersion, - targetframework: _testTargetframework); - - t.Complete(); - } - } - catch (PackageObtainException) - { - // catch the intent error - } - - AssertRollBack(toolsPath); - } - - [Theory] - [InlineData(false)] - [InlineData(true)] - public void GiveSucessRestoreButFailedOnNextStepItCanRollBack(bool testMockBehaviorIsInSync) - { - FilePath nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); - var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); - var reporter = new BufferedReporter(); - var packageObtainer = ConstructDefaultPackageObtainer(toolsPath, reporter, testMockBehaviorIsInSync); - - void FailedStepAfterSuccessRestore() => throw new GracefulException("simulated error"); - - try - { - using (var t = new TransactionScope()) - { - ToolConfigurationAndExecutablePath obtainAndReturnExecutablePathtransactional - = packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - targetframework: _testTargetframework); - - FailedStepAfterSuccessRestore(); - t.Complete(); - } - } - catch (GracefulException) - { - // catch the simulated error - } - - AssertRollBack(toolsPath); - } - - [Theory] - [InlineData(false)] - [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, reporter, testMockBehaviorIsInSync, nugetConfigPath.Value); - - try - { - using (var t = new TransactionScope()) - { - packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - targetframework: _testTargetframework); - - packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - targetframework: _testTargetframework); - - t.Complete(); - } - } - catch (PackageObtainException) - { - // catch the simulated error - } - - AssertRollBack(toolsPath); - } - - [Theory] - [InlineData(false)] - [InlineData(true)] - public void GivenAllButNoPackageVersionAndInvokeTwiceInTransactionItShouldRollback(bool testMockBehaviorIsInSync) - { - var reporter = new BufferedReporter(); - var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); - var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); - - var packageObtainer = - 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.ShouldThrow(); - - Directory.Exists(Path.Combine(toolsPath, TestPackageId)) - .Should().BeTrue("The result of first one is still here"); - - Directory.GetDirectories(Path.Combine(toolsPath, ".stage")) - .Should().BeEmpty("nothing in stage folder, already rolled back"); - } - - private static void AssertRollBack(string toolsPath) - { - if (!Directory.Exists(toolsPath)) - { - return; // nothing at all - } - - Directory.GetFiles(toolsPath).Should().BeEmpty(); - Directory.GetDirectories(toolsPath) - .Should().NotContain(d => !new DirectoryInfo(d).Name.Equals(".stage"), - "no broken folder, exclude stage folder"); - - Directory.GetDirectories(Path.Combine(toolsPath, ".stage")) - .Should().BeEmpty("nothing in stage folder"); - } - - private static readonly Func GetUniqueTempProjectPathEachTest = () => - { - var tempProjectDirectory = - new DirectoryPath(Path.GetTempPath()).WithSubDirectories(Path.GetRandomFileName()); - var tempProjectPath = - tempProjectDirectory.WithFile(Path.GetRandomFileName() + ".csproj"); - return tempProjectPath; - }; - - private static IToolPackageObtainer ConstructDefaultPackageObtainer( - string toolsPath, - IReporter reporter, - bool testMockBehaviorIsInSync = false, - string addNugetConfigFeedWithFilePath = null, - string addSourceFeedWithFilePath = null) - { - if (testMockBehaviorIsInSync) - { - if (addNugetConfigFeedWithFilePath != null) - { - return new ToolPackageObtainerMock(additionalFeeds: - new List - { - new MockFeed - { - Type = MockFeedType.ExplicitNugetConfig, - Uri = addNugetConfigFeedWithFilePath, - Packages = new List - { - new MockFeedPackage - { - PackageId = TestPackageId, - Version = "1.0.4" - } - } - } - }, toolsPath: toolsPath); - } - - if (addSourceFeedWithFilePath != null) - { - return new ToolPackageObtainerMock(additionalFeeds: - new List - { - new MockFeed - { - Type = MockFeedType.Source, - Uri = addSourceFeedWithFilePath, - Packages = new List - { - new MockFeedPackage - { - PackageId = TestPackageId, - Version = "1.0.4" - } - } - } - }, - toolsPath: toolsPath); - } - - return new ToolPackageObtainerMock(toolsPath: toolsPath); - } - - return new ToolPackageObtainer( - new DirectoryPath(toolsPath), - new DirectoryPath("no such path"), - GetUniqueTempProjectPathEachTest, - new Lazy(), - new ProjectRestorer(reporter)); - } - - private static FilePath WriteNugetConfigFileToPointToTheFeed() - { - var nugetConfigName = "nuget.config"; - - var tempPathForNugetConfigWithWhiteSpace = - Path.Combine(Path.GetTempPath(), - Path.GetRandomFileName() + " " + Path.GetRandomFileName()); - Directory.CreateDirectory(tempPathForNugetConfigWithWhiteSpace); - - NuGetConfig.Write( - directory: tempPathForNugetConfigWithWhiteSpace, - configname: nugetConfigName, - localFeedPath: GetTestLocalFeedPath()); - - return new FilePath(Path.GetFullPath(Path.Combine(tempPathForNugetConfigWithWhiteSpace, nugetConfigName))); - } - - private static string GetTestLocalFeedPath() => Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestAssetLocalNugetFeed"); - private readonly string _testTargetframework = BundledTargetFramework.GetTargetFrameworkMoniker(); - private const string TestPackageVersion = "1.0.4"; - private const string TestPackageId = "global.tool.console.demo"; - } -} diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/MockFeedType.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/MockFeedType.cs index c79dc327e..a6fd5c5c2 100644 --- a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/MockFeedType.cs +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/MockFeedType.cs @@ -7,6 +7,7 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks { FeedFromLookUpNugetConfig, ExplicitNugetConfig, - Source + Source, + OfflineFeed } } diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ProjectRestorerMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ProjectRestorerMock.cs new file mode 100644 index 000000000..2bdb35820 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ProjectRestorerMock.cs @@ -0,0 +1,160 @@ +// 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 System.Collections.Generic; +using System.IO; +using System.Linq; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.ToolPackage; +using Microsoft.DotNet.Tools; +using Microsoft.DotNet.Tools.Install.Tool; +using Microsoft.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.Tools.Tests.ComponentMocks +{ + internal class ProjectRestorerMock : IProjectRestorer + { + public const string FakeEntrypointName = "SimulatorEntryPoint.dll"; + public const string FakeCommandName = "SimulatorCommand"; + public const string DefaultPackageName = "global.tool.console.demo"; + public const string DefaultPackageVersion = "1.0.4"; + + private readonly IFileSystem _fileSystem; + private readonly IReporter _reporter; + private readonly List _feeds; + + public ProjectRestorerMock( + IFileSystem fileSystem, + IReporter reporter = null, + IEnumerable feeds = null) + { + _fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)); + _reporter = reporter; + + _feeds = new List(); + if (feeds == null) + { + _feeds.Add(new MockFeed + { + Type = MockFeedType.FeedFromLookUpNugetConfig, + Packages = new List + { + new MockFeedPackage + { + PackageId = DefaultPackageName, + Version = DefaultPackageVersion + } + } + }); + } + else + { + _feeds.AddRange(feeds); + } + } + + public void Restore( + FilePath project, + DirectoryPath assetJsonOutput, + FilePath? nugetConfig = null, + string source = null, + string verbosity = null) + { + string packageId; + string packageVersion; + string targetFramework; + + try + { + // The mock installer wrote a mock project file containing id:version:framework + var contents = _fileSystem.File.ReadAllText(project.Value); + var tokens = contents.Split(':'); + if (tokens.Length != 3) + { + throw new ToolPackageException(LocalizableStrings.ToolInstallationRestoreFailed); + } + + packageId = tokens[0]; + packageVersion = tokens[1]; + targetFramework = tokens[2]; + } + catch (IOException) + { + throw new ToolPackageException(LocalizableStrings.ToolInstallationRestoreFailed); + } + + if (string.IsNullOrEmpty(packageId)) + { + throw new ToolPackageException(LocalizableStrings.ToolInstallationRestoreFailed); + } + + var feedPackage = GetPackage( + packageId, + packageVersion, + nugetConfig, + source); + + packageVersion = feedPackage.Version; + targetFramework = string.IsNullOrEmpty(targetFramework) ? "targetFramework" : targetFramework; + + var fakeExecutableSubDirectory = Path.Combine( + packageId, + packageVersion, + "tools", + targetFramework, + "any"); + var fakeExecutablePath = Path.Combine(fakeExecutableSubDirectory, FakeEntrypointName); + + _fileSystem.Directory.CreateDirectory(Path.Combine(assetJsonOutput.Value, fakeExecutableSubDirectory)); + _fileSystem.File.CreateEmptyFile(Path.Combine(assetJsonOutput.Value, fakeExecutablePath)); + _fileSystem.File.WriteAllText( + assetJsonOutput.WithFile("project.assets.json").Value, + fakeExecutablePath); + } + + private MockFeedPackage GetPackage( + string packageId, + string packageVersion = null, + FilePath? nugetConfig = null, + string source = null) + { + var package = _feeds + .Where(f => { + if (nugetConfig != null) + { + return f.Type == MockFeedType.ExplicitNugetConfig && f.Uri == nugetConfig.Value.Value; + } + if (source != null) + { + return f.Type == MockFeedType.Source && f.Uri == source; + } + return true; + }) + .SelectMany(f => f.Packages) + .Where(p => MatchPackageVersion(p, packageId, packageVersion)).OrderByDescending(p => p.Version) + .FirstOrDefault(); + + if (package == null) + { + if (_reporter != null) + { + _reporter.WriteLine($"Error: failed to restore package {packageId}."); + } + throw new ToolPackageException(LocalizableStrings.ToolInstallationRestoreFailed); + } + + return package; + } + + private static bool MatchPackageVersion(MockFeedPackage p, string packageId, string packageVersion) + { + if (string.IsNullOrEmpty(packageVersion)) + { + return p.PackageId == packageId; + } + return p.PackageId == packageId && p.Version == packageVersion; + } + } +} diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimMakerMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimMakerMock.cs deleted file mode 100644 index 1f9ca0060..000000000 --- a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimMakerMock.cs +++ /dev/null @@ -1,105 +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 System.Collections.Generic; -using System.IO; -using System.Runtime.InteropServices; -using System.Transactions; -using Microsoft.DotNet.Cli; -using Microsoft.DotNet.Cli.Utils; -using Microsoft.DotNet.ShellShim; -using Microsoft.Extensions.EnvironmentAbstractions; -using Newtonsoft.Json; - -namespace Microsoft.DotNet.Tools.Tests.ComponentMocks -{ - internal class ShellShimMakerMock : IShellShimMaker - { - private static IFileSystem _fileSystem; - private readonly string _pathToPlaceShim; - - public ShellShimMakerMock(string pathToPlaceShim, IFileSystem fileSystem = null) - { - _pathToPlaceShim = - pathToPlaceShim ?? - throw new ArgumentNullException(nameof(pathToPlaceShim)); - - _fileSystem = fileSystem ?? new FileSystemWrapper(); - } - - public void EnsureCommandNameUniqueness(string shellCommandName) - { - if (_fileSystem.File.Exists(GetShimPath(shellCommandName).Value)) - { - throw new GracefulException( - string.Format(CommonLocalizableStrings.FailInstallToolSameName, - shellCommandName)); - } - } - - public void CreateShim(FilePath packageExecutable, string shellCommandName) - { - var createShimTransaction = new CreateShimTransaction( - createShim: locationOfShimDuringTransaction => - { - EnsureCommandNameUniqueness(shellCommandName); - PlaceShim(packageExecutable, shellCommandName, locationOfShimDuringTransaction); - }, - rollback: locationOfShimDuringTransaction => - { - foreach (FilePath f in locationOfShimDuringTransaction) - { - if (File.Exists(f.Value)) - { - File.Delete(f.Value); - } - } - }); - - using (var transactionScope = new TransactionScope()) - { - Transaction.Current.EnlistVolatile(createShimTransaction, EnlistmentOptions.None); - createShimTransaction.CreateShim(); - - transactionScope.Complete(); - } - } - - public void Remove(string shellCommandName) - { - File.Delete(GetShimPath(shellCommandName).Value); - } - - private void PlaceShim(FilePath packageExecutable, string shellCommandName, List locationOfShimDuringTransaction) - { - var fakeshim = new FakeShim - { - Runner = "dotnet", - ExecutablePath = packageExecutable.Value - }; - var script = JsonConvert.SerializeObject(fakeshim); - - FilePath scriptPath = GetShimPath(shellCommandName); - _fileSystem.File.WriteAllText(scriptPath.Value, script); - locationOfShimDuringTransaction.Add(scriptPath); - } - - private FilePath GetShimPath(string shellCommandName) - { - var scriptPath = Path.Combine(_pathToPlaceShim, shellCommandName); - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - scriptPath += ".exe"; - } - - return new FilePath(scriptPath); - } - - public class FakeShim - { - public string Runner { get; set; } - public string ExecutablePath { get; set; } - } - } -} diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimRepositoryMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimRepositoryMock.cs new file mode 100644 index 000000000..d67167d0e --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ShellShimRepositoryMock.cs @@ -0,0 +1,104 @@ +// 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 System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.ShellShim; +using Microsoft.Extensions.EnvironmentAbstractions; +using Newtonsoft.Json; + +namespace Microsoft.DotNet.Tools.Tests.ComponentMocks +{ + internal class ShellShimRepositoryMock : IShellShimRepository + { + private static IFileSystem _fileSystem; + private readonly DirectoryPath _pathToPlaceShim; + + public ShellShimRepositoryMock(DirectoryPath pathToPlaceShim, IFileSystem fileSystem = null) + { + _pathToPlaceShim = pathToPlaceShim; + _fileSystem = fileSystem ?? new FileSystemWrapper(); + } + + public void CreateShim(FilePath targetExecutablePath, string commandName) + { + if (ShimExists(commandName)) + { + throw new ShellShimException( + string.Format(CommonLocalizableStrings.ShellShimConflict, + commandName)); + } + + TransactionalAction.Run( + action: () => { + var shim = new FakeShim + { + Runner = "dotnet", + ExecutablePath = targetExecutablePath.Value + }; + + _fileSystem.File.WriteAllText( + GetShimPath(commandName).Value, + JsonConvert.SerializeObject(shim)); + }, + rollback: () => { + _fileSystem.File.Delete(GetShimPath(commandName).Value); + }); + } + + public void RemoveShim(string commandName) + { + var originalShimPath = GetShimPath(commandName); + if (!_fileSystem.File.Exists(originalShimPath.Value)) + { + return; + } + + string tempShimPath = null; + TransactionalAction.Run( + action: () => { + var tempFile = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); + _fileSystem.File.Move(originalShimPath.Value, tempFile); + tempShimPath = tempFile; + }, + commit: () => { + if (tempShimPath != null) + { + _fileSystem.File.Delete(tempShimPath); + } + }, + rollback: () => { + if (tempShimPath != null) + { + _fileSystem.File.Move(tempShimPath, originalShimPath.Value); + } + }); + } + + private bool ShimExists(string commandName) + { + return _fileSystem.File.Exists(GetShimPath(commandName).Value); + } + + private FilePath GetShimPath(string shellCommandName) + { + var shimPath = Path.Combine(_pathToPlaceShim.Value, shellCommandName); + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + shimPath += ".exe"; + } + + return new FilePath(shimPath); + } + + public class FakeShim + { + public string Runner { get; set; } + public string ExecutablePath { get; set; } + } + } +} diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageInstallerMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageInstallerMock.cs new file mode 100644 index 000000000..cce1000f5 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageInstallerMock.cs @@ -0,0 +1,111 @@ +// 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 System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Transactions; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.ToolPackage; +using Microsoft.DotNet.Tools; +using Microsoft.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.Tools.Tests.ComponentMocks +{ + internal class ToolPackageInstallerMock : IToolPackageInstaller + { + private const string ProjectFileName = "TempProject.csproj"; + + private readonly IToolPackageStore _store; + private readonly IProjectRestorer _projectRestorer; + private readonly IFileSystem _fileSystem; + private readonly Action _installCallback; + + public ToolPackageInstallerMock( + IFileSystem fileSystem, + IToolPackageStore store, + IProjectRestorer projectRestorer, + Action installCallback = null) + { + _fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)); + _store = store ?? throw new ArgumentNullException(nameof(store)); + _projectRestorer = projectRestorer ?? throw new ArgumentNullException(nameof(projectRestorer)); + _installCallback = installCallback; + } + + public IToolPackage InstallPackage( + string packageId, + string packageVersion = null, + string targetFramework = null, + FilePath? nugetConfig = null, + string source = null, + string verbosity = null) + { + var packageRootDirectory = _store.Root.WithSubDirectories(packageId); + string rollbackDirectory = null; + + return TransactionalAction.Run( + action: () => { + var stageDirectory = _store.Root.WithSubDirectories(".stage", Path.GetRandomFileName()); + _fileSystem.Directory.CreateDirectory(stageDirectory.Value); + rollbackDirectory = stageDirectory.Value; + + var tempProject = new FilePath(Path.Combine(stageDirectory.Value, ProjectFileName)); + + // Write a fake project with the requested package id, version, and framework + _fileSystem.File.WriteAllText( + tempProject.Value, + $"{packageId}:{packageVersion}:{targetFramework}"); + + // Perform a restore on the fake project + _projectRestorer.Restore( + tempProject, + stageDirectory, + nugetConfig, + source, + verbosity); + + if (_installCallback != null) + { + _installCallback(); + } + + packageVersion = Path.GetFileName( + _fileSystem.Directory.EnumerateFileSystemEntries( + stageDirectory.WithSubDirectories(packageId).Value).Single()); + + var packageDirectory = packageRootDirectory.WithSubDirectories(packageVersion); + if (_fileSystem.Directory.Exists(packageDirectory.Value)) + { + throw new ToolPackageException( + string.Format( + CommonLocalizableStrings.ToolPackageConflictPackageId, + packageId, + packageVersion)); + } + + _fileSystem.Directory.CreateDirectory(packageRootDirectory.Value); + _fileSystem.Directory.Move(stageDirectory.Value, packageDirectory.Value); + rollbackDirectory = packageDirectory.Value; + + return new ToolPackageMock( + _fileSystem, + packageId, + packageVersion, + packageDirectory); + }, + rollback: () => { + if (rollbackDirectory != null && _fileSystem.Directory.Exists(rollbackDirectory)) + { + _fileSystem.Directory.Delete(rollbackDirectory, true); + } + if (_fileSystem.Directory.Exists(packageRootDirectory.Value) && + !_fileSystem.Directory.EnumerateFileSystemEntries(packageRootDirectory.Value).Any()) + { + _fileSystem.Directory.Delete(packageRootDirectory.Value, false); + } + }); + } + } +} diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageMock.cs new file mode 100644 index 000000000..5e968a288 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageMock.cs @@ -0,0 +1,127 @@ +// 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 System.Collections.Generic; +using System.IO; +using System.Linq; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.ToolPackage; +using Microsoft.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.Tools.Tests.ComponentMocks +{ + internal class ToolPackageMock : IToolPackage + { + private IFileSystem _fileSystem; + private Lazy> _commands; + private Action _uninstallCallback; + + public ToolPackageMock( + IFileSystem fileSystem, + string packageId, + string packageVersion, + DirectoryPath packageDirectory, + Action uninstallCallback = null) + { + _fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)); + PackageId = packageId ?? throw new ArgumentNullException(nameof(packageId)); + PackageVersion = packageVersion ?? throw new ArgumentNullException(nameof(packageVersion)); + PackageDirectory = packageDirectory; + _commands = new Lazy>(GetCommands); + _uninstallCallback = uninstallCallback; + } + + public string PackageId { get; private set; } + + public string PackageVersion { get; private set; } + + public DirectoryPath PackageDirectory { get; private set; } + + public IReadOnlyList Commands + { + get + { + return _commands.Value; + } + } + + public void Uninstall() + { + var rootDirectory = PackageDirectory.GetParentPath(); + string tempPackageDirectory = null; + + TransactionalAction.Run( + action: () => { + try + { + if (_fileSystem.Directory.Exists(PackageDirectory.Value)) + { + var tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); + _fileSystem.Directory.Move(PackageDirectory.Value, tempPath); + tempPackageDirectory = tempPath; + } + + if (_fileSystem.Directory.Exists(rootDirectory.Value) && + !_fileSystem.Directory.EnumerateFileSystemEntries(rootDirectory.Value).Any()) + { + _fileSystem.Directory.Delete(rootDirectory.Value, false); + } + + if (_uninstallCallback != null) + { + _uninstallCallback(); + } + } + catch (Exception ex) when (ex is UnauthorizedAccessException || ex is IOException) + { + throw new ToolPackageException( + string.Format( + CommonLocalizableStrings.FailedToUninstallToolPackage, + PackageId, + ex.Message), + ex); + } + }, + commit: () => { + if (tempPackageDirectory != null) + { + _fileSystem.Directory.Delete(tempPackageDirectory, true); + } + }, + rollback: () => { + if (tempPackageDirectory != null) + { + _fileSystem.Directory.CreateDirectory(rootDirectory.Value); + _fileSystem.Directory.Move(tempPackageDirectory, PackageDirectory.Value); + } + }); + } + + private IReadOnlyList GetCommands() + { + try + { + // The mock restorer wrote the path to the executable into project.assets.json (not a real assets file) + // Currently only "dotnet" commands are supported + var executablePath = _fileSystem.File.ReadAllText(Path.Combine(PackageDirectory.Value, "project.assets.json")); + return new CommandSettings[] + { + new CommandSettings( + ProjectRestorerMock.FakeCommandName, + "dotnet", + PackageDirectory.WithFile(executablePath)) + }; + } + catch (IOException ex) + { + throw new ToolPackageException( + string.Format( + CommonLocalizableStrings.FailedToRetrieveToolConfiguration, + PackageId, + ex.Message), + ex); + } + } + } +} diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageObtainerMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageObtainerMock.cs deleted file mode 100644 index 3463c3859..000000000 --- a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageObtainerMock.cs +++ /dev/null @@ -1,224 +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 System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Transactions; -using Microsoft.DotNet.Cli; -using Microsoft.DotNet.ToolPackage; -using Microsoft.Extensions.EnvironmentAbstractions; - -namespace Microsoft.DotNet.Tools.Tests.ComponentMocks -{ - internal class ToolPackageObtainerMock : IToolPackageObtainer - { - private readonly string _toolsPath; - public const string FakeEntrypointName = "SimulatorEntryPoint.dll"; - public const string FakeCommandName = "SimulatorCommand"; - private readonly Action _beforeRunObtain; - private readonly Action _duringObtain; - private static IFileSystem _fileSystem; - private string _fakeExecutableDirectory; - private List _mockFeeds; - private string _packageIdVersionDirectory; - - public ToolPackageObtainerMock( - IFileSystem fileSystemWrapper = null, - bool useDefaultFeed = true, - IEnumerable additionalFeeds = null, - Action beforeRunObtain = null, - Action duringObtain = null, - string toolsPath = null) - { - _toolsPath = toolsPath ?? "toolsPath"; - _beforeRunObtain = beforeRunObtain ?? (() => {}); - _duringObtain = duringObtain ?? (() => {}); - _fileSystem = fileSystemWrapper ?? new FileSystemWrapper(); - _mockFeeds = new List(); - - if (useDefaultFeed) - { - _mockFeeds.Add(new MockFeed - { - Type = MockFeedType.FeedFromLookUpNugetConfig, - Packages = new List - { - new MockFeedPackage - { - PackageId = "global.tool.console.demo", - Version = "1.0.4" - } - } - }); - } - - if (additionalFeeds != null) - { - _mockFeeds.AddRange(additionalFeeds); - } - } - - public ToolConfigurationAndExecutablePath ObtainAndReturnExecutablePath( - string packageId, - string packageVersion = null, - FilePath? nugetconfig = null, - string targetframework = null, - string source = null, - string verbosity = null) - { - var stagedFile = Path.Combine(_toolsPath, ".stage", Path.GetRandomFileName()); - bool afterStage = false; - - var toolPackageObtainTransaction = new ToolPackageObtainTransaction( - obtainAndReturnExecutablePath: (_) => - { - if (Directory.Exists(Path.Combine(_toolsPath, packageId))) - { - throw new PackageObtainException( - string.Format(CommonLocalizableStrings.ToolPackageConflictPackageId, packageId)); - } - - _beforeRunObtain(); - - PickFeedByNugetConfig(nugetconfig); - PickFeedBySource(source); - - MockFeedPackage package = _mockFeeds - .SelectMany(f => f.Packages) - .Where(p => MatchPackageVersion(p, packageId, packageVersion)).OrderByDescending(p => p.Version) - .FirstOrDefault(); - - if (package == null) - { - throw new PackageObtainException("simulated cannot find package"); - } - - packageVersion = package.Version; - targetframework = targetframework ?? "targetframework"; - - _packageIdVersionDirectory = Path.Combine(_toolsPath, packageId, packageVersion); - - _fakeExecutableDirectory = Path.Combine(_packageIdVersionDirectory, - packageId, packageVersion, "morefolders", "tools", - targetframework); - - SimulateStageFile(); - _duringObtain(); - - _fileSystem.File.Delete(stagedFile); - afterStage = true; - - _fileSystem.Directory.CreateDirectory(_packageIdVersionDirectory); - _fileSystem.File.CreateEmptyFile(Path.Combine(_packageIdVersionDirectory, "project.assets.json")); - _fileSystem.Directory.CreateDirectory(_fakeExecutableDirectory); - var fakeExecutable = Path.Combine(_fakeExecutableDirectory, FakeEntrypointName); - _fileSystem.File.CreateEmptyFile(fakeExecutable); - - return new ToolConfigurationAndExecutablePath( - toolConfiguration: new ToolConfiguration(FakeCommandName, FakeEntrypointName), - executable : new FilePath(fakeExecutable));; - }, - - rollback: (_) => - { - if (afterStage == false) - { - if (_fileSystem.File.Exists(stagedFile)) - { - _fileSystem.File.Delete(stagedFile); - } - } - else - { - if (_fileSystem.Directory.Exists(Path.Combine(_toolsPath, packageId))) - { - _fileSystem.Directory.Delete(Path.Combine(_toolsPath, packageId), true); - } - } - } - ); - - using(var transactionScope = new TransactionScope()) - { - Transaction.Current.EnlistVolatile(toolPackageObtainTransaction, EnlistmentOptions.None); - var toolConfigurationAndExecutablePath = toolPackageObtainTransaction.ObtainAndReturnExecutablePath(); - - transactionScope.Complete(); - return toolConfigurationAndExecutablePath; - } - } - - private void SimulateStageFile() - { - var stageDirectory = Path.Combine(_toolsPath, ".stage"); - if (!_fileSystem.Directory.Exists(stageDirectory)) - { - _fileSystem.Directory.CreateDirectory(stageDirectory); - } - - _fileSystem.File.CreateEmptyFile(Path.Combine(stageDirectory, "stagedfile")); - } - - private void PickFeedBySource(string source) - { - if (source != null) - { - var feed = _mockFeeds.SingleOrDefault( - f => f.Type == MockFeedType.Source - && f.Uri == source); - - if (feed != null) - { - _mockFeeds = new List - { - feed - }; - } - else - { - _mockFeeds = new List(); - } - } - } - - private void PickFeedByNugetConfig(FilePath? nugetconfig) - { - if (nugetconfig != null) - { - if (!_fileSystem.File.Exists(nugetconfig.Value.Value)) - { - throw new PackageObtainException( - string.Format(CommonLocalizableStrings.NuGetConfigurationFileDoesNotExist, - Path.GetFullPath(nugetconfig.Value.Value))); - } - - var feed = _mockFeeds.SingleOrDefault( - f => f.Type == MockFeedType.ExplicitNugetConfig - && f.Uri == nugetconfig.Value.Value); - - if (feed != null) - { - _mockFeeds = new List - { - feed - }; - } - else - { - _mockFeeds = new List(); - } - } - } - - private static bool MatchPackageVersion(MockFeedPackage p, string packageId, string packageVersion) - { - if (packageVersion == null) - { - return p.PackageId == packageId; - } - return p.PackageId == packageId && p.Version == packageVersion; - } - } -} diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageStoreMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageStoreMock.cs new file mode 100644 index 000000000..4681d3123 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageStoreMock.cs @@ -0,0 +1,51 @@ +// 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 System.Collections.Generic; +using System.IO; +using System.Linq; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.ToolPackage; +using Microsoft.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.Tools.Tests.ComponentMocks +{ + internal class ToolPackageStoreMock : IToolPackageStore + { + private IFileSystem _fileSystem; + private Action _uninstallCallback; + + public ToolPackageStoreMock( + DirectoryPath root, + IFileSystem fileSystem, + Action uninstallCallback = null) + { + Root = root; + _fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)); + _uninstallCallback = uninstallCallback; + } + + public DirectoryPath Root { get; private set; } + + public IEnumerable GetInstalledPackages(string packageId) + { + var packageRootDirectory = Root.WithSubDirectories(packageId); + if (!_fileSystem.Directory.Exists(packageRootDirectory.Value)) + { + yield break; + } + + foreach (var subdirectory in _fileSystem.Directory.EnumerateFileSystemEntries(packageRootDirectory.Value)) + { + var version = Path.GetFileName(subdirectory); + yield return new ToolPackageMock( + _fileSystem, + packageId, + version, + packageRootDirectory.WithSubDirectories(version), + _uninstallCallback); + } + } + } +} diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Mock/FileSystemMockBuilder.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Mock/FileSystemMockBuilder.cs index 9cb1ddd59..83043dec9 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Mock/FileSystemMockBuilder.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Mock/FileSystemMockBuilder.cs @@ -107,6 +107,22 @@ namespace Microsoft.Extensions.DependencyModel.Tests _files[path] = content; } + public void Move(string source, string destination) + { + if (!Exists(source)) + { + throw new FileNotFoundException("source does not exist."); + } + if (Exists(destination)) + { + throw new IOException("destination exists."); + } + + var content = _files[source]; + _files.Remove(source); + _files[destination] = content; + } + public void Delete(string path) { if (!Exists(path)) @@ -134,9 +150,21 @@ namespace Microsoft.Extensions.DependencyModel.Tests return _temporaryDirectory; } - public IEnumerable GetFiles(string path, string searchPattern) + public IEnumerable EnumerateFileSystemEntries(string path) { - throw new NotImplementedException(); + foreach (var entry in _files.Keys.Where(k => Path.GetDirectoryName(k) == path)) + { + yield return entry; + } + } + + public IEnumerable EnumerateFileSystemEntries(string path, string searchPattern) + { + if (searchPattern != "*") + { + throw new NotImplementedException(); + } + return EnumerateFileSystemEntries(path); } public string GetDirectoryFullName(string path) @@ -151,7 +179,12 @@ namespace Microsoft.Extensions.DependencyModel.Tests public void CreateDirectory(string path) { - _files.Add(path, path); + var current = path; + while (!string.IsNullOrEmpty(current)) + { + _files[current] = current; + current = Path.GetDirectoryName(current); + } } public void Delete(string path, bool recursive) @@ -169,6 +202,29 @@ namespace Microsoft.Extensions.DependencyModel.Tests _files.Remove(k); } } + + public void Move(string source, string destination) + { + if (!Exists(source)) + { + throw new IOException("The source directory does not exist."); + } + if (Exists(destination)) + { + throw new IOException("The destination already exists."); + } + + foreach (var kvp in _files.Where(kvp => kvp.Key.StartsWith(source)).ToList()) + { + var newKey = destination + kvp.Key.Substring(source.Length); + var newValue = kvp.Value.StartsWith(source) ? + destination + kvp.Value.Substring(source.Length) : + kvp.Value; + + _files.Add(newKey, newValue); + _files.Remove(kvp.Key); + } + } } private class TemporaryDirectoryMock : ITemporaryDirectoryMock diff --git a/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs b/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs index 6cfb9a11b..5c34912ba 100644 --- a/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs +++ b/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs @@ -40,6 +40,7 @@ SDK commands: vstest Runs Microsoft Test Execution Command Line Tool. store Stores the specified assemblies in the runtime store. install Installs an item into the development environment. + uninstall Uninstalls a tool from the development environment. help Show help. Common options: diff --git a/test/dotnet.Tests/InstallToolCommandTests/InstallToolCommandTests.cs b/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs similarity index 56% rename from test/dotnet.Tests/InstallToolCommandTests/InstallToolCommandTests.cs rename to test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs index c3a838ae1..1a1f140b0 100644 --- a/test/dotnet.Tests/InstallToolCommandTests/InstallToolCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs @@ -10,6 +10,7 @@ using Microsoft.DotNet.Cli; using Microsoft.DotNet.Cli.CommandLine; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.ToolPackage; +using Microsoft.DotNet.Tools; using Microsoft.DotNet.Tools.Install.Tool; using Microsoft.DotNet.Tools.Tests.ComponentMocks; using Microsoft.DotNet.Tools.Test.Utilities; @@ -21,13 +22,13 @@ using Parser = Microsoft.DotNet.Cli.Parser; using LocalizableStrings = Microsoft.DotNet.Tools.Install.Tool.LocalizableStrings; using System.Runtime.InteropServices; -namespace Microsoft.DotNet.Tests.InstallToolCommandTests +namespace Microsoft.DotNet.Tests.Commands { public class InstallToolCommandTests { - private readonly IFileSystem _fileSystemWrapper; - private readonly ToolPackageObtainerMock _toolPackageObtainerMock; - private readonly ShellShimMakerMock _shellShimMakerMock; + private readonly IFileSystem _fileSystem; + private readonly IToolPackageStore _toolPackageStore; + private readonly ShellShimRepositoryMock _shellShimRepositoryMock; private readonly EnvironmentPathInstructionMock _environmentPathInstructionMock; private readonly AppliedOption _appliedCommand; private readonly ParseResult _parseResult; @@ -35,13 +36,14 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests private const string PathToPlaceShim = "pathToPlace"; private const string PathToPlacePackages = PathToPlaceShim + "pkg"; private const string PackageId = "global.tool.console.demo"; + private const string PackageVersion = "1.0.4"; public InstallToolCommandTests() { - _fileSystemWrapper = new FileSystemMockBuilder().Build(); - _toolPackageObtainerMock = new ToolPackageObtainerMock(_fileSystemWrapper, toolsPath: PathToPlacePackages); - _shellShimMakerMock = new ShellShimMakerMock(PathToPlaceShim, _fileSystemWrapper); _reporter = new BufferedReporter(); + _fileSystem = new FileSystemMockBuilder().Build(); + _toolPackageStore = new ToolPackageStoreMock(new DirectoryPath(PathToPlacePackages), _fileSystem); + _shellShimRepositoryMock = new ShellShimRepositoryMock(new DirectoryPath(PathToPlaceShim), _fileSystem); _environmentPathInstructionMock = new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim); @@ -56,17 +58,20 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests { var installToolCommand = new InstallToolCommand(_appliedCommand, _parseResult, - _toolPackageObtainerMock, - _shellShimMakerMock, - _environmentPathInstructionMock); + _toolPackageStore, + CreateToolPackageInstaller(), + _shellShimRepositoryMock, + _environmentPathInstructionMock, + _reporter); installToolCommand.Execute().Should().Be(0); // It is hard to simulate shell behavior. Only Assert shim can point to executable dll - _fileSystemWrapper.File.Exists(ExpectedCommandPath()).Should().BeTrue(); - var deserializedFakeShim = JsonConvert.DeserializeObject( - _fileSystemWrapper.File.ReadAllText(ExpectedCommandPath())); - _fileSystemWrapper.File.Exists(deserializedFakeShim.ExecutablePath).Should().BeTrue(); + _fileSystem.File.Exists(ExpectedCommandPath()).Should().BeTrue(); + var deserializedFakeShim = JsonConvert.DeserializeObject( + _fileSystem.File.ReadAllText(ExpectedCommandPath())); + + _fileSystem.File.Exists(deserializedFakeShim.ExecutablePath).Should().BeTrue(); } [Fact] @@ -80,34 +85,36 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests var installToolCommand = new InstallToolCommand(appliedCommand, parseResult, - new ToolPackageObtainerMock(_fileSystemWrapper, additionalFeeds: new List - { - new MockFeed - { - Type = MockFeedType.Source, - Uri = sourcePath, - Packages = new List + _toolPackageStore, + CreateToolPackageInstaller( + feeds: new MockFeed[] { + new MockFeed { - new MockFeedPackage + Type = MockFeedType.Source, + Uri = sourcePath, + Packages = new List { - PackageId = PackageId, - Version = "1.0.4" + new MockFeedPackage + { + PackageId = PackageId, + Version = PackageVersion + } } } - } - }), - _shellShimMakerMock, - _environmentPathInstructionMock); + }), + _shellShimRepositoryMock, + _environmentPathInstructionMock, + _reporter); installToolCommand.Execute().Should().Be(0); // It is hard to simulate shell behavior. Only Assert shim can point to executable dll - _fileSystemWrapper.File.Exists(ExpectedCommandPath()) + _fileSystem.File.Exists(ExpectedCommandPath()) .Should().BeTrue(); - ShellShimMakerMock.FakeShim deserializedFakeShim = - JsonConvert.DeserializeObject( - _fileSystemWrapper.File.ReadAllText(ExpectedCommandPath())); - _fileSystemWrapper.File.Exists(deserializedFakeShim.ExecutablePath).Should().BeTrue(); + var deserializedFakeShim = + JsonConvert.DeserializeObject( + _fileSystem.File.ReadAllText(ExpectedCommandPath())); + _fileSystem.File.Exists(deserializedFakeShim.ExecutablePath).Should().BeTrue(); } [Fact] @@ -115,27 +122,27 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests { var installToolCommand = new InstallToolCommand(_appliedCommand, _parseResult, - _toolPackageObtainerMock, - _shellShimMakerMock, - _environmentPathInstructionMock); + _toolPackageStore, + CreateToolPackageInstaller(), + _shellShimRepositoryMock, + _environmentPathInstructionMock, + _reporter); installToolCommand.Execute().Should().Be(0); - _reporter.Lines.Single().Should().NotBeEmpty(); + _reporter.Lines.First().Should().Be("INSTRUCTION"); } [Fact] - public void GivenFailedPackageObtainWhenRunWithPackageIdItShouldFail() + public void GivenFailedPackageInstallWhenRunWithPackageIdItShouldFail() { - var toolPackageObtainerSimulatorThatThrows - = new ToolPackageObtainerMock( - _fileSystemWrapper, true, null, - () => throw new PackageObtainException("Simulated error")); var installToolCommand = new InstallToolCommand( _appliedCommand, _parseResult, - toolPackageObtainerSimulatorThatThrows, - _shellShimMakerMock, + _toolPackageStore, + CreateToolPackageInstaller( + installCallback: () => throw new ToolPackageException("Simulated error")), + _shellShimRepositoryMock, _environmentPathInstructionMock, _reporter); @@ -151,64 +158,48 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests _reporter .Lines[1] .Should() - .Contain(string.Format(LocalizableStrings.ToolInstallationFailed, "global.tool.console.demo")); - } + .Contain(string.Format(LocalizableStrings.ToolInstallationFailed, PackageId)); - [Fact] - public void GivenFailedPackageObtainWhenRunWithPackageIdItShouldHaveNoBrokenFolderOnDisk() - { - var toolPackageObtainerSimulatorThatThrows - = new ToolPackageObtainerMock( - _fileSystemWrapper, true, null, - duringObtain: () => throw new PackageObtainException("Simulated error"), - toolsPath: PathToPlacePackages); - var installToolCommand = new InstallToolCommand( - _appliedCommand, - _parseResult, - toolPackageObtainerSimulatorThatThrows, - _shellShimMakerMock, - _environmentPathInstructionMock, - _reporter); - - installToolCommand.Execute(); - - _fileSystemWrapper.Directory.Exists(Path.Combine(PathToPlacePackages, PackageId)).Should().BeFalse(); + _fileSystem.Directory.Exists(Path.Combine(PathToPlacePackages, PackageId)).Should().BeFalse(); } [Fact] public void GivenCreateShimItShouldHaveNoBrokenFolderOnDisk() { - _fileSystemWrapper.File.CreateEmptyFile(ExpectedCommandPath()); // Create conflict shim - var toolPackageObtainerSimulatorThatThrows - = new ToolPackageObtainerMock( - _fileSystemWrapper, true, null, - toolsPath: PathToPlacePackages); + _fileSystem.File.CreateEmptyFile(ExpectedCommandPath()); // Create conflict shim + var installToolCommand = new InstallToolCommand( _appliedCommand, _parseResult, - toolPackageObtainerSimulatorThatThrows, - _shellShimMakerMock, + _toolPackageStore, + CreateToolPackageInstaller(), + _shellShimRepositoryMock, _environmentPathInstructionMock, _reporter); - Action a = () => installToolCommand.Execute(); - a.ShouldThrow(); + installToolCommand.Execute().Should().Be(1); - _fileSystemWrapper.Directory.Exists(Path.Combine(PathToPlacePackages, PackageId)).Should().BeFalse(); + _reporter + .Lines[0] + .Should() + .Contain( + string.Format( + CommonLocalizableStrings.ShellShimConflict, + ProjectRestorerMock.FakeCommandName)); + + _fileSystem.Directory.Exists(Path.Combine(PathToPlacePackages, PackageId)).Should().BeFalse(); } [Fact] public void GivenInCorrectToolConfigurationWhenRunWithPackageIdItShouldFail() { - var toolPackageObtainerSimulatorThatThrows - = new ToolPackageObtainerMock( - _fileSystemWrapper, true, null, - () => throw new ToolConfigurationException("Simulated error")); var installToolCommand = new InstallToolCommand( _appliedCommand, _parseResult, - toolPackageObtainerSimulatorThatThrows, - _shellShimMakerMock, + _toolPackageStore, + CreateToolPackageInstaller( + installCallback: () => throw new ToolConfigurationException("Simulated error")), + _shellShimRepositoryMock, _environmentPathInstructionMock, _reporter); @@ -227,7 +218,7 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests _reporter .Lines[1] .Should() - .Contain(string.Format(LocalizableStrings.ToolInstallationFailedContactAuthor, "global.tool.console.demo")); + .Contain(string.Format(LocalizableStrings.ToolInstallationFailedContactAuthor, PackageId)); } [Fact] @@ -236,8 +227,9 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests var installToolCommand = new InstallToolCommand( _appliedCommand, _parseResult, - _toolPackageObtainerMock, - _shellShimMakerMock, + _toolPackageStore, + CreateToolPackageInstaller(), + _shellShimRepositoryMock, new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true), _reporter); @@ -245,8 +237,27 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests _reporter .Lines - .Single().Should() - .Contain(string.Format(LocalizableStrings.InstallationSucceeded, "SimulatorCommand")); + .Single() + .Should() + .Contain(string.Format( + LocalizableStrings.InstallationSucceeded, + ProjectRestorerMock.FakeCommandName, + PackageId, + PackageVersion)); + } + + private IToolPackageInstaller CreateToolPackageInstaller( + IEnumerable feeds = null, + Action installCallback = null) + { + return new ToolPackageInstallerMock( + fileSystem: _fileSystem, + store: _toolPackageStore, + projectRestorer: new ProjectRestorerMock( + fileSystem: _fileSystem, + reporter: _reporter, + feeds: feeds), + installCallback: installCallback); } private static string ExpectedCommandPath() @@ -254,7 +265,7 @@ namespace Microsoft.DotNet.Tests.InstallToolCommandTests var extension = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : string.Empty; return Path.Combine( "pathToPlace", - ToolPackageObtainerMock.FakeCommandName + extension); + ProjectRestorerMock.FakeCommandName + extension); } } } diff --git a/test/dotnet.Tests/CommandTests/UninstallToolCommandTests.cs b/test/dotnet.Tests/CommandTests/UninstallToolCommandTests.cs new file mode 100644 index 000000000..64e11654c --- /dev/null +++ b/test/dotnet.Tests/CommandTests/UninstallToolCommandTests.cs @@ -0,0 +1,203 @@ +// 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 System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using FluentAssertions; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.CommandLine; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.ToolPackage; +using Microsoft.DotNet.Tools; +using Microsoft.DotNet.Tools.Install.Tool; +using Microsoft.DotNet.Tools.Uninstall.Tool; +using Microsoft.DotNet.Tools.Tests.ComponentMocks; +using Microsoft.DotNet.Tools.Test.Utilities; +using Microsoft.Extensions.DependencyModel.Tests; +using Microsoft.Extensions.EnvironmentAbstractions; +using Xunit; +using Parser = Microsoft.DotNet.Cli.Parser; +using LocalizableStrings = Microsoft.DotNet.Tools.Uninstall.Tool.LocalizableStrings; +using InstallLocalizableStrings = Microsoft.DotNet.Tools.Install.Tool.LocalizableStrings; + +namespace Microsoft.DotNet.Tests.Commands +{ + public class UninstallToolCommandTests + { + private readonly BufferedReporter _reporter; + private readonly IFileSystem _fileSystem; + private readonly ShellShimRepositoryMock _shellShimRepositoryMock; + private readonly EnvironmentPathInstructionMock _environmentPathInstructionMock; + + private const string PackageId = "global.tool.console.demo"; + private const string PackageVersion = "1.0.4"; + private const string ShimsDirectory = "shims"; + private const string ToolsDirectory = "tools"; + + public UninstallToolCommandTests() + { + _reporter = new BufferedReporter(); + _fileSystem = new FileSystemMockBuilder().Build(); + _shellShimRepositoryMock = new ShellShimRepositoryMock(new DirectoryPath(ShimsDirectory), _fileSystem); + _environmentPathInstructionMock = new EnvironmentPathInstructionMock(_reporter, ShimsDirectory); + } + + [Fact] + public void GivenANonExistentPackageItErrors() + { + var packageId = "does.not.exist"; + var command = CreateUninstallCommand($"-g {packageId}"); + + command.Execute().Should().Be(1); + _reporter.Lines.Count.Should().Be(1); + + _reporter + .Lines[0] + .Should() + .Be(string.Format( + LocalizableStrings.ToolNotInstalled, + packageId).Red()); + } + + [Fact] + public void GivenAMissingGlobalOptionItErrors() + { + var command = CreateUninstallCommand("does.not.exist"); + + Action a = () => { + command.Execute(); + }; + + a.ShouldThrow() + .And + .Message + .Should() + .Be(LocalizableStrings.UninstallToolCommandOnlySupportsGlobal); + } + + [Fact] + public void GivenAPackageItUninstalls() + { + CreateInstallCommand($"-g {PackageId}").Execute().Should().Be(0); + + _reporter + .Lines + .Last() + .Should() + .Contain(string.Format( + InstallLocalizableStrings.InstallationSucceeded, + ProjectRestorerMock.FakeCommandName, + PackageId, + PackageVersion)); + + var packageDirectory = new DirectoryPath(ToolsDirectory).WithSubDirectories(PackageId, PackageVersion); + var shimPath = Path.Combine( + ShimsDirectory, + ProjectRestorerMock.FakeCommandName + + (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : "")); + + _fileSystem.Directory.Exists(packageDirectory.Value).Should().BeTrue(); + _fileSystem.File.Exists(shimPath).Should().BeTrue(); + + _reporter.Lines.Clear(); + + CreateUninstallCommand($"-g {PackageId}").Execute().Should().Be(0); + + _reporter + .Lines + .Single() + .Should() + .Contain(string.Format( + LocalizableStrings.UninstallSucceeded, + PackageId, + PackageVersion)); + + _fileSystem.Directory.Exists(packageDirectory.Value).Should().BeFalse(); + _fileSystem.File.Exists(shimPath).Should().BeFalse(); + } + + [Fact] + public void GivenAFailureToUninstallItLeavesItInstalled() + { + CreateInstallCommand($"-g {PackageId}").Execute().Should().Be(0); + + _reporter + .Lines + .Last() + .Should() + .Contain(string.Format( + InstallLocalizableStrings.InstallationSucceeded, + ProjectRestorerMock.FakeCommandName, + PackageId, + PackageVersion)); + + var packageDirectory = new DirectoryPath(ToolsDirectory).WithSubDirectories(PackageId, PackageVersion); + var shimPath = Path.Combine( + ShimsDirectory, + ProjectRestorerMock.FakeCommandName + + (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : "")); + + _fileSystem.Directory.Exists(packageDirectory.Value).Should().BeTrue(); + _fileSystem.File.Exists(shimPath).Should().BeTrue(); + + _reporter.Lines.Clear(); + + CreateUninstallCommand( + options: $"-g {PackageId}", + uninstallCallback: () => throw new IOException("simulated error")) + .Execute() + .Should() + .Be(1); + + _reporter + .Lines + .Single() + .Should() + .Contain(string.Format( + CommonLocalizableStrings.FailedToUninstallToolPackage, + PackageId, + "simulated error")); + + _fileSystem.Directory.Exists(packageDirectory.Value).Should().BeTrue(); + _fileSystem.File.Exists(shimPath).Should().BeTrue(); + } + + private InstallToolCommand CreateInstallCommand(string options) + { + ParseResult result = Parser.Instance.Parse("dotnet install tool " + options); + + var store = new ToolPackageStoreMock(new DirectoryPath(ToolsDirectory), _fileSystem); + return new InstallToolCommand( + result["dotnet"]["install"]["tool"], + result, + store, + new ToolPackageInstallerMock( + _fileSystem, + store, + new ProjectRestorerMock( + _fileSystem, + _reporter)), + _shellShimRepositoryMock, + _environmentPathInstructionMock, + _reporter); + } + + private UninstallToolCommand CreateUninstallCommand(string options, Action uninstallCallback = null) + { + ParseResult result = Parser.Instance.Parse("dotnet uninstall tool " + options); + + return new UninstallToolCommand( + result["dotnet"]["uninstall"]["tool"], + result, + new ToolPackageStoreMock( + new DirectoryPath(ToolsDirectory), + _fileSystem, + uninstallCallback), + _shellShimRepositoryMock, + _reporter); + } + } +} From 78503f2f368753a5086cc8dcfd96d5e074df69f0 Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Tue, 20 Feb 2018 16:26:45 -0800 Subject: [PATCH 041/103] Set README.md links to master branch --- README.md | 59 +++++++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index b82995678..b00263619 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Looking for V1 of the .NET Core tooling? If you are looking for the v2.0 release of the .NET Core tools (CLI, MSBuild and the new csproj), head over to https://dot.net/core and download! -> **Note:** the release/2.1.3xx branch of the CLI repo is based on an upcoming update of the SDK and is considered pre-release. For production-level usage, please use the +> **Note:** the master branch of the CLI repo is based on an upcoming update of the SDK and is considered pre-release. For production-level usage, please use the > released version of the tools available at https://dot.net/core Found an issue? @@ -59,7 +59,7 @@ To download the .NET Core runtime **without** the SDK, visit https://github.com/ > want to install the latest released versions, check out the [preceding section](#looking-for-v1-of-the-net-core-tooling). > In order to be able to restore these pre-release packages, you may need to add a NuGet feed pointing to https://dotnet.myget.org/F/dotnet-core/api/v3/index.json. Other feeds may also be necessary depending on what kind of project you are working with. -| Platform | Latest Daily Build
*release/2.1.3xx*
[![][version-badge]][version] | +| Platform | Latest Daily Build
*master*
[![][version-badge]][version] | | -------- | :-------------------------------------: | | **Windows x64** | [Installer][win-x64-installer] - [Checksum][win-x64-installer-checksum]
[zip][win-x64-zip] - [Checksum][win-x64-zip-checksum] | | **Windows x86** | [Installer][win-x86-installer] - [Checksum][win-x86-installer-checksum]
[zip][win-x86-zip] - [Checksum][win-x86-zip-checksum] | @@ -69,7 +69,7 @@ To download the .NET Core runtime **without** the SDK, visit https://github.com/ | **RHEL 6** | [tar.gz][rhel-6-targz] - [Checksum][rhel-6-targz-checksum] | | **Alpine 3.6** | [tar.gz][alpine-3.6-targz] - [Checksum][alpine-3.6-targz-checksum] | -| Latest Coherent Build2
*release/2.1.3xx* | +| Latest Coherent Build2
*master* | |:------:| | [![][coherent-version-badge]][coherent-version] | @@ -77,42 +77,41 @@ Reference notes: > **1**: *Our Debian packages are put together slightly differently than the other OS specific installers. Instead of combining everything, we have separate component packages that depend on each other. If you're installing these directly from the .deb files (via dpkg or similar), then you'll need to install the [corresponding Host, Host FX Resolver, and Shared Framework packages](https://github.com/dotnet/core-setup#daily-builds) before installing the Sdk package.* >

**2**: *A 'coherent' build is defined as a build where the Runtime version matches between the CLI and Asp.NET.* -[version]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/latest.version -[coherent-version]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/latest.coherent.version +[version]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/latest.version +[coherent-version]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/latest.coherent.version [comment]: # (The latest versions are always the same across all platforms. Just need one to show, so picking win-x64's svg.) +[version-badge]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/win_x64_Release_version_badge.svg +[coherent-version-badge]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/win_x64_Release_coherent_badge.svg -[version-badge]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/win_x64_Release_version_badge.svg -[coherent-version-badge]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/win_x64_Release_coherent_badge.svg +[win-x64-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-win-x64.exe +[win-x64-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-win-x64.exe.sha +[win-x64-zip]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-win-x64.zip +[win-x64-zip-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-win-x64.zip.sha -[win-x64-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-win-x64.exe -[win-x64-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-win-x64.exe.sha -[win-x64-zip]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-win-x64.zip -[win-x64-zip-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-win-x64.zip.sha +[win-x86-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-win-x86.exe +[win-x86-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-win-x86.exe.sha +[win-x86-zip]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-win-x86.zip +[win-x86-zip-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-win-x86.zip.sha -[win-x86-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-win-x86.exe -[win-x86-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-win-x86.exe.sha -[win-x86-zip]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-win-x86.zip -[win-x86-zip-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-win-x86.zip.sha +[osx-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-osx-x64.pkg +[osx-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-osx-x64.pkg.sha +[osx-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-osx-x64.tar.gz +[osx-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-osx-x64.tar.gz.sha -[osx-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-osx-x64.pkg -[osx-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-osx-x64.pkg.sha -[osx-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-osx-x64.tar.gz -[osx-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-osx-x64.tar.gz.sha +[linux-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-linux-x64.tar.gz +[linux-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-linux-x64.tar.gz.sha -[linux-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-linux-x64.tar.gz -[linux-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-linux-x64.tar.gz.sha +[linux-DEB-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-x64.deb +[linux-DEB-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-x64.deb.sha -[linux-DEB-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-x64.deb -[linux-DEB-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-x64.deb.sha +[rhel-7-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-rhel-x64.rpm +[rhel-7-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-rhel-x64.rpm.sha -[rhel-7-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-rhel-x64.rpm -[rhel-7-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-rhel-x64.rpm.sha +[rhel-6-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-rhel.6-x64.tar.gz +[rhel-6-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-rhel.6-x64.tar.gz.sha -[rhel-6-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-rhel.6-x64.tar.gz -[rhel-6-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-rhel.6-x64.tar.gz.sha - -[alpine-3.6-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-alpine.3.6-x64.tar.gz -[alpine-3.6-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/release/2.1.3xx/dotnet-sdk-latest-alpine.3.6-x64.tar.gz.sha +[alpine-3.6-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-alpine.3.6-x64.tar.gz +[alpine-3.6-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-alpine.3.6-x64.tar.gz.sha # Debian daily feed From 47d0d07fb86ec0842f7bb9c5182e086f729693ff Mon Sep 17 00:00:00 2001 From: vramak Date: Wed, 21 Feb 2018 11:27:58 -0800 Subject: [PATCH 042/103] Updating the WebSdk version to 2.1.300-preview2-20180221-1406058 --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 48004ed50..7d9bc766b 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -17,7 +17,7 @@ 2.1.300-preview2-62607-04 $(MicrosoftNETSdkPackageVersion) 2.1.0-preview2-30119 - 2.1.0-rel-20180215-1390388 + 2.1.300-preview2-20180221-1406058 $(MicrosoftNETSdkWebPackageVersion) $(MicrosoftNETSdkWebPackageVersion) 1.0.1-beta3-20180104-1263555 From c210f7c3601b58abdc0447cfe3ebb3a71690e3b9 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 22 Feb 2018 07:10:45 -0800 Subject: [PATCH 043/103] Update Razor Sdk version to 2.1.0-preview2-30169 --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index d67e7b22a..8e23b4ab0 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -16,7 +16,7 @@ $(MicrosoftCodeAnalysisCSharpPackageVersion) 2.1.300-preview2-62607-04 $(MicrosoftNETSdkPackageVersion) - 2.1.0-preview2-30119 + 2.1.0-preview2-30169 2.1.0-rel-20180215-1390388 $(MicrosoftNETSdkWebPackageVersion) $(MicrosoftNETSdkWebPackageVersion) From 3c2c95667039f63b7aa484bf0e3348f6648afd71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbyn=C4=9Bk=20Sailer?= Date: Thu, 22 Feb 2018 17:07:50 +0100 Subject: [PATCH 044/103] LOC CHECKIN | cli master | 20180222 --- .../xlf/LocalizableStrings.cs.xlf | 6 ++++-- .../xlf/LocalizableStrings.de.xlf | 6 ++++-- .../xlf/LocalizableStrings.es.xlf | 6 ++++-- .../xlf/LocalizableStrings.fr.xlf | 6 ++++-- .../xlf/LocalizableStrings.it.xlf | 6 ++++-- .../xlf/LocalizableStrings.ja.xlf | 6 ++++-- .../xlf/LocalizableStrings.ko.xlf | 10 ++++++---- .../xlf/LocalizableStrings.pl.xlf | 6 ++++-- .../xlf/LocalizableStrings.pt-BR.xlf | 6 ++++-- .../xlf/LocalizableStrings.ru.xlf | 6 ++++-- .../xlf/LocalizableStrings.tr.xlf | 6 ++++-- .../xlf/LocalizableStrings.zh-Hans.xlf | 6 ++++-- .../xlf/LocalizableStrings.zh-Hant.xlf | 6 ++++-- .../xlf/LocalizableStrings.cs.xlf | 8 ++++---- .../xlf/LocalizableStrings.de.xlf | 8 ++++---- .../xlf/LocalizableStrings.es.xlf | 8 ++++---- .../xlf/LocalizableStrings.fr.xlf | 8 ++++---- .../xlf/LocalizableStrings.it.xlf | 8 ++++---- .../xlf/LocalizableStrings.ja.xlf | 8 ++++---- .../xlf/LocalizableStrings.ko.xlf | 8 ++++---- .../xlf/LocalizableStrings.pl.xlf | 8 ++++---- .../xlf/LocalizableStrings.pt-BR.xlf | 8 ++++---- .../xlf/LocalizableStrings.ru.xlf | 8 ++++---- .../xlf/LocalizableStrings.tr.xlf | 8 ++++---- .../xlf/LocalizableStrings.zh-Hans.xlf | 8 ++++---- .../xlf/LocalizableStrings.zh-Hant.xlf | 8 ++++---- src/dotnet/xlf/CommonLocalizableStrings.cs.xlf | 15 +++++++-------- src/dotnet/xlf/CommonLocalizableStrings.de.xlf | 15 +++++++-------- src/dotnet/xlf/CommonLocalizableStrings.es.xlf | 15 +++++++-------- src/dotnet/xlf/CommonLocalizableStrings.fr.xlf | 15 +++++++-------- src/dotnet/xlf/CommonLocalizableStrings.it.xlf | 15 +++++++-------- src/dotnet/xlf/CommonLocalizableStrings.ja.xlf | 15 +++++++-------- src/dotnet/xlf/CommonLocalizableStrings.ko.xlf | 17 ++++++++--------- src/dotnet/xlf/CommonLocalizableStrings.pl.xlf | 15 +++++++-------- .../xlf/CommonLocalizableStrings.pt-BR.xlf | 15 +++++++-------- src/dotnet/xlf/CommonLocalizableStrings.ru.xlf | 15 +++++++-------- src/dotnet/xlf/CommonLocalizableStrings.tr.xlf | 15 +++++++-------- .../xlf/CommonLocalizableStrings.zh-Hans.xlf | 15 +++++++-------- .../xlf/CommonLocalizableStrings.zh-Hant.xlf | 15 +++++++-------- 39 files changed, 198 insertions(+), 185 deletions(-) diff --git a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.cs.xlf b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.cs.xlf index 52d1e0afb..b98e0a4bb 100644 --- a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.cs.xlf +++ b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.cs.xlf @@ -64,9 +64,11 @@ Tuto chybu můžete opravit pomocí některé z těchto možností: Successfully installed the ASP.NET Core HTTPS Development Certificate. To trust the certificate (Windows and macOS only) first install the dev-certs tool by running 'dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final' and then run 'dotnet-dev-certs https --trust'. For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. - ASP.NET Core + ASP.NET Core ------------ -Nainstaloval se vývojový certifikát ASP.NET Core HTTPS. Další informace najdete na https://go.microsoft.com/fwlink/?linkid=84805 +Úspěšně se podařilo nainstalovat certifikát pro vývoj ASP.NET Core HTTPS Development Certificate. +Pokud chcete certifikátu důvěřovat (platí jenom pro Windows a macOS), nainstalujte nejprve nástroj dev-certs. To uděláte tak, že spustíte dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final a potom dotnet-dev-certs https --trust. +Další informace o konfiguraci protokolu HTTPS najdete na webu https://go.microsoft.com/fwlink/?linkid=848054. diff --git a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.de.xlf b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.de.xlf index 60943a88f..c5b1970cc 100644 --- a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.de.xlf +++ b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.de.xlf @@ -64,9 +64,11 @@ Im Folgenden finden Sie einige Optionen, um diesen Fehler zu beheben: Successfully installed the ASP.NET Core HTTPS Development Certificate. To trust the certificate (Windows and macOS only) first install the dev-certs tool by running 'dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final' and then run 'dotnet-dev-certs https --trust'. For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. - ASP.NET Core + ASP.NET Core ------------ -Installiertes ASP.NET Core-HTTPS-Entwicklungszertifikat. Weitere Informationen finden Sie unter https://go.microsoft.com/fwlink/?linkid=84805 +Das ASP.NET Core-HTTPS-Entwicklungszertifikat wurde erfolgreich installiert. +Um dem Zertifikat zu vertrauen (nur Windows und macOS), installieren Sie zuerst das Tool "dev-certs", indem Sie "dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final" und anschließend "dotnet-dev-certs https --trust" ausführen. +Weitere Informationen zur Konfiguration von HTTPS finden Sie unter https://go.microsoft.com/fwlink/?linkid=848054. diff --git a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.es.xlf b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.es.xlf index 9d71f4883..00556abfc 100644 --- a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.es.xlf +++ b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.es.xlf @@ -63,9 +63,11 @@ Estas son algunas opciones para corregir este error: Successfully installed the ASP.NET Core HTTPS Development Certificate. To trust the certificate (Windows and macOS only) first install the dev-certs tool by running 'dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final' and then run 'dotnet-dev-certs https --trust'. For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. - ASP.NET Core + ASP.NET Core ------------ -Se instaló el certificado de desarrollo HTTPS de ASP.NET Core. Para más información, vaya a https://go.microsoft.com/fwlink/?linkid=84805 +El certificado de desarrollo HTTPS de ASP.NET Core se ha instalado correctamente. +Para confiar en el certificado (solo Windows y macOS), instale primero la herramienta dev-certs ejecutando “dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final” y, después, ejecute “dotnet-dev-certs https --trust”. +Para obtener más información sobre la configuración HTTPS, vea https://go.microsoft.com/fwlink/?linkid=848054. diff --git a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.fr.xlf b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.fr.xlf index 041cede23..aaa8cfded 100644 --- a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.fr.xlf +++ b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.fr.xlf @@ -64,9 +64,11 @@ Voici quelques options pour corriger cette erreur : Successfully installed the ASP.NET Core HTTPS Development Certificate. To trust the certificate (Windows and macOS only) first install the dev-certs tool by running 'dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final' and then run 'dotnet-dev-certs https --trust'. For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. - ASP.NET Core + ASP.NET Core ------------ -Certificat de développement HTTPS ASP.NET Core installé. Pour plus d’informations, accédez à https://go.microsoft.com/fwlink/?linkid=84805 +Le certificat de développement ASP.NET Core HTTPS a été installé. +Pour approuver le certificat (Windows et macOS uniquement), installez d'abord l'outil dev-certs en exécutant 'dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final', puis exécutez 'dotnet-dev-certs https --trust'. +Pour plus d'informations sur la configuration de HTTPS, consultez https://go.microsoft.com/fwlink/?linkid=848054. diff --git a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.it.xlf b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.it.xlf index 9608daf2e..f0aa9cd81 100644 --- a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.it.xlf +++ b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.it.xlf @@ -64,9 +64,11 @@ Ecco alcune opzioni per correggere questo errore: Successfully installed the ASP.NET Core HTTPS Development Certificate. To trust the certificate (Windows and macOS only) first install the dev-certs tool by running 'dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final' and then run 'dotnet-dev-certs https --trust'. For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. - ASP.NET Core + ASP.NET Core ------------ -Il certificato di sviluppo HTTPS di ASP.NET Core è stato installato. Per altre informazioni, vedere https://go.microsoft.com/fwlink/?linkid=84805 +Il certificato di sviluppo HTTPS di ASP.NET Core è stato installato. +Per considerare attendibile il certificato (solo Windows e macOS), installare prima lo strumento dev-certs eseguendo 'dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final' e quindi eseguire 'dotnet-dev-certs https --trust'. +Per altre informazioni sulla configurazione di HTTPS, vedere https://go.microsoft.com/fwlink/?linkid=848054. diff --git a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.ja.xlf b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.ja.xlf index 33589ba3a..42c146c99 100644 --- a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.ja.xlf +++ b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.ja.xlf @@ -64,9 +64,11 @@ Here are some options to fix this error: Successfully installed the ASP.NET Core HTTPS Development Certificate. To trust the certificate (Windows and macOS only) first install the dev-certs tool by running 'dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final' and then run 'dotnet-dev-certs https --trust'. For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. - ASP.NET Core + ASP.NET Core ------------ -ASP.NET Core HTTPS 開発証明書をインストールしました。詳しくは、https://go.microsoft.com/fwlink/?linkid=84805 をご覧ください +ASP.NET Core HTTPS 開発証明書が正常にインストールされました。 +証明書を信頼する (Windows および macOS のみ) には、まず 'dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final' を実行して dev-certs ツールをインストールし、次に 'dotnet-dev-certs https --trust' を実行します。 +HTTPS を構成する方法の詳細については、https://go.microsoft.com/fwlink/?linkid=848054 をご覧ください。 diff --git a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.ko.xlf b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.ko.xlf index b59e79ae4..4bd36c154 100644 --- a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.ko.xlf +++ b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.ko.xlf @@ -15,12 +15,12 @@ The .NET Core tools collect usage data in order to help us improve your experien Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry .NET Core를 시작합니다. --------------------- -.NET Core에 대한 자세한 내용은 https://aka.ms/dotnet-docs를 참조하세요. 사용 가능한 명령을 보려면 ‘dotnet --help’를 사용하거나 https://aka.ms/dotnet-cli-docs를 방문하세요. +.NET Core에 대한 자세한 내용은 https://aka.ms/dotnet-docs를 참조하세요. 사용 가능한 명령을 보려면 'dotnet --help'를 사용하거나 https://aka.ms/dotnet-cli-docs를 방문하세요. 원격 분석 --------- .NET Core 도구는 사용자 환경 개선을 위해 사용량 데이터를 수집합니다. 데이터는 익명이며 명령줄 인수를 포함하지 않습니다. Microsoft에서 데이터를 수집하여 커뮤니티와 공유합니다. -자주 사용하는 셸에서 DOTNET_CLI_TELEMETRY_OPTOUT 환경 변수를 ‘1’ 또는 'true'로 설정하여 원격 분석을 옵트아웃할 수 있습니다. +자주 사용하는 셸에서 DOTNET_CLI_TELEMETRY_OPTOUT 환경 변수를 '1' 또는 'true'로 설정하여 원격 분석을 옵트아웃할 수 있습니다. .NET Core CLI 도구 원격 분석에 대한 자세한 내용은 https://aka.ms/dotnet-cli-telemetry에서 확인할 수 있습니다. @@ -64,9 +64,11 @@ Here are some options to fix this error: Successfully installed the ASP.NET Core HTTPS Development Certificate. To trust the certificate (Windows and macOS only) first install the dev-certs tool by running 'dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final' and then run 'dotnet-dev-certs https --trust'. For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. - ASP.NET Core + ASP.NET Core ------------ -설치된 ASP.NET Core HTTPS 개발 인증서. 자세한 내용은 https://go.microsoft.com/fwlink/?linkid=84805을(를) 참조하세요. +ASP.NET Core HTTPS 개발 인증서를 설치했습니다. +인증서를 신뢰하려면(Windows 및 macOS만 해당) 먼저 'dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final'을 실행하여 dev-certs 도구를 설치한 다음, 'dotnet-dev-certs https --trust'를 실행하세요. +HTTPS 구성에 대한 자세한 내용은 https://go.microsoft.com/fwlink/?linkid=848054를 참조하세요. diff --git a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.pl.xlf b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.pl.xlf index bb510b666..f9c4c7e4f 100644 --- a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.pl.xlf +++ b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.pl.xlf @@ -64,9 +64,11 @@ Oto kilka opcji naprawiania tego błędu: Successfully installed the ASP.NET Core HTTPS Development Certificate. To trust the certificate (Windows and macOS only) first install the dev-certs tool by running 'dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final' and then run 'dotnet-dev-certs https --trust'. For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. - ASP.NET Core + ASP.NET Core ------------ -Zainstalowany certyfikat programistyczny HTTPS ASP.NET Core. Aby uzyskać więcej informacji, przejdź na adres https://go.microsoft.com/fwlink/?linkid=84805 +Pomyślnie zainstalowano certyfikat deweloperski protokołu HTTPS programu ASP.NET Core. +Aby ufać temu certyfikatowi (dotyczy tylko systemów Windows i macOS), najpierw zainstaluj narzędzie dev-certs, uruchamiając polecenie „dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final”, a następnie uruchom polecenie „dotnet-dev-certs https --trust”. +Aby uzyskać więcej informacji dotyczących konfigurowania protokołu HTTPS, zobacz https://go.microsoft.com/fwlink/?linkid=848054. diff --git a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.pt-BR.xlf b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.pt-BR.xlf index d11e6847a..b0a55f54f 100644 --- a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.pt-BR.xlf @@ -64,9 +64,11 @@ Aqui estão algumas opções para corrigir este erro: Successfully installed the ASP.NET Core HTTPS Development Certificate. To trust the certificate (Windows and macOS only) first install the dev-certs tool by running 'dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final' and then run 'dotnet-dev-certs https --trust'. For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. - ASP.NET Core + ASP.NET Core ------------ -Certificado de desenvolvimento de HTTPS do ASP.NET Core instalado. Para obter mais informações, vá para https://go.microsoft.com/fwlink/?linkid=84805 +Certificado de Desenvolvimento HTTPS ASP.NET Core instalado com êxito. +Para confiar no certificado (apenas Windows e macOS), primeiramente instale a ferramenta dev-certs executando ‘dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final’ e, em seguida, execute ‘dotnet-dev-certs https --trust’. +Para saber mais sobre configuração de HTTPS, acesse https://go.microsoft.com/fwlink/?linkid=848054. diff --git a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.ru.xlf b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.ru.xlf index e6574a137..53e8228c1 100644 --- a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.ru.xlf +++ b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.ru.xlf @@ -64,9 +64,11 @@ Here are some options to fix this error: Successfully installed the ASP.NET Core HTTPS Development Certificate. To trust the certificate (Windows and macOS only) first install the dev-certs tool by running 'dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final' and then run 'dotnet-dev-certs https --trust'. For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. - ASP.NET Core + ASP.NET Core ------------ -Установлен сертификат для HTTPS-разработки на ASP.NET Core. Дополнительные сведения: https://go.microsoft.com/fwlink/?linkid=84805 +Сертификат разработки HTTPS для ASP.NET Core установлен. +Чтобы сделать сертификат доверенным (только Windows и macOS), сначала установите инструмент dev-certs, выполнив команду "dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final", а затем выполните "dotnet-dev-certs https --trust". +Дополнительные сведения о настройке HTTPS: https://go.microsoft.com/fwlink/?linkid=848054. diff --git a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.tr.xlf b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.tr.xlf index 226a088d1..7ce095994 100644 --- a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.tr.xlf +++ b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.tr.xlf @@ -64,9 +64,11 @@ Bu hatayı düzeltmek için bazı seçenekler: Successfully installed the ASP.NET Core HTTPS Development Certificate. To trust the certificate (Windows and macOS only) first install the dev-certs tool by running 'dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final' and then run 'dotnet-dev-certs https --trust'. For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. - ASP.NET Core + ASP.NET Core ------------ -ASP.NET Core HTTPS geliştirme sertifikası yüklendi. Daha fazla bilgi için bkz. https://go.microsoft.com/fwlink/?linkid=84805 +ASP.NET Core HTTPS Geliştirme Sertifikası başarıyla yüklendi. +Sertifikaya güvenmek için (yalnızca Windows ve macOS) önce 'dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final', sonra 'dotnet-dev-certs https --trust' komutlarını çalıştırarak dev-certs aracını yükleyin. +HTTPS yapılandırması hakkında daha fazla bilgi için bkz. https://go.microsoft.com/fwlink/?linkid=848054. diff --git a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.zh-Hans.xlf b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.zh-Hans.xlf index 658777121..89d13dacf 100644 --- a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.zh-Hans.xlf @@ -64,9 +64,11 @@ Here are some options to fix this error: Successfully installed the ASP.NET Core HTTPS Development Certificate. To trust the certificate (Windows and macOS only) first install the dev-certs tool by running 'dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final' and then run 'dotnet-dev-certs https --trust'. For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. - ASP.NET Core + ASP.NET Core ------------ -安装 ASP.NET Core HTTPS 开发证书。有关详细信息,请转到 https://go.microsoft.com/fwlink/?linkid=84805 +已成功安装 ASP.NET Core HTTPS 开发证书。 +要信任证书(仅限 Windows 和 macOS),请首先通过运行 "dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final" 安装 dev-certs 工具,然后运行 "dotnet-dev-certs https --trust"。 +有关配置 HTTPS 的详细信息,请参阅 https://go.microsoft.com/fwlink/?linkid=848054。 diff --git a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.zh-Hant.xlf b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.zh-Hant.xlf index 29c171d68..dac4c5015 100644 --- a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.zh-Hant.xlf @@ -64,9 +64,11 @@ Here are some options to fix this error: Successfully installed the ASP.NET Core HTTPS Development Certificate. To trust the certificate (Windows and macOS only) first install the dev-certs tool by running 'dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final' and then run 'dotnet-dev-certs https --trust'. For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. - ASP.NET Core + ASP.NET Core ------------ -已安裝 ASP.NET Core HTTPS 開發憑證。如需詳細資訊,請前往 https://go.microsoft.com/fwlink/?linkid=84805 +已成功安裝 ASP.NET Core HTTPS 開發憑證。 +若要信任此憑證 (僅限 Windows 與 macOS),請先執行 'dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final' 安裝 dev-certs 工具,然後再執行 'dotnet-dev-certs https --trust'。 +如需如何設定 HTTPS 的詳細資訊,請參閱 https://go.microsoft.com/fwlink/?linkid=848054。 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 c889a65aa..9c66790c9 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 @@ -82,22 +82,22 @@ Výstup: {2}{3} The settings file in the tool's NuGet package is invalid: {0} - The settings file in the tool's NuGet package is invalid: {0} + Soubor nastavení v balíčku NuGet nástroje je neplatný: {0}. Tool '{0}' failed to install. - Tool '{0}' failed to install. + Nástroj {0} se nepodařilo nainstalovat. Tool '{0}' failed to install. Please contact the tool author for assistance. - Tool '{0}' failed to install. Please contact the tool author for assistance. + Nástroj {0} se nepodařilo nainstalovat. Obraťte se prosím s žádostí o pomoc na autora nástroje. The tool package could not be restored. - The tool package could not be restored. + Balíček nástroje nebylo možné obnovit. 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 6fbfd600c..ce3e0e92c 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 @@ -82,22 +82,22 @@ Ausgabe: {2}{3} The settings file in the tool's NuGet package is invalid: {0} - The settings file in the tool's NuGet package is invalid: {0} + Die Einstellungsdatei im NuGet-Paket des Tools ist ungültig: {0} Tool '{0}' failed to install. - Tool '{0}' failed to install. + Fehler bei der Installation des Tools "{0}". Tool '{0}' failed to install. Please contact the tool author for assistance. - Tool '{0}' failed to install. Please contact the tool author for assistance. + Fehler bei der Installation des Tools "{0}". Wenden Sie sich an den Verfasser des Tools, um Unterstützung zu erhalten. The tool package could not be restored. - The tool package could not be restored. + Das Toolpaket konnte nicht wiederhergestellt werden. 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 23069ae18..77e36bed5 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 @@ -82,22 +82,22 @@ Salida: {2}{3} The settings file in the tool's NuGet package is invalid: {0} - The settings file in the tool's NuGet package is invalid: {0} + El archivo de configuración del paquete NuGet de la herramienta no es válido: {0} Tool '{0}' failed to install. - Tool '{0}' failed to install. + No se pudo instalar la herramienta “{0}”. Tool '{0}' failed to install. Please contact the tool author for assistance. - Tool '{0}' failed to install. Please contact the tool author for assistance. + No se pudo instalar la herramienta “{0}”. Póngase en contacto con su creador para obtener asistencia. The tool package could not be restored. - The tool package could not be restored. + No se puede restaurar el paquete de la herramienta. 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 7ab81e13e..8251b9d5b 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 @@ -82,22 +82,22 @@ Sortie : {2}{3} The settings file in the tool's NuGet package is invalid: {0} - The settings file in the tool's NuGet package is invalid: {0} + Le fichier de paramètres dans le package NuGet de l'outil n'est pas valide : {0} Tool '{0}' failed to install. - Tool '{0}' failed to install. + Impossible d'installer l'outil '{0}'. Tool '{0}' failed to install. Please contact the tool author for assistance. - Tool '{0}' failed to install. Please contact the tool author for assistance. + Impossible d'installer l'outil '{0}'. Contactez le créateur de l'outil pour obtenir de l'aide. The tool package could not be restored. - The tool package could not be restored. + Impossible de restaurer le package de l'outil. 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 b8cad55c8..d707c6f43 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 @@ -82,22 +82,22 @@ Output: {2}{3} The settings file in the tool's NuGet package is invalid: {0} - The settings file in the tool's NuGet package is invalid: {0} + Il file di impostazioni nel pacchetto NuGet dello strumento non è valido: {0} Tool '{0}' failed to install. - Tool '{0}' failed to install. + Non è stato possibile installare lo strumento '{0}'. Tool '{0}' failed to install. Please contact the tool author for assistance. - Tool '{0}' failed to install. Please contact the tool author for assistance. + Non è stato possibile installare lo strumento '{0}'. Per assistenza, contattare l'autore dello strumento. The tool package could not be restored. - The tool package could not be restored. + Non è stato possibile ripristinare il pacchetto dello strumento. 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 54dd306a9..e1623b73c 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 @@ -82,22 +82,22 @@ Output: {2}{3} The settings file in the tool's NuGet package is invalid: {0} - The settings file in the tool's NuGet package is invalid: {0} + ツールの NuGet パッケージ内の設定ファイルが無効です: {0} Tool '{0}' failed to install. - Tool '{0}' failed to install. + ツール '{0}' をインストールできませんでした。 Tool '{0}' failed to install. Please contact the tool author for assistance. - Tool '{0}' failed to install. Please contact the tool author for assistance. + ツール '{0}' をインストールできませんでした。ツールの作成者にお問い合わせください。 The tool package could not be restored. - The tool package could not be restored. + ツール パッケージを復元できませんでした。 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 1d2bc2f7d..3b5aa6ece 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 @@ -82,22 +82,22 @@ Output: {2}{3} The settings file in the tool's NuGet package is invalid: {0} - The settings file in the tool's NuGet package is invalid: {0} + 도구의 NuGet 패키지에 있는 설정 파일이 잘못되었습니다. {0} Tool '{0}' failed to install. - Tool '{0}' failed to install. + '{0}' 도구를 설치하지 못했습니다. Tool '{0}' failed to install. Please contact the tool author for assistance. - Tool '{0}' failed to install. Please contact the tool author for assistance. + '{0}' 도구를 설치하지 못했습니다. 도구 작성자에게 문의하세요. The tool package could not be restored. - The tool package could not be restored. + 도구 패키지를 복원할 수 없습니다. 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 c476ee314..ea939ca87 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 @@ -82,22 +82,22 @@ Dane wyjściowe: {2}{3} The settings file in the tool's NuGet package is invalid: {0} - The settings file in the tool's NuGet package is invalid: {0} + Plik ustawień w pakiecie NuGet narzędzia jest nieprawidłowy: {0} Tool '{0}' failed to install. - Tool '{0}' failed to install. + Zainstalowanie narzędzia „{0}” nie powiodło się. Tool '{0}' failed to install. Please contact the tool author for assistance. - Tool '{0}' failed to install. Please contact the tool author for assistance. + Zainstalowanie narzędzia „{0}” nie powiodło się. Skontaktuj się z autorem narzędzia w celu uzyskania pomocy. The tool package could not be restored. - The tool package could not be restored. + Nie można przywrócić pakietu narzędzia. 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 567f57822..4e65758ca 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 @@ -82,22 +82,22 @@ Output: {2}{3} The settings file in the tool's NuGet package is invalid: {0} - The settings file in the tool's NuGet package is invalid: {0} + O arquivo de configurações no pacote NuGet da ferramenta é inválido: {0} Tool '{0}' failed to install. - Tool '{0}' failed to install. + Não foi possível instalar a ferramenta '{0}'. Tool '{0}' failed to install. Please contact the tool author for assistance. - Tool '{0}' failed to install. Please contact the tool author for assistance. + Não foi possível instalar a ferramenta '{0}'. Entre em contato com o autor da ferramenta para obter assistência. The tool package could not be restored. - The tool package could not be restored. + O pacote da ferramenta não pôde ser restaurado. 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 995a10f1a..b3c55a040 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 @@ -82,22 +82,22 @@ Output: {2}{3} The settings file in the tool's NuGet package is invalid: {0} - The settings file in the tool's NuGet package is invalid: {0} + Недопустимый файл параметров в пакете NuGet инструмента: {0} Tool '{0}' failed to install. - Tool '{0}' failed to install. + Не удалось установить инструмент "{0}". Tool '{0}' failed to install. Please contact the tool author for assistance. - Tool '{0}' failed to install. Please contact the tool author for assistance. + Не удалось установить инструмент "{0}". Обратитесь за помощью к его разработчику. The tool package could not be restored. - The tool package could not be restored. + Не удалось восстановить пакет инструмента. 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 fd1f8fa3c..525ab4ccf 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 @@ -82,22 +82,22 @@ Bağımsız değişkenler: {1} The settings file in the tool's NuGet package is invalid: {0} - The settings file in the tool's NuGet package is invalid: {0} + Aracın NuGet paketindeki ayar dosyası geçersiz: {0} Tool '{0}' failed to install. - Tool '{0}' failed to install. + '{0}' aracı yüklenemedi. Tool '{0}' failed to install. Please contact the tool author for assistance. - Tool '{0}' failed to install. Please contact the tool author for assistance. + '{0}' aracı yüklenemedi. Lütfen yardım için araç sahibiyle iletişime geçin. The tool package could not be restored. - The tool package could not be restored. + Araç paketi geri yüklenemedi. 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 3e374ff8b..4a8935c6b 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 @@ -82,22 +82,22 @@ WorkingDirectory: {0} The settings file in the tool's NuGet package is invalid: {0} - The settings file in the tool's NuGet package is invalid: {0} + 工具的 NuGet 包中的设置文件无效: {0} Tool '{0}' failed to install. - Tool '{0}' failed to install. + 工具“{0}”安装失败。 Tool '{0}' failed to install. Please contact the tool author for assistance. - Tool '{0}' failed to install. Please contact the tool author for assistance. + 工具“{0}”安装失败。请联系工具作者获取帮助。 The tool package could not be restored. - The tool package could not be restored. + 无法还原工具包。 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 da0e13c89..6ef9cb37d 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 @@ -82,22 +82,22 @@ WorkingDirectory: {0} The settings file in the tool's NuGet package is invalid: {0} - The settings file in the tool's NuGet package is invalid: {0} + 工具之 NuGet 套件中的設定檔案無效: {0} Tool '{0}' failed to install. - Tool '{0}' failed to install. + 工具 '{0}' 無法安裝。 Tool '{0}' failed to install. Please contact the tool author for assistance. - Tool '{0}' failed to install. Please contact the tool author for assistance. + 工具 '{0}' 無法安裝。請連絡工具作者尋求協助。 The tool package could not be restored. - The tool package could not be restored. + 此工具套件無法還原。 diff --git a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf index b5761157a..ca0894d44 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf @@ -676,8 +676,7 @@ Invalid XML: {0} - Soubor nastavení nástroje je neplatný soubor xml. -{0} + Neplatné XML: {0} @@ -771,32 +770,32 @@ setx PATH "%PATH%;{1}" Tool defines a command with a missing name setting. - Tool defines a command with a missing name setting. + Nástroj definuje příkaz s chybějícím nastavením názvu. Command '{0}' is missing an entry point setting. - Command '{0}' is missing an entry point setting. + V příkazu {0} chybí nastavení vstupního bodu. Command '{0}' contains one or more of the following invalid characters: {1}. - Command '{0}' contains one or more of the following invalid characters: {1}. + Příkaz {0} obsahuje minimálně jeden neplatný znak: {1}. More than one command is defined for the tool. - More than one command is defined for the tool. + Pro nástroj je definovaných více příkazů. Command '{0}' uses unsupported runner '{1}'." - Command '{0}' uses unsupported runner '{1}'." + Příkaz {0} používá nepodporovaný spouštěč {1}. Tool '{0}' is already installed. - Tool '{0}' is already installed. + Nástroj {0} je už nainstalovaný. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf index a33593c75..3a7c28511 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf @@ -676,8 +676,7 @@ Invalid XML: {0} - Die Datei mit den Tooleinstellungen ist eine ungültige XML. -{0} + Ungültiges XML: {0} @@ -771,32 +770,32 @@ setx PATH "%PATH%;{1}" Tool defines a command with a missing name setting. - Tool defines a command with a missing name setting. + Das Tool definiert einen Befehl mit fehlender Namenseinstellung. Command '{0}' is missing an entry point setting. - Command '{0}' is missing an entry point setting. + Dem Befehl "{0}" fehlt eine Einstiegspunkteinstellung. Command '{0}' contains one or more of the following invalid characters: {1}. - Command '{0}' contains one or more of the following invalid characters: {1}. + Der Befehl "{0}" enthält mindestens eines der folgenden ungültigen Zeichen: {1}. More than one command is defined for the tool. - More than one command is defined for the tool. + Für das Tool wurden mehrere Befehle definiert. Command '{0}' uses unsupported runner '{1}'." - Command '{0}' uses unsupported runner '{1}'." + Der Befehl "{0}" verwendet die nicht unterstützte Ausführung"{1}". Tool '{0}' is already installed. - Tool '{0}' is already installed. + Das Tool "{0}" ist bereits installiert. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf index a945b317e..23d69fb94 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf @@ -676,8 +676,7 @@ Invalid XML: {0} - El archivo de configuración de la herramienta es un xml no válido. -{0} + XML no válido: {0} @@ -771,32 +770,32 @@ setx PATH "%PATH%;{1}" Tool defines a command with a missing name setting. - Tool defines a command with a missing name setting. + La herramienta define un comando en el que falta un valor de nombre. Command '{0}' is missing an entry point setting. - Command '{0}' is missing an entry point setting. + En el comando “{0}”, falta un valor de punto de entrada. Command '{0}' contains one or more of the following invalid characters: {1}. - Command '{0}' contains one or more of the following invalid characters: {1}. + El comando “{0}” contiene uno o varios de los siguientes caracteres no válidos: {1}. More than one command is defined for the tool. - More than one command is defined for the tool. + Se ha definido más de un comando para la herramienta. Command '{0}' uses unsupported runner '{1}'." - Command '{0}' uses unsupported runner '{1}'." + El comando “{0}” utiliza un ejecutor que no se admite: “{1}”. Tool '{0}' is already installed. - Tool '{0}' is already installed. + La herramienta “{0}” ya está instalada. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf index d2e4894b5..41795c4a1 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf @@ -676,8 +676,7 @@ Invalid XML: {0} - Le fichier de paramètres de l'outil est un fichier xml non valide. -{0} + XML non valide : {0} @@ -771,32 +770,32 @@ setx PATH "%PATH%;{1}" Tool defines a command with a missing name setting. - Tool defines a command with a missing name setting. + L'outil définit une commande avec un paramètre de nom manquant. Command '{0}' is missing an entry point setting. - Command '{0}' is missing an entry point setting. + La commande '{0}' a un paramètre de point d'entrée manquant. Command '{0}' contains one or more of the following invalid characters: {1}. - Command '{0}' contains one or more of the following invalid characters: {1}. + La commande '{0}' contient un ou plusieurs caractères non valides suivants : {1}. More than one command is defined for the tool. - More than one command is defined for the tool. + Plusieurs commandes sont définies pour l'outil. Command '{0}' uses unsupported runner '{1}'." - Command '{0}' uses unsupported runner '{1}'." + La commande '{0}' utilise un exécuteur non pris en charge '{1}'." Tool '{0}' is already installed. - Tool '{0}' is already installed. + L'outil '{0}' est déjà installé. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf index 0ffa11a5c..b75166d04 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf @@ -676,8 +676,7 @@ Invalid XML: {0} - Il file di impostazioni dello strumento è costituito da codice XML non valido. -{0} + XML non valido: {0} @@ -771,32 +770,32 @@ setx PATH "%PATH%;{1}" Tool defines a command with a missing name setting. - Tool defines a command with a missing name setting. + Lo strumento definisce un comando con un'impostazione di nome mancante. Command '{0}' is missing an entry point setting. - Command '{0}' is missing an entry point setting. + Nel comando '{0}' manca un'impostazione di punto di ingresso. Command '{0}' contains one or more of the following invalid characters: {1}. - Command '{0}' contains one or more of the following invalid characters: {1}. + Il comando '{0}' contiene uno o più dei caratteri seguenti non validi: {1}. More than one command is defined for the tool. - More than one command is defined for the tool. + Per lo strumento è definito più di un comando. Command '{0}' uses unsupported runner '{1}'." - Command '{0}' uses unsupported runner '{1}'." + Il comando '{0}' usa il runner '{1}'." Tool '{0}' is already installed. - Tool '{0}' is already installed. + Lo strumento '{0}' è già installato. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf index 881f40655..43199ec66 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf @@ -676,8 +676,7 @@ Invalid XML: {0} - ツールの設定ファイルは無効な xml です。 -{0} + XML が無効です: {0} @@ -771,32 +770,32 @@ setx PATH "%PATH%;{1}" 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. + コマンド '{0}' にエントリ ポイント設定がありません。 Command '{0}' contains one or more of the following invalid characters: {1}. - Command '{0}' contains one or more of the following invalid characters: {1}. + コマンド '{0}' には次の無効な文字が 1 つまたは複数含まれています: {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}'." + コマンド '{0}' はサポートされていないランナー '{1}' を使用します。 Tool '{0}' is already installed. - Tool '{0}' is already installed. + ツール '{0}' は既にインストールされています。 diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf index fd686308d..eae6f4385 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf @@ -595,7 +595,7 @@ Project `{0}` could not be evaluated. Evaluation failed with following error: {1}. - ‘{0}’ 프로젝트를 평가할 수 없습니다. 다음 오류와 함께 평가가 실패했습니다. + '{0}' 프로젝트를 평가할 수 없습니다. 다음 오류와 함께 평가가 실패했습니다. {1} @@ -676,8 +676,7 @@ Invalid XML: {0} - 도구의 설정 파일이 잘못된 xml입니다. -{0} + 잘못된 XML: {0} @@ -771,32 +770,32 @@ setx PATH "%PATH%;{1}" 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. + '{0}' 명령에 진입점 설정이 없습니다. Command '{0}' contains one or more of the following invalid characters: {1}. - Command '{0}' contains one or more of the following invalid characters: {1}. + '{0}' 명령에 다음과 같은 잘못된 문자가 하나 이상 포함되어 있습니다. {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}'." + '{0}' 명령에서 지원되지 않는 실행기 '{1}'을(를) 사용합니다." Tool '{0}' is already installed. - Tool '{0}' is already installed. + '{0}' 도구가 이미 설치되어 있습니다. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf index 350066dcd..d22128f67 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf @@ -676,8 +676,7 @@ Invalid XML: {0} - Plik ustawień narzędzia nie jest prawidłowym plikiem xml. -{0} + Nieprawidłowy kod XML: {0} @@ -771,32 +770,32 @@ setx PATH "%PATH%;{1}" Tool defines a command with a missing name setting. - Tool defines a command with a missing name setting. + Narzędzie definiuje polecenie z brakującym ustawieniem nazwy. Command '{0}' is missing an entry point setting. - Command '{0}' is missing an entry point setting. + W poleceniu „{0}” brakuje ustawienia punktu wejścia. Command '{0}' contains one or more of the following invalid characters: {1}. - Command '{0}' contains one or more of the following invalid characters: {1}. + Polecenie „{0}” zawiera co najmniej jeden nieprawidłowy znak: {1}. More than one command is defined for the tool. - More than one command is defined for the tool. + Dla narzędzia zdefiniowano więcej niż jedno polecenie. Command '{0}' uses unsupported runner '{1}'." - Command '{0}' uses unsupported runner '{1}'." + Polecenie „{0}” używa nieobsługiwanego modułu uruchamiającego „{1}”. Tool '{0}' is already installed. - Tool '{0}' is already installed. + Narzędzie „{0}” jest już zainstalowane. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf b/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf index 2d29fb71f..998559bab 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf @@ -676,8 +676,7 @@ Invalid XML: {0} - O arquivo de configuração da ferramenta é um XML inválido. -{0} + XML inválido: {0} @@ -771,32 +770,32 @@ setx PATH "%PATH%;{1}" Tool defines a command with a missing name setting. - Tool defines a command with a missing name setting. + A ferramenta define um comando com uma configuração de nome ausente. Command '{0}' is missing an entry point setting. - Command '{0}' is missing an entry point setting. + Há uma configuração de ponto de entrada ausente no comando '{0}'. Command '{0}' contains one or more of the following invalid characters: {1}. - Command '{0}' contains one or more of the following invalid characters: {1}. + O comando '{0}' contém um ou mais dos seguintes caracteres inválidos: {1}. More than one command is defined for the tool. - More than one command is defined for the tool. + Há mais de um comando definido para a ferramenta. Command '{0}' uses unsupported runner '{1}'." - Command '{0}' uses unsupported runner '{1}'." + O comando '{0}' usa um executor '{1}' sem suporte." Tool '{0}' is already installed. - Tool '{0}' is already installed. + A ferramenta '{0}' já está instalada. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf index 8d10fd480..b1e80542b 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf @@ -676,8 +676,7 @@ Invalid XML: {0} - Файл параметров инструмента является недопустимым XML. -{0} + Недопустимый XML: {0} @@ -771,32 +770,32 @@ setx PATH "%PATH%;{1}" 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. + В команде "{0}" не задана точка входа. Command '{0}' contains one or more of the following invalid characters: {1}. - Command '{0}' contains one or more of the following invalid characters: {1}. + Команда "{0}" содержит следующие недопустимы символы: {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}'." + Команда "{0}" использует неподдерживаемое средство запуска "{1}". Tool '{0}' is already installed. - Tool '{0}' is already installed. + Инструмент "{0}" уже установлен. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf index 7e7c3d8e3..2019e1174 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf @@ -676,8 +676,7 @@ Invalid XML: {0} - Aracın ayarlar dosyası geçersiz xml içeriyor. -{0} + Geçersiz XML: {0} @@ -771,32 +770,32 @@ setx PATH "%PATH%;{1}" Tool defines a command with a missing name setting. - Tool defines a command with a missing name setting. + Araçta ad ayarı eksik bir komut tanımlanıyor. Command '{0}' is missing an entry point setting. - Command '{0}' is missing an entry point setting. + '{0}' komutunda giriş noktası ayarı eksik. Command '{0}' contains one or more of the following invalid characters: {1}. - Command '{0}' contains one or more of the following invalid characters: {1}. + '{0}' komutu şu geçersiz karakterlerden birini veya daha fazlasını içeriyor: {1}. More than one command is defined for the tool. - More than one command is defined for the tool. + Araç için birden fazla komut tanımlı. Command '{0}' uses unsupported runner '{1}'." - Command '{0}' uses unsupported runner '{1}'." + '{0}' komutu, desteklenmeyen '{1}' çalıştırıcısını kullanıyor." Tool '{0}' is already installed. - Tool '{0}' is already installed. + '{0}' aracı zaten yüklü. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf index b91e47ca1..9307b7082 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf @@ -676,8 +676,7 @@ Invalid XML: {0} - 工具的设置文件为无效 xml。 -{0} + 无效的 XML: {0} @@ -771,32 +770,32 @@ setx PATH "%PATH%;{1}" 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. + 命令“{0}”缺少入口点设置。 Command '{0}' contains one or more of the following invalid characters: {1}. - Command '{0}' contains one or more of the following invalid characters: {1}. + 命令“{0}”包含一个或多个以下无效字符: {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}'." + 命令“{0}”使用不受支持的运行程序“{1}”。” Tool '{0}' is already installed. - Tool '{0}' is already installed. + 已安装工具“{0}”。 diff --git a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf index 27f480310..3062d8bd2 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf @@ -676,8 +676,7 @@ Invalid XML: {0} - 工具設定檔為無效的 XML。 -{0} + XML 無效: {0} @@ -771,32 +770,32 @@ setx PATH "%PATH%;{1}" 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. + 命令 '{0}' 缺少進入點設定。 Command '{0}' contains one or more of the following invalid characters: {1}. - Command '{0}' contains one or more of the following invalid characters: {1}. + 命令 '{0}' 包含下列一或多個無效的字元: {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}'." + 命令 '{0}' 使用了不支援的執行器 '{1}'。" Tool '{0}' is already installed. - Tool '{0}' is already installed. + 工具 '{0}' 已安裝。 From d5169549fc6ab1b2fe3c791af242cf0949899521 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 22 Feb 2018 10:03:32 -0800 Subject: [PATCH 045/103] Also update Microsoft.AspNetCore.App --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 8e23b4ab0..75a72bc05 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -1,7 +1,7 @@ - 2.1.0-preview2-30106 + 2.1.0-preview2-30169 2.1.0-preview2-26131-06 $(MicrosoftNETCoreAppPackageVersion) 15.6.82 From d38362835d3af60944923e9885d7fe8692c618ee Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Thu, 22 Feb 2018 12:07:54 -0800 Subject: [PATCH 046/103] Bundle dotnet-sql-cache and dotnet-user-secrets in the CLI --- Documentation/README.md | 1 + Documentation/general/aspnetcore-tools.md | 10 ++++++++++ build/BundledDotnetTools.props | 4 +++- 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 Documentation/general/aspnetcore-tools.md diff --git a/Documentation/README.md b/Documentation/README.md index 9d211c0a2..bc87241c0 100644 --- a/Documentation/README.md +++ b/Documentation/README.md @@ -8,6 +8,7 @@ Documents Index - [.NET Core native pre-requisities document](https://github.com/dotnet/core/blob/master/Documentation/prereqs.md) - [Roadmap and OS support](https://github.com/dotnet/core/blob/master/roadmap.md) - [Comprehensive CLI documentation](https://docs.microsoft.com/en-us/dotnet/articles/core/preview3/tools/) +- [ASP.NET Core Command Line Tools](general/aspnetcore-tools.md) ## Working with the CLI repo diff --git a/Documentation/general/aspnetcore-tools.md b/Documentation/general/aspnetcore-tools.md new file mode 100644 index 000000000..371c1a443 --- /dev/null +++ b/Documentation/general/aspnetcore-tools.md @@ -0,0 +1,10 @@ +ASP.NET Core Command Line Tools +=============================== + +The .NET Core CLI includes some commands that are specific to ASP.NET Core projects. + + - dotnet dev-certs + - dotnet user-secrets + - dotnet sql-cache + +For more information on these tools, see . diff --git a/build/BundledDotnetTools.props b/build/BundledDotnetTools.props index acd2156a5..e64552ab0 100644 --- a/build/BundledDotnetTools.props +++ b/build/BundledDotnetTools.props @@ -1,6 +1,8 @@ - + + + From 49f03538ba1c020a565ba65ad7e99e4cbfa2913d Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Thu, 22 Feb 2018 17:49:15 -0800 Subject: [PATCH 047/103] Fix loc test by using straight quotes --- src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.es.xlf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.es.xlf b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.es.xlf index 00556abfc..fa1e01cf1 100644 --- a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.es.xlf +++ b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.es.xlf @@ -66,7 +66,7 @@ For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?l ASP.NET Core ------------ El certificado de desarrollo HTTPS de ASP.NET Core se ha instalado correctamente. -Para confiar en el certificado (solo Windows y macOS), instale primero la herramienta dev-certs ejecutando “dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final” y, después, ejecute “dotnet-dev-certs https --trust”. +Para confiar en el certificado (solo Windows y macOS), instale primero la herramienta dev-certs ejecutando "dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final" y, después, ejecute "dotnet-dev-certs https --trust". Para obtener más información sobre la configuración HTTPS, vea https://go.microsoft.com/fwlink/?linkid=848054. From 53dcff597c95f628c69de3d09412682f2818d5e1 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Fri, 16 Feb 2018 21:56:03 -0800 Subject: [PATCH 048/103] Adding a version property with the CLI version and a private preview property to BundledVersions. --- build/MSBuildExtensions.targets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/MSBuildExtensions.targets b/build/MSBuildExtensions.targets index 4f95d4db1..c6ce9ae6b 100644 --- a/build/MSBuildExtensions.targets +++ b/build/MSBuildExtensions.targets @@ -117,6 +117,8 @@ <_NETCoreAppTargetFrameworkVersion>$(_NETCoreAppPackageVersion.Split('.')[0]).$(_NETCoreAppPackageVersion.Split('.')[1]) <_NETStandardTargetFrameworkVersion>$(_NETStandardLibraryPackageVersion.Split('.')[0]).$(_NETStandardLibraryPackageVersion.Split('.')[1]) + <_NETCoreSdkIsPreview Condition=" '$(DropSuffix)' == '' ">true + $(_NETStandardTargetFrameworkVersion) $(_NETStandardLibraryPackageVersion) $(_NETCorePlatformsPackageVersion) + $(SdkVersion) + <_NETCoreSdkIsPreview>$(_NETCoreSdkIsPreview) ]]> From abec8bb31e16247ab5a11c76c2e9e5d2ab0e614e Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Fri, 23 Feb 2018 14:58:41 -0800 Subject: [PATCH 049/103] Updating the version of ASP.NET --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 75a72bc05..a82e69839 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -1,7 +1,7 @@ - 2.1.0-preview2-30169 + 2.1.0-preview2-30171 2.1.0-preview2-26131-06 $(MicrosoftNETCoreAppPackageVersion) 15.6.82 From c28f4a2e34731733e388a0a81bf1e43d5c0a6a6f Mon Sep 17 00:00:00 2001 From: William Lee Date: Mon, 26 Feb 2018 11:46:01 -0800 Subject: [PATCH 050/103] Pass any as rid (#8677) --- .../dotnet-install-tool/ProjectRestorer.cs | 15 ++------------- .../Microsoft.DotNet.ToolPackage.Tests.csproj | 12 ------------ .../SampleGlobalTool/includepublish.nuspec | 3 --- 3 files changed, 2 insertions(+), 28 deletions(-) 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 760168517..813e6a8fd 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/ProjectRestorer.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/ProjectRestorer.cs @@ -14,6 +14,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool { internal class ProjectRestorer : IProjectRestorer { + private const string AnyRid = "any"; private readonly IReporter _reporter; public ProjectRestorer(IReporter reporter = null) @@ -46,7 +47,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool argsToPassToRestore.AddRange(new List { "--runtime", - GetRuntimeIdentifierWithMacOsHighSierraFallback(), + AnyRid, $"/p:BaseIntermediateOutputPath={assetJsonOutput.ToQuotedString()}" }); @@ -68,17 +69,5 @@ namespace Microsoft.DotNet.Tools.Install.Tool throw new ToolPackageException(LocalizableStrings.ToolInstallationRestoreFailed); } } - - // walk around for https://github.com/dotnet/corefx/issues/26488 - // fallback osx.10.13 to osx - private static string GetRuntimeIdentifierWithMacOsHighSierraFallback() - { - if (RuntimeEnvironment.GetRuntimeIdentifier() == "osx.10.13-x64") - { - return "osx-x64"; - } - - return RuntimeEnvironment.GetRuntimeIdentifier(); - } } } diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/Microsoft.DotNet.ToolPackage.Tests.csproj b/test/Microsoft.DotNet.ToolPackage.Tests/Microsoft.DotNet.ToolPackage.Tests.csproj index 0670e8c91..c5d027749 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/Microsoft.DotNet.ToolPackage.Tests.csproj +++ b/test/Microsoft.DotNet.ToolPackage.Tests/Microsoft.DotNet.ToolPackage.Tests.csproj @@ -53,16 +53,4 @@ - - - - - microsoft.netcore.platforms.2.1.0-preview1-26115-04.nupkg - https://dotnet.myget.org/F/dotnet-core/api/v2/package/Microsoft.NETCore.Platforms/2.1.0-preview1-26115-04 - - - - - diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/SampleGlobalTool/includepublish.nuspec b/test/Microsoft.DotNet.ToolPackage.Tests/SampleGlobalTool/includepublish.nuspec index 26cbe3c39..57b0be8ec 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/SampleGlobalTool/includepublish.nuspec +++ b/test/Microsoft.DotNet.ToolPackage.Tests/SampleGlobalTool/includepublish.nuspec @@ -8,9 +8,6 @@ - - - From c3e78cca1d3d57cff67d6c465abf82bc2f29504e Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Tue, 20 Feb 2018 12:57:40 -0800 Subject: [PATCH 051/103] Remove unused resource strings. This commit removes unused resource strings from commands that no longer exist. --- .../dotnet-add-proj/LocalizableStrings.resx | 129 ------------------ .../xlf/LocalizableStrings.cs.xlf | 22 --- .../xlf/LocalizableStrings.de.xlf | 22 --- .../xlf/LocalizableStrings.es.xlf | 22 --- .../xlf/LocalizableStrings.fr.xlf | 22 --- .../xlf/LocalizableStrings.it.xlf | 22 --- .../xlf/LocalizableStrings.ja.xlf | 22 --- .../xlf/LocalizableStrings.ko.xlf | 22 --- .../xlf/LocalizableStrings.pl.xlf | 22 --- .../xlf/LocalizableStrings.pt-BR.xlf | 22 --- .../xlf/LocalizableStrings.ru.xlf | 22 --- .../xlf/LocalizableStrings.tr.xlf | 22 --- .../xlf/LocalizableStrings.xlf | 20 --- .../xlf/LocalizableStrings.zh-Hans.xlf | 22 --- .../xlf/LocalizableStrings.zh-Hant.xlf | 22 --- .../dotnet-list-proj/LocalizableStrings.resx | 126 ----------------- .../xlf/LocalizableStrings.cs.xlf | 17 --- .../xlf/LocalizableStrings.de.xlf | 17 --- .../xlf/LocalizableStrings.es.xlf | 17 --- .../xlf/LocalizableStrings.fr.xlf | 17 --- .../xlf/LocalizableStrings.it.xlf | 17 --- .../xlf/LocalizableStrings.ja.xlf | 17 --- .../xlf/LocalizableStrings.ko.xlf | 17 --- .../xlf/LocalizableStrings.pl.xlf | 17 --- .../xlf/LocalizableStrings.pt-BR.xlf | 17 --- .../xlf/LocalizableStrings.ru.xlf | 17 --- .../xlf/LocalizableStrings.tr.xlf | 17 --- .../xlf/LocalizableStrings.xlf | 16 --- .../xlf/LocalizableStrings.zh-Hans.xlf | 17 --- .../xlf/LocalizableStrings.zh-Hant.xlf | 17 --- .../LocalizableStrings.resx | 129 ------------------ .../xlf/LocalizableStrings.cs.xlf | 22 --- .../xlf/LocalizableStrings.de.xlf | 22 --- .../xlf/LocalizableStrings.es.xlf | 22 --- .../xlf/LocalizableStrings.fr.xlf | 22 --- .../xlf/LocalizableStrings.it.xlf | 22 --- .../xlf/LocalizableStrings.ja.xlf | 22 --- .../xlf/LocalizableStrings.ko.xlf | 22 --- .../xlf/LocalizableStrings.pl.xlf | 22 --- .../xlf/LocalizableStrings.pt-BR.xlf | 22 --- .../xlf/LocalizableStrings.ru.xlf | 22 --- .../xlf/LocalizableStrings.tr.xlf | 22 --- .../xlf/LocalizableStrings.xlf | 20 --- .../xlf/LocalizableStrings.zh-Hans.xlf | 22 --- .../xlf/LocalizableStrings.zh-Hant.xlf | 22 --- src/dotnet/dotnet.csproj | 3 - 46 files changed, 1236 deletions(-) delete mode 100644 src/dotnet/commands/dotnet-add/dotnet-add-proj/LocalizableStrings.resx delete mode 100644 src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.cs.xlf delete mode 100644 src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.de.xlf delete mode 100644 src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.es.xlf delete mode 100644 src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.fr.xlf delete mode 100644 src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.it.xlf delete mode 100644 src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.ja.xlf delete mode 100644 src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.ko.xlf delete mode 100644 src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.pl.xlf delete mode 100644 src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.pt-BR.xlf delete mode 100644 src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.ru.xlf delete mode 100644 src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.tr.xlf delete mode 100644 src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.xlf delete mode 100644 src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.zh-Hans.xlf delete mode 100644 src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.zh-Hant.xlf delete mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-proj/LocalizableStrings.resx delete mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.cs.xlf delete mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.de.xlf delete mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.es.xlf delete mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.fr.xlf delete mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.it.xlf delete mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.ja.xlf delete mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.ko.xlf delete mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.pl.xlf delete mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.pt-BR.xlf delete mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.ru.xlf delete mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.tr.xlf delete mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.xlf delete mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.zh-Hans.xlf delete mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.zh-Hant.xlf delete mode 100644 src/dotnet/commands/dotnet-remove/dotnet-remove-proj/LocalizableStrings.resx delete mode 100644 src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.cs.xlf delete mode 100644 src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.de.xlf delete mode 100644 src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.es.xlf delete mode 100644 src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.fr.xlf delete mode 100644 src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.it.xlf delete mode 100644 src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.ja.xlf delete mode 100644 src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.ko.xlf delete mode 100644 src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.pl.xlf delete mode 100644 src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.pt-BR.xlf delete mode 100644 src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.ru.xlf delete mode 100644 src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.tr.xlf delete mode 100644 src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.xlf delete mode 100644 src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.zh-Hans.xlf delete mode 100644 src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.zh-Hant.xlf diff --git a/src/dotnet/commands/dotnet-add/dotnet-add-proj/LocalizableStrings.resx b/src/dotnet/commands/dotnet-add/dotnet-add-proj/LocalizableStrings.resx deleted file mode 100644 index a5810e897..000000000 --- a/src/dotnet/commands/dotnet-add/dotnet-add-proj/LocalizableStrings.resx +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - .NET Add Project to Solution Command - - - Command to add project to solution - - - Projects to add to solution - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.cs.xlf deleted file mode 100644 index 944be9708..000000000 --- a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.cs.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Add Project to Solution Command - Příkaz rozhraní .NET pro přidání projektu do řešení - - - - Command to add project to solution - Příkaz pro přidání projektu do řešení - - - - Projects to add to solution - Projekty přidané do řešení - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.de.xlf deleted file mode 100644 index ed33e3f3d..000000000 --- a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.de.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Add Project to Solution Command - .NET-Befehl zum Hinzufügen eines Projekts zur Projektmappe - - - - Command to add project to solution - Befehl zum Hinzufügen eines Projekts zur Projektmappe - - - - Projects to add to solution - Zur Projektmappe hinzuzufügende Projekte - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.es.xlf deleted file mode 100644 index f9d1dab81..000000000 --- a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.es.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Add Project to Solution Command - Comando de .NET Agregar proyecto a solución - - - - Command to add project to solution - Comando para agregar un proyecto a una solución - - - - Projects to add to solution - Proyectos que se agregarán a la solución - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.fr.xlf deleted file mode 100644 index 2323b4ba9..000000000 --- a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.fr.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Add Project to Solution Command - Commande .NET d'ajout de projet à une solution - - - - Command to add project to solution - Commande d'ajout de projet à une solution - - - - Projects to add to solution - Projets à ajouter à la solution - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.it.xlf deleted file mode 100644 index 9f5b6b257..000000000 --- a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.it.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Add Project to Solution Command - Comando Aggiungi progetto a soluzione .NET - - - - Command to add project to solution - Comando per aggiungere il progetto alla soluzione - - - - Projects to add to solution - Progetti da aggiungere alla soluzione - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.ja.xlf deleted file mode 100644 index 7db8904d8..000000000 --- a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.ja.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Add Project to Solution Command - .NET Add Project to Solution コマンド - - - - Command to add project to solution - ソリューションにプロジェクトを追加するコマンド - - - - Projects to add to solution - ソリューションに追加するプロジェクト - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.ko.xlf deleted file mode 100644 index 5b6e02c56..000000000 --- a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.ko.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Add Project to Solution Command - .NET 솔루션에 프로젝트 추가 명령 - - - - Command to add project to solution - 솔루션에 프로젝트를 추가하기 위한 명령입니다. - - - - Projects to add to solution - 솔루션에 추가할 프로젝트 - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.pl.xlf deleted file mode 100644 index 7c8e0049f..000000000 --- a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.pl.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Add Project to Solution Command - Polecenie dodawania projektu do rozwiązania dla platformy .NET - - - - Command to add project to solution - Polecenie umożliwiające dodanie projektu do rozwiązania - - - - Projects to add to solution - Projekty, które mają zostać dodane do rozwiązania - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.pt-BR.xlf deleted file mode 100644 index 1b3694bb4..000000000 --- a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.pt-BR.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Add Project to Solution Command - Comando Adicionar Projeto à Solução do .NET - - - - Command to add project to solution - Comando para adicionar o projeto à solução - - - - Projects to add to solution - Projetos a serem adicionados à solução - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.ru.xlf deleted file mode 100644 index e609e17f9..000000000 --- a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.ru.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Add Project to Solution Command - Команда .NET "Добавить проект в решение" - - - - Command to add project to solution - Команда для добавления проекта в решение - - - - Projects to add to solution - Проекты, добавляемые в решение - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.tr.xlf deleted file mode 100644 index ab0b0c18b..000000000 --- a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.tr.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Add Project to Solution Command - .NET Çözüme Proje Ekleme Komutu - - - - Command to add project to solution - Çözüme proje ekleme komutu - - - - Projects to add to solution - Çözüme eklenecek projeler - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.xlf b/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.xlf deleted file mode 100644 index 34201b21a..000000000 --- a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.xlf +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - .NET Add Project to Solution Command - - - - Command to add project to solution - - - - Projects to add to solution - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.zh-Hans.xlf deleted file mode 100644 index e49d0c2b1..000000000 --- a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.zh-Hans.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Add Project to Solution Command - .NET 将项目添加到解决方案命令 - - - - Command to add project to solution - 将项目添加到解决方案的命令 - - - - Projects to add to solution - 要添加到解决方案的项目 - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.zh-Hant.xlf deleted file mode 100644 index b24ad1c7f..000000000 --- a/src/dotnet/commands/dotnet-add/dotnet-add-proj/xlf/LocalizableStrings.zh-Hant.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Add Project to Solution Command - .NET 將專案新增至解決方案命令 - - - - Command to add project to solution - 命令,將專案新增至解決方案 - - - - Projects to add to solution - 要新增至解決方案的專案 - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-proj/LocalizableStrings.resx b/src/dotnet/commands/dotnet-list/dotnet-list-proj/LocalizableStrings.resx deleted file mode 100644 index a7913dc1d..000000000 --- a/src/dotnet/commands/dotnet-list/dotnet-list-proj/LocalizableStrings.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - .NET Projects in Solution viewer - - - Command to list projects in a solution - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.cs.xlf deleted file mode 100644 index b151f7b6f..000000000 --- a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.cs.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - .NET Projects in Solution viewer - Projekty .NET v prohlížeči řešení - - - - Command to list projects in a solution - Příkaz pro zobrazení seznamu projektů v řešení - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.de.xlf deleted file mode 100644 index 8da16bcd0..000000000 --- a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.de.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - .NET Projects in Solution viewer - .NET-Projekte in Projektmappenviewer - - - - Command to list projects in a solution - Befehl zum Auflisten von Projekten in einer Projektmappe - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.es.xlf deleted file mode 100644 index 420558ecc..000000000 --- a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.es.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - .NET Projects in Solution viewer - Visor de proyectos de NET en la solución - - - - Command to list projects in a solution - Comando para mostrar los proyectos de una solución - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.fr.xlf deleted file mode 100644 index 3066ae96e..000000000 --- a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.fr.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - .NET Projects in Solution viewer - Projets .NET dans la visionneuse de solutions - - - - Command to list projects in a solution - Commande permettant de lister les projets d'une solution - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.it.xlf deleted file mode 100644 index 6441bf146..000000000 --- a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.it.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - .NET Projects in Solution viewer - Progetti .NET nel visualizzatore soluzioni - - - - Command to list projects in a solution - Comando per elencare i progetti presenti in una soluzione - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.ja.xlf deleted file mode 100644 index b3ac167c7..000000000 --- a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.ja.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - .NET Projects in Solution viewer - ソリューション ビューアー内の .NET プロジェクト - - - - Command to list projects in a solution - ソリューションのプロジェクトを一覧表示するコマンド - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.ko.xlf deleted file mode 100644 index a86df7d2c..000000000 --- a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.ko.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - .NET Projects in Solution viewer - .NET 솔루션 뷰어의 프로젝트 - - - - Command to list projects in a solution - 솔루션의 프로젝트를 나열하기 위한 명령입니다. - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.pl.xlf deleted file mode 100644 index 8bed18a05..000000000 --- a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.pl.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - .NET Projects in Solution viewer - Podgląd projektów w rozwiązaniu dla platformy .NET - - - - Command to list projects in a solution - Polecenie umożliwiające wyświetlenie listy projektów w rozwiązaniu - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.pt-BR.xlf deleted file mode 100644 index 66f962109..000000000 --- a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.pt-BR.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - .NET Projects in Solution viewer - Projetos .NET no visualizador da Solução - - - - Command to list projects in a solution - Comando para listar os projetos em uma solução - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.ru.xlf deleted file mode 100644 index 6a7ba6513..000000000 --- a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.ru.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - .NET Projects in Solution viewer - Проекты .NET в средстве просмотра решений - - - - Command to list projects in a solution - Команда для перечисления проектов в решении - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.tr.xlf deleted file mode 100644 index 0d071b7ed..000000000 --- a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.tr.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - .NET Projects in Solution viewer - Çözüm görüntüleyicisinde .NET Projeleri - - - - Command to list projects in a solution - Bir çözümdeki projeleri listeleme komutu - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.xlf deleted file mode 100644 index 6856ef94e..000000000 --- a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.xlf +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - .NET Projects in Solution viewer - - - - Command to list projects in a solution - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.zh-Hans.xlf deleted file mode 100644 index ed721ca0b..000000000 --- a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.zh-Hans.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - .NET Projects in Solution viewer - 解决方案查看器中的 .NET 项目 - - - - Command to list projects in a solution - 用于列出解决方案中项目的命令 - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.zh-Hant.xlf deleted file mode 100644 index 01551fb1e..000000000 --- a/src/dotnet/commands/dotnet-list/dotnet-list-proj/xlf/LocalizableStrings.zh-Hant.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - .NET Projects in Solution viewer - 解決方案檢視器中的 .NET 專案 - - - - Command to list projects in a solution - 命令,用以列出解決方案中的專案 - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/LocalizableStrings.resx b/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/LocalizableStrings.resx deleted file mode 100644 index 8b30c41cf..000000000 --- a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/LocalizableStrings.resx +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - .NET Remove Project from Solution Command - - - Command to remove projects from a solution - - - Projects to remove from a solution - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.cs.xlf deleted file mode 100644 index 3a0ed224f..000000000 --- a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.cs.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Remove Project from Solution Command - Příkaz rozhraní .NET pro odebrání projektu z řešení - - - - Command to remove projects from a solution - Příkaz pro odebrání projektů z řešení - - - - Projects to remove from a solution - Projekty odebírané z řešení - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.de.xlf deleted file mode 100644 index 6790a8458..000000000 --- a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.de.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Remove Project from Solution Command - .NET-Befehl zum Entfernen des Projekts aus der Projektmappe - - - - Command to remove projects from a solution - Befehl zum Entfernen von Projekten aus einer Projektmappe - - - - Projects to remove from a solution - Aus einer Projektmappe zu entfernende Projekte - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.es.xlf deleted file mode 100644 index ffe8694cb..000000000 --- a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.es.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Remove Project from Solution Command - Comando de .NET Quitar proyecto de la solución - - - - Command to remove projects from a solution - Comando para quitar proyectos de una solución - - - - Projects to remove from a solution - Proyectos que se quitarán de una solución - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.fr.xlf deleted file mode 100644 index fa406f2f1..000000000 --- a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.fr.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Remove Project from Solution Command - Commande .NET de suppression de projet d'une solution - - - - Command to remove projects from a solution - Commande permettant de supprimer des projets d'une solution - - - - Projects to remove from a solution - Projets à supprimer d'une solution - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.it.xlf deleted file mode 100644 index c4c9f26e3..000000000 --- a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.it.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Remove Project from Solution Command - Comando Rimuovi progetto da soluzione .NET - - - - Command to remove projects from a solution - Comando per rimuovere il progetto da una soluzione - - - - Projects to remove from a solution - Progetti da rimuovere da una soluzione - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.ja.xlf deleted file mode 100644 index 57dc722ce..000000000 --- a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.ja.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Remove Project from Solution Command - .NET Remove Project from Solution コマンド - - - - Command to remove projects from a solution - ソリューションからプロジェクトを削除するコマンド - - - - Projects to remove from a solution - ソリューションから削除するプロジェクト - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.ko.xlf deleted file mode 100644 index b96b5595a..000000000 --- a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.ko.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Remove Project from Solution Command - .NET 솔루션에서 프로젝트 제거 명령 - - - - Command to remove projects from a solution - 솔루션에서 프로젝트를 제거하기 위한 명령입니다. - - - - Projects to remove from a solution - 솔루션에서 제거할 프로젝트 - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.pl.xlf deleted file mode 100644 index 0c7a09a93..000000000 --- a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.pl.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Remove Project from Solution Command - Polecenie usuwania projektu z rozwiązania dla platformy .NET - - - - Command to remove projects from a solution - Polecenie służące do usuwania projektów z rozwiązania - - - - Projects to remove from a solution - Projekty do usunięcia z rozwiązania - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.pt-BR.xlf deleted file mode 100644 index 3f9ed9fc3..000000000 --- a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.pt-BR.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Remove Project from Solution Command - Comando para Remover Projetos de uma Solução do .NET - - - - Command to remove projects from a solution - Comando para remover projetos de uma solução - - - - Projects to remove from a solution - Projetos a serem removidos de uma solução - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.ru.xlf deleted file mode 100644 index eba7b97ec..000000000 --- a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.ru.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Remove Project from Solution Command - Команда .NET "Удалить проект из решения" - - - - Command to remove projects from a solution - Команда для удаления проектов из решения - - - - Projects to remove from a solution - Проекты, удаляемые из решения - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.tr.xlf deleted file mode 100644 index e1a65f44c..000000000 --- a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.tr.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Remove Project from Solution Command - .NET Projeyi Çözümden Kaldırma Komutu - - - - Command to remove projects from a solution - Projeleri çözümden kaldırma komutu - - - - Projects to remove from a solution - Bir projeden kaldırılacak çözümler - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.xlf b/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.xlf deleted file mode 100644 index 1cc2436a4..000000000 --- a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.xlf +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - .NET Remove Project from Solution Command - - - - Command to remove projects from a solution - - - - Projects to remove from a solution - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.zh-Hans.xlf deleted file mode 100644 index 9e44a4152..000000000 --- a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.zh-Hans.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Remove Project from Solution Command - .NET 从解决方案中删除项目命令 - - - - Command to remove projects from a solution - 从解决方案中删除项目的命令 - - - - Projects to remove from a solution - 要从解决方案中删除的项目 - - - - - \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.zh-Hant.xlf deleted file mode 100644 index 7325b0fe9..000000000 --- a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/xlf/LocalizableStrings.zh-Hant.xlf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - .NET Remove Project from Solution Command - .NET 從解決方案移除專案命令 - - - - Command to remove projects from a solution - 命令,從解決方案移除專案命令 - - - - Projects to remove from a solution - 要從解決方案移除的專案 - - - - - \ No newline at end of file diff --git a/src/dotnet/dotnet.csproj b/src/dotnet/dotnet.csproj index 35bdbeaf9..6b17fb237 100644 --- a/src/dotnet/dotnet.csproj +++ b/src/dotnet/dotnet.csproj @@ -18,7 +18,6 @@ - @@ -26,7 +25,6 @@ - @@ -34,7 +32,6 @@ - From 2ff85cdd9a8c4e9b3a25b966680dfc7f62cafbc2 Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Tue, 20 Feb 2018 15:15:08 -0800 Subject: [PATCH 052/103] Update description of uninstall command to match install command. This commit updates the help text of the uninstall command to match the install command's help text. --- src/dotnet/commands/dotnet-help/LocalizableStrings.resx | 2 +- src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf | 4 ++-- src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf | 4 ++-- src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf | 4 ++-- src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf | 4 ++-- src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf | 4 ++-- src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf | 4 ++-- src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf | 4 ++-- src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf | 4 ++-- .../commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf | 4 ++-- src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf | 4 ++-- src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf | 4 ++-- .../commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf | 4 ++-- .../commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf | 4 ++-- .../GivenThatIWantToShowHelpForDotnetCommand.cs | 2 +- 15 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/dotnet/commands/dotnet-help/LocalizableStrings.resx b/src/dotnet/commands/dotnet-help/LocalizableStrings.resx index 8b0c84730..77e1429ed 100644 --- a/src/dotnet/commands/dotnet-help/LocalizableStrings.resx +++ b/src/dotnet/commands/dotnet-help/LocalizableStrings.resx @@ -271,6 +271,6 @@ Installs an item into the development environment.
- Uninstalls a tool from the development environment. + Uninstalls an item from the development environment. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf index b348a5041..c7e572fee 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf @@ -258,8 +258,8 @@ - Uninstalls a tool from the development environment. - Uninstalls a tool from the development environment. + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf index c56460685..76a830a57 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf @@ -258,8 +258,8 @@ - Uninstalls a tool from the development environment. - Uninstalls a tool from the development environment. + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf index 6752e1b76..156b555db 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf @@ -258,8 +258,8 @@ - Uninstalls a tool from the development environment. - Uninstalls a tool from the development environment. + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf index d1de6fd3a..0c7b146c3 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf @@ -258,8 +258,8 @@ - Uninstalls a tool from the development environment. - Uninstalls a tool from the development environment. + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf index d6b573506..c82936c0d 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf @@ -258,8 +258,8 @@ - Uninstalls a tool from the development environment. - Uninstalls a tool from the development environment. + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf index 056874d3f..676fb4114 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf @@ -258,8 +258,8 @@ - Uninstalls a tool from the development environment. - Uninstalls a tool from the development environment. + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf index c3dbcdf18..dacf14f0b 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf @@ -258,8 +258,8 @@ - Uninstalls a tool from the development environment. - Uninstalls a tool from the development environment. + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf index 304b215d0..3ef41efc3 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf @@ -258,8 +258,8 @@ - Uninstalls a tool from the development environment. - Uninstalls a tool from the development environment. + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf index a3a00faee..b6356780c 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf @@ -258,8 +258,8 @@ - Uninstalls a tool from the development environment. - Uninstalls a tool from the development environment. + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf index 5a64011ec..392df0743 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf @@ -258,8 +258,8 @@ - Uninstalls a tool from the development environment. - Uninstalls a tool from the development environment. + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf index 0654c6eaa..a168014f1 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf @@ -258,8 +258,8 @@ - Uninstalls a tool from the development environment. - Uninstalls a tool from the development environment. + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf index 78a9319a0..5940a4217 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf @@ -258,8 +258,8 @@ - Uninstalls a tool from the development environment. - Uninstalls a tool from the development environment. + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf index 98b0bb991..2babfcb51 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf @@ -258,8 +258,8 @@ - Uninstalls a tool from the development environment. - Uninstalls a tool from the development environment. + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. diff --git a/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs b/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs index 5c34912ba..f1f26eca6 100644 --- a/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs +++ b/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs @@ -40,7 +40,7 @@ SDK commands: vstest Runs Microsoft Test Execution Command Line Tool. store Stores the specified assemblies in the runtime store. install Installs an item into the development environment. - uninstall Uninstalls a tool from the development environment. + uninstall Uninstalls an item from the development environment. help Show help. Common options: From 8f7b58dd665f60300221a4eb5910a691749396aa Mon Sep 17 00:00:00 2001 From: Jeff Kluge Date: Tue, 27 Feb 2018 13:59:59 -0800 Subject: [PATCH 053/103] Move some projects to netstandard2.0 (#8692) * Move some projects to netstandard2.0 * Use version agnostic $(TargetFrameworkIdentifier) property to make changing versions easier since we only care about .NET Framework vs .NET Standard * Add missing project to solution file * Update TestPackageProjects.targets to use netstandard2.0 on non-Windows --- Microsoft.DotNet.Cli.sln | 82 +++++++++++++------ build/test/TestPackageProjects.targets | 2 +- .../Microsoft.DotNet.Cli.Sln.Internal.csproj | 4 +- .../Microsoft.DotNet.Cli.Utils.csproj | 9 +- .../Microsoft.DotNet.Configurer.csproj | 2 +- ...crosoft.DotNet.InternalAbstractions.csproj | 2 +- .../Interop.NETStandard.cs | 4 +- .../MSBuildSdkResolver.cs | 2 +- ...Microsoft.DotNet.MSBuildSdkResolver.csproj | 15 ++-- src/dotnet/dotnet.csproj | 2 +- .../Microsoft.DotNet.Cli.Msi.Tests.csproj | 2 +- ...oft.DotNet.MSBuildSdkResolver.Tests.csproj | 2 +- .../Microsoft.DotNet.TestFramework.csproj | 4 +- ...rosoft.DotNet.Tools.Tests.Utilities.csproj | 4 +- 14 files changed, 85 insertions(+), 51 deletions(-) diff --git a/Microsoft.DotNet.Cli.sln b/Microsoft.DotNet.Cli.sln index c9bddd009..855541357 100644 --- a/Microsoft.DotNet.Cli.sln +++ b/Microsoft.DotNet.Cli.sln @@ -1,4 +1,5 @@ -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,7 +237,9 @@ 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}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-install-tool.Tests", "test\dotnet-install-tool.Tests\dotnet-install-tool.Tests.csproj", "{8FE9D802-57F3-493B-9E14-72DF905E3838}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.MSBuildSdkResolver.Tests", "test\Microsoft.DotNet.MSBuildSdkResolver.Tests\Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj", "{B7C82980-F01D-4B8A-A746-BFA0032CB152}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -1646,30 +1649,6 @@ Global {91BFE800-1624-4A58-A1CE-339705A8FFD0}.RelWithDebInfo|x64.Build.0 = Release|Any CPU {91BFE800-1624-4A58-A1CE-339705A8FFD0}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU {91BFE800-1624-4A58-A1CE-339705A8FFD0}.RelWithDebInfo|x86.Build.0 = Release|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Debug|x64.ActiveCfg = Debug|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Debug|x64.Build.0 = Debug|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Debug|x86.ActiveCfg = Debug|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Debug|x86.Build.0 = Debug|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.MinSizeRel|Any CPU.ActiveCfg = Release|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.MinSizeRel|Any CPU.Build.0 = Release|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.MinSizeRel|x64.ActiveCfg = Release|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.MinSizeRel|x64.Build.0 = Release|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.MinSizeRel|x86.ActiveCfg = Release|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.MinSizeRel|x86.Build.0 = Release|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Release|Any CPU.Build.0 = Release|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Release|x64.ActiveCfg = Release|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Release|x64.Build.0 = Release|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Release|x86.ActiveCfg = Release|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Release|x86.Build.0 = Release|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU - {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.RelWithDebInfo|x86.Build.0 = Release|Any CPU {E442F4C1-08DB-470F-B9A6-197444CD0295}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E442F4C1-08DB-470F-B9A6-197444CD0295}.Debug|Any CPU.Build.0 = Debug|Any CPU {E442F4C1-08DB-470F-B9A6-197444CD0295}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -1694,6 +1673,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 + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Debug|x64.ActiveCfg = Debug|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Debug|x64.Build.0 = Debug|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Debug|x86.ActiveCfg = Debug|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Debug|x86.Build.0 = Debug|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.MinSizeRel|Any CPU.ActiveCfg = Release|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.MinSizeRel|Any CPU.Build.0 = Release|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.MinSizeRel|x64.ActiveCfg = Release|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.MinSizeRel|x64.Build.0 = Release|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.MinSizeRel|x86.ActiveCfg = Release|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.MinSizeRel|x86.Build.0 = Release|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Release|Any CPU.Build.0 = Release|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Release|x64.ActiveCfg = Release|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Release|x64.Build.0 = Release|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Release|x86.ActiveCfg = Release|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.Release|x86.Build.0 = Release|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5}.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 @@ -1718,6 +1721,30 @@ Global {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 + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.Debug|x64.ActiveCfg = Debug|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.Debug|x64.Build.0 = Debug|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.Debug|x86.ActiveCfg = Debug|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.Debug|x86.Build.0 = Debug|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.MinSizeRel|x86.ActiveCfg = Debug|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.MinSizeRel|x86.Build.0 = Debug|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.Release|Any CPU.Build.0 = Release|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.Release|x64.ActiveCfg = Release|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.Release|x64.Build.0 = Release|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.Release|x86.ActiveCfg = Release|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.Release|x86.Build.0 = Release|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU + {B7C82980-F01D-4B8A-A746-BFA0032CB152}.RelWithDebInfo|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1791,9 +1818,10 @@ Global {E7C72EF2-8480-48B4-AAE8-A596F1A6048E} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {E84C08C9-70D7-48B0-9507-ADB8B9A2694C} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {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} + {EDF19BE6-F20F-4AD0-8E3B-E837030726A5} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} {8FE9D802-57F3-493B-9E14-72DF905E3838} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} + {B7C82980-F01D-4B8A-A746-BFA0032CB152} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B526D2CE-EE2D-4AD4-93EF-1867D90FF1F5} diff --git a/build/test/TestPackageProjects.targets b/build/test/TestPackageProjects.targets index fea46690c..bb280358a 100644 --- a/build/test/TestPackageProjects.targets +++ b/build/test/TestPackageProjects.targets @@ -39,7 +39,7 @@ $(CliVersionPrefix) $(VersionSuffix) False - /p:TargetFramework=netstandard1.5 + /p:TargetFramework=netstandard2.0 Microsoft.DotNet.InternalAbstractions diff --git a/src/Microsoft.DotNet.Cli.Sln.Internal/Microsoft.DotNet.Cli.Sln.Internal.csproj b/src/Microsoft.DotNet.Cli.Sln.Internal/Microsoft.DotNet.Cli.Sln.Internal.csproj index 2120e657e..18a54fe7a 100644 --- a/src/Microsoft.DotNet.Cli.Sln.Internal/Microsoft.DotNet.Cli.Sln.Internal.csproj +++ b/src/Microsoft.DotNet.Cli.Sln.Internal/Microsoft.DotNet.Cli.Sln.Internal.csproj @@ -3,7 +3,7 @@ SLN file reader/writer $(CliVersionPrefix) - netstandard1.6 + netstandard2.0 portable Microsoft.DotNet.Cli.Sln.Internal ../../tools/Key.snk @@ -22,7 +22,7 @@ - + diff --git a/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj b/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj index c7c98b98b..0a124d605 100644 --- a/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj +++ b/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj @@ -2,8 +2,8 @@ $(SdkVersion) - netstandard1.5;net46 - netstandard1.5 + netstandard2.0;net46 + netstandard2.0 true ../../tools/Key.snk true @@ -27,11 +27,12 @@ - + + - + diff --git a/src/Microsoft.DotNet.Configurer/Microsoft.DotNet.Configurer.csproj b/src/Microsoft.DotNet.Configurer/Microsoft.DotNet.Configurer.csproj index bac6b0f9f..a393f7926 100644 --- a/src/Microsoft.DotNet.Configurer/Microsoft.DotNet.Configurer.csproj +++ b/src/Microsoft.DotNet.Configurer/Microsoft.DotNet.Configurer.csproj @@ -2,7 +2,7 @@ $(CliVersionPrefix) - netstandard1.5 + netstandard2.0 true ../../tools/Key.snk true diff --git a/src/Microsoft.DotNet.InternalAbstractions/Microsoft.DotNet.InternalAbstractions.csproj b/src/Microsoft.DotNet.InternalAbstractions/Microsoft.DotNet.InternalAbstractions.csproj index c4c930565..6931a805f 100644 --- a/src/Microsoft.DotNet.InternalAbstractions/Microsoft.DotNet.InternalAbstractions.csproj +++ b/src/Microsoft.DotNet.InternalAbstractions/Microsoft.DotNet.InternalAbstractions.csproj @@ -17,7 +17,7 @@ - + diff --git a/src/Microsoft.DotNet.MSBuildSdkResolver/Interop.NETStandard.cs b/src/Microsoft.DotNet.MSBuildSdkResolver/Interop.NETStandard.cs index b672a5dfb..245f153a0 100644 --- a/src/Microsoft.DotNet.MSBuildSdkResolver/Interop.NETStandard.cs +++ b/src/Microsoft.DotNet.MSBuildSdkResolver/Interop.NETStandard.cs @@ -5,7 +5,7 @@ // The netstandard1.5 adaptation here acts a proof-of-concept for cross-platform // portability of the underlying hostfxr API and gives us build and test coverage // on non-Windows machines. It also ships with msbuild on Mono. -#if NETSTANDARD1_5 +#if NETSTANDARD2_0 using System; using System.Runtime.InteropServices; @@ -50,4 +50,4 @@ namespace Microsoft.DotNet.MSBuildSdkResolver } } -#endif // NETSTANDARD1_5 \ No newline at end of file +#endif // NETSTANDARD2_0 diff --git a/src/Microsoft.DotNet.MSBuildSdkResolver/MSBuildSdkResolver.cs b/src/Microsoft.DotNet.MSBuildSdkResolver/MSBuildSdkResolver.cs index 08a552479..a115a867b 100644 --- a/src/Microsoft.DotNet.MSBuildSdkResolver/MSBuildSdkResolver.cs +++ b/src/Microsoft.DotNet.MSBuildSdkResolver/MSBuildSdkResolver.cs @@ -176,7 +176,7 @@ namespace Microsoft.DotNet.MSBuildSdkResolver var environmentProvider = new EnvironmentProvider(_getEnvironmentVariable); var dotnetExe = environmentProvider.GetCommandPath("dotnet"); -#if NETSTANDARD1_5 +#if NETSTANDARD2_0 if (dotnetExe != null && !Interop.RunningOnWindows) { // e.g. on Linux the 'dotnet' command from PATH is a symlink so we need to diff --git a/src/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.csproj b/src/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.csproj index 205a6a28b..2b8b1b320 100644 --- a/src/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.csproj +++ b/src/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.csproj @@ -2,8 +2,8 @@ $(SdkVersion) - netstandard1.5;net46 - netstandard1.5 + netstandard2.0;net46 + netstandard2.0 AnyCPU win-x86;win-x64 true @@ -19,11 +19,16 @@ - - + + - + + + + + + x86/hostfxr.dll diff --git a/src/dotnet/dotnet.csproj b/src/dotnet/dotnet.csproj index 35bdbeaf9..39f985fb3 100644 --- a/src/dotnet/dotnet.csproj +++ b/src/dotnet/dotnet.csproj @@ -52,7 +52,7 @@ - + diff --git a/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/Microsoft.DotNet.Cli.Msi.Tests.csproj b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/Microsoft.DotNet.Cli.Msi.Tests.csproj index 28ccae43e..e4f8c5130 100644 --- a/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/Microsoft.DotNet.Cli.Msi.Tests.csproj +++ b/test/Installer/Microsoft.DotNet.Cli.Msi.Tests/Microsoft.DotNet.Cli.Msi.Tests.csproj @@ -20,7 +20,7 @@ - + diff --git a/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj b/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj index ddc1601cf..4ef6f641c 100644 --- a/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj +++ b/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj @@ -28,7 +28,7 @@ - + diff --git a/test/Microsoft.DotNet.TestFramework/Microsoft.DotNet.TestFramework.csproj b/test/Microsoft.DotNet.TestFramework/Microsoft.DotNet.TestFramework.csproj index d9663e868..9847dbb6f 100644 --- a/test/Microsoft.DotNet.TestFramework/Microsoft.DotNet.TestFramework.csproj +++ b/test/Microsoft.DotNet.TestFramework/Microsoft.DotNet.TestFramework.csproj @@ -3,11 +3,11 @@ Microsoft.DotNet.TestFramework Class Library $(CliVersionPrefix) - netstandard1.5 + netstandard2.0 ../../tools/Key.snk true true - 1.6.0 + 2.0.0 diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj b/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj index 903f12736..3db4f07af 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj @@ -1,13 +1,13 @@  Microsoft.DotNet.Tools.Tests.Utilities Class Library - netstandard1.5 + netstandard2.0 Microsoft.DotNet.Tools.Tests.Utilities ../../tools/Key.snk true true $(AssetTargetFallback);dotnet5.4;portable-net451+win8 - 1.6.0 + 2.0.0 From 9ef495327aeede9e6ef4251615544cb280af78bf Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Sun, 25 Feb 2018 17:22:11 -0800 Subject: [PATCH 054/103] Implement a printable table. This commit implements a simple printable table that can be used to display tabular data. The columns of the table can specify a maximum width which will cause the column text to wrap around to the next line. --- src/dotnet/CommonLocalizableStrings.resx | 3 + src/dotnet/PrintableTable.cs | 226 ++++++++++ .../xlf/CommonLocalizableStrings.cs.xlf | 5 + .../xlf/CommonLocalizableStrings.de.xlf | 5 + .../xlf/CommonLocalizableStrings.es.xlf | 5 + .../xlf/CommonLocalizableStrings.fr.xlf | 5 + .../xlf/CommonLocalizableStrings.it.xlf | 5 + .../xlf/CommonLocalizableStrings.ja.xlf | 5 + .../xlf/CommonLocalizableStrings.ko.xlf | 5 + .../xlf/CommonLocalizableStrings.pl.xlf | 5 + .../xlf/CommonLocalizableStrings.pt-BR.xlf | 5 + .../xlf/CommonLocalizableStrings.ru.xlf | 5 + .../xlf/CommonLocalizableStrings.tr.xlf | 5 + .../xlf/CommonLocalizableStrings.zh-Hans.xlf | 5 + .../xlf/CommonLocalizableStrings.zh-Hant.xlf | 5 + test/dotnet.Tests/PrintableTableTests.cs | 420 ++++++++++++++++++ 16 files changed, 714 insertions(+) create mode 100644 src/dotnet/PrintableTable.cs create mode 100644 test/dotnet.Tests/PrintableTableTests.cs diff --git a/src/dotnet/CommonLocalizableStrings.resx b/src/dotnet/CommonLocalizableStrings.resx index fd28bb3cf..ea905e472 100644 --- a/src/dotnet/CommonLocalizableStrings.resx +++ b/src/dotnet/CommonLocalizableStrings.resx @@ -619,4 +619,7 @@ setx PATH "%PATH%;{0}" Tool '{0}' (version '{1}') is already installed. + + Column maximum width must be greater than zero. + diff --git a/src/dotnet/PrintableTable.cs b/src/dotnet/PrintableTable.cs new file mode 100644 index 000000000..ce31e13cc --- /dev/null +++ b/src/dotnet/PrintableTable.cs @@ -0,0 +1,226 @@ +// 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 System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using Microsoft.DotNet.Tools; + +namespace Microsoft.DotNet.Cli +{ + // Represents a table (with rows of type T) that can be printed to a terminal. + internal class PrintableTable + { + private const string ColumnDelimiter = " "; + private List _columns = new List(); + + private class Column + { + public string Header { get; set; } + public Func GetContent { get; set; } + public int MaxWidth { get; set; } + public override string ToString() { return Header; } + } + + public void AddColumn(string header, Func getContent, int maxWidth = int.MaxValue) + { + if (getContent == null) + { + throw new ArgumentNullException(nameof(getContent)); + } + + if (maxWidth <= 0) + { + throw new ArgumentException( + CommonLocalizableStrings.ColumnMaxWidthMustBeGreaterThanZero, + nameof(maxWidth)); + } + + _columns.Add( + new Column() { + Header = header, + GetContent = getContent, + MaxWidth = maxWidth + }); + } + + public void PrintRows(IEnumerable rows, Action writeLine) + { + if (rows == null) + { + throw new ArgumentNullException(nameof(rows)); + } + + if (writeLine == null) + { + throw new ArgumentNullException(nameof(writeLine)); + } + + var widths = CalculateColumnWidths(rows); + var totalWidth = CalculateTotalWidth(widths); + if (totalWidth == 0) + { + return; + } + + foreach (var line in EnumerateHeaderLines(widths)) + { + writeLine(line); + } + + writeLine(new string('-', totalWidth)); + + foreach (var row in rows) + { + foreach (var line in EnumerateRowLines(row, widths)) + { + writeLine(line); + } + } + } + + public int CalculateWidth(IEnumerable rows) + { + if (rows == null) + { + throw new ArgumentNullException(nameof(rows)); + } + + return CalculateTotalWidth(CalculateColumnWidths(rows)); + } + + private IEnumerable EnumerateHeaderLines(int[] widths) + { + if (_columns.Count != widths.Length) + { + throw new InvalidOperationException(); + } + + return EnumerateLines( + widths, + _columns.Select(c => new StringInfo(c.Header ?? "")).ToArray()); + } + + private IEnumerable EnumerateRowLines(T row, int[] widths) + { + if (_columns.Count != widths.Length) + { + throw new InvalidOperationException(); + } + + return EnumerateLines( + widths, + _columns.Select(c => new StringInfo(c.GetContent(row) ?? "")).ToArray()); + } + + private static IEnumerable EnumerateLines(int[] widths, StringInfo[] contents) + { + if (widths.Length != contents.Length) + { + throw new InvalidOperationException(); + } + + if (contents.Length == 0) + { + yield break; + } + + var builder = new StringBuilder(); + for (int line = 0; true; ++line) + { + builder.Clear(); + + bool emptyLine = true; + bool appendDelimiter = false; + for (int i = 0; i < contents.Length; ++i) + { + // Skip zero-width columns entirely + if (widths[i] == 0) + { + continue; + } + + if (appendDelimiter) + { + builder.Append(ColumnDelimiter); + } + + var startIndex = line * widths[i]; + var length = contents[i].LengthInTextElements; + if (startIndex < length) + { + var endIndex = (line + 1) * widths[i]; + length = endIndex >= length ? length - startIndex : widths[i]; + builder.Append(contents[i].SubstringByTextElements(startIndex, length)); + builder.Append(' ', widths[i] - length); + emptyLine = false; + } + else + { + // No more content for this column; append whitespace to fill remaining space + builder.Append(' ', widths[i]); + } + + appendDelimiter = true; + } + + if (emptyLine) + { + // Yield an "empty" line on the first line only + if (line == 0) + { + yield return builder.ToString(); + } + yield break; + } + + yield return builder.ToString(); + } + } + + private int[] CalculateColumnWidths(IEnumerable rows) + { + return _columns + .Select(c => { + var width = new StringInfo(c.Header ?? "").LengthInTextElements; + + foreach (var row in rows) + { + width = Math.Max( + width, + new StringInfo(c.GetContent(row) ?? "").LengthInTextElements); + } + + return Math.Min(width, c.MaxWidth); + }) + .ToArray(); + } + + private static int CalculateTotalWidth(int[] widths) + { + int sum = 0; + int count = 0; + + foreach (var width in widths) + { + if (width == 0) + { + // Skip zero-width columns + continue; + } + + sum += width; + ++count; + } + + if (count == 0) + { + return 0; + } + + return sum + (ColumnDelimiter.Length * (count - 1)); + } + } +} diff --git a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf index 474394e5b..cde9c4124 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf @@ -848,6 +848,11 @@ setx PATH "%PATH%;{0}" Failed to uninstall tool package '{0}': {1} + + Column maximum width must be greater than zero. + Column maximum width must be greater than zero. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf index a197419e5..2ea94a468 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf @@ -848,6 +848,11 @@ setx PATH "%PATH%;{0}" Failed to uninstall tool package '{0}': {1} + + Column maximum width must be greater than zero. + Column maximum width must be greater than zero. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf index e19eba9aa..0b2245c24 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf @@ -848,6 +848,11 @@ setx PATH "%PATH%;{0}" Failed to uninstall tool package '{0}': {1} + + Column maximum width must be greater than zero. + Column maximum width must be greater than zero. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf index d9252cd95..347fa1778 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf @@ -848,6 +848,11 @@ setx PATH "%PATH%;{0}" Failed to uninstall tool package '{0}': {1} + + Column maximum width must be greater than zero. + Column maximum width must be greater than zero. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf index f02329445..888a733b7 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf @@ -848,6 +848,11 @@ setx PATH "%PATH%;{0}" Failed to uninstall tool package '{0}': {1} + + Column maximum width must be greater than zero. + Column maximum width must be greater than zero. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf index b5938c333..9fe190d9c 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf @@ -848,6 +848,11 @@ setx PATH "%PATH%;{0}" Failed to uninstall tool package '{0}': {1} + + Column maximum width must be greater than zero. + Column maximum width must be greater than zero. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf index 99f97468e..0055c89c2 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf @@ -848,6 +848,11 @@ setx PATH "%PATH%;{0}" Failed to uninstall tool package '{0}': {1} + + Column maximum width must be greater than zero. + Column maximum width must be greater than zero. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf index e86850a1a..84ab68ba8 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf @@ -848,6 +848,11 @@ setx PATH "%PATH%;{0}" Failed to uninstall tool package '{0}': {1} + + Column maximum width must be greater than zero. + Column maximum width must be greater than zero. + + \ 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 1e77c8746..93c4e1338 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf @@ -848,6 +848,11 @@ setx PATH "%PATH%;{0}" Failed to uninstall tool package '{0}': {1} + + Column maximum width must be greater than zero. + Column maximum width must be greater than zero. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf index 2804b423c..8f686a333 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf @@ -848,6 +848,11 @@ setx PATH "%PATH%;{0}" Failed to uninstall tool package '{0}': {1} + + Column maximum width must be greater than zero. + Column maximum width must be greater than zero. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf index 3d6889704..22d6637a9 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf @@ -848,6 +848,11 @@ setx PATH "%PATH%;{0}" Failed to uninstall tool package '{0}': {1} + + Column maximum width must be greater than zero. + Column maximum width must be greater than zero. + + \ 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 d6bd07db3..14b24e453 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf @@ -848,6 +848,11 @@ setx PATH "%PATH%;{0}" Failed to uninstall tool package '{0}': {1} + + Column maximum width must be greater than zero. + Column maximum width must be greater than zero. + + \ 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 52f904b87..01e11d97a 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf @@ -848,6 +848,11 @@ setx PATH "%PATH%;{0}" Failed to uninstall tool package '{0}': {1} + + Column maximum width must be greater than zero. + Column maximum width must be greater than zero. + + \ No newline at end of file diff --git a/test/dotnet.Tests/PrintableTableTests.cs b/test/dotnet.Tests/PrintableTableTests.cs new file mode 100644 index 000000000..68737e541 --- /dev/null +++ b/test/dotnet.Tests/PrintableTableTests.cs @@ -0,0 +1,420 @@ +// 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 System.Collections.Generic; +using FluentAssertions; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Tools.Test.Utilities; +using Xunit; + +namespace Microsoft.DotNet.Tests +{ + public class PrintableTableTests : TestBase + { + [Fact] + public void GivenNoColumnsItPrintsNoLines() + { + var table = new PrintableTable(); + + var lines = new List(); + table.PrintRows(new string[][] {}, l => lines.Add(l)); + + lines.Should().BeEmpty(); + } + + [Fact] + public void GivenAnEmptyRowsCollectionItPrintsColumnHeaders() + { + RunTest(new TestData() { + Columns = new[] { + "First Column", + "2nd Column", + "Another Column" + }, + Rows = new string[][] { + }, + ExpectedLines = new[] { + "First Column 2nd Column Another Column", + "------------------------------------------------" + }, + ExpectedTableWidth = 48 + }); + } + + [Fact] + public void GivenASingleRowItPrintsCorrectly() + { + RunTest(new TestData() { + Columns = new[] { + "1st", + "2nd", + "3rd" + }, + Rows = new string[][] { + new[] { + "first", + "second", + "third" + } + }, + ExpectedLines = new[] { + "1st 2nd 3rd ", + "----------------------------", + "first second third" + }, + ExpectedTableWidth = 28 + }); + } + + [Fact] + public void GivenMultipleRowsItPrintsCorrectly() + { + RunTest(new TestData() { + Columns = new[] { + "First", + "Second", + "Third", + "Fourth", + "Fifth" + }, + Rows = new string[][] { + new[] { + "1st", + "2nd", + "3rd", + "4th", + "5th" + }, + new [] { + "a", + "b", + "c", + "d", + "e" + }, + new [] { + "much longer string 1", + "much longer string 2", + "much longer string 3", + "much longer string 4", + "much longer string 5", + } + }, + ExpectedLines = new[] { + "First Second Third Fourth Fifth ", + "----------------------------------------------------------------------------------------------------------------------------", + "1st 2nd 3rd 4th 5th ", + "a b c d e ", + "much longer string 1 much longer string 2 much longer string 3 much longer string 4 much longer string 5" + }, + ExpectedTableWidth = 124 + }); + } + + [Fact] + public void GivenARowWithEmptyStringsItPrintsCorrectly() + { + RunTest(new TestData() { + Columns = new[] { + "First", + "Second", + "Third", + "Fourth", + "Fifth" + }, + Rows = new string[][] { + new[] { + "1st", + "2nd", + "3rd", + "4th", + "5th" + }, + new [] { + "", + "", + "", + "", + "" + }, + new [] { + "much longer string 1", + "much longer string 2", + "much longer string 3", + "much longer string 4", + "much longer string 5", + } + }, + ExpectedLines = new[] { + "First Second Third Fourth Fifth ", + "----------------------------------------------------------------------------------------------------------------------------", + "1st 2nd 3rd 4th 5th ", + " ", + "much longer string 1 much longer string 2 much longer string 3 much longer string 4 much longer string 5" + }, + ExpectedTableWidth = 124 + }); + } + + [Fact] + public void GivenColumnsWithMaximumWidthsItPrintsCorrectly() + { + RunTest(new TestData() { + Columns = new[] { + "First", + "Second", + "Third", + }, + ColumnWidths = new[] { + 3, + int.MaxValue, + 4 + }, + Rows = new string[][] { + new[] { + "123", + "1234567890", + "1234" + }, + new [] { + "1", + "1", + "1", + }, + new [] { + "12345", + "a much longer string", + "1234567890" + }, + new [] { + "123456", + "hello world", + "12345678" + } + }, + ExpectedLines = new[] { + "Fir Second Thir", + "st d ", + "---------------------------------------", + "123 1234567890 1234", + "1 1 1 ", + "123 a much longer string 1234", + "45 5678", + " 90 ", + "123 hello world 1234", + "456 5678" + }, + ExpectedTableWidth = 39 + }); + } + + [Fact] + public void GivenARowContainingUnicodeCharactersItPrintsCorrectly() + { + RunTest(new TestData() { + Columns = new[] { + "Poem" + }, + Rows = new string[][] { + new [] { + "\u3044\u308D\u306F\u306B\u307B\u3078\u3068\u3061\u308A\u306C\u308B\u3092" + } + }, + ExpectedLines = new[] { + "Poem ", + "------------", + "\u3044\u308D\u306F\u306B\u307B\u3078\u3068\u3061\u308A\u306C\u308B\u3092" + }, + ExpectedTableWidth = 12 + }); + } + + [Fact] + public void GivenARowContainingUnicodeCharactersItWrapsCorrectly() + { + RunTest(new TestData() { + Columns = new[] { + "Poem" + }, + ColumnWidths = new [] { + 5 + }, + Rows = new string[][] { + new [] { + "\u3044\u308D\u306F\u306B\u307B\u3078\u3068\u3061\u308A\u306C\u308B\u3092" + } + }, + ExpectedLines = new[] { + "Poem ", + "-----", + "\u3044\u308D\u306F\u306B\u307B", + "\u3078\u3068\u3061\u308A\u306C", + "\u308B\u3092 " + }, + ExpectedTableWidth = 5 + }); + } + + [Fact] + public void GivenARowContainingUnicodeCombiningCharactersItPrintsCorrectly() + { + // The unicode string is "test" with "enclosing circle backslash" around each character + // Given 0x20E0 is a combining character, the string should be four graphemes in length, + // despite having eight codepoints. Thus there should be 10 spaces following the characters. + RunTest(new TestData() { + Columns = new[] { + "Unicode String" + }, + Rows = new string[][] { + new [] { + "\u0074\u20E0\u0065\u20E0\u0073\u20E0\u0074\u20E0" + } + }, + ExpectedLines = new[] { + "Unicode String", + "--------------", + "\u0074\u20E0\u0065\u20E0\u0073\u20E0\u0074\u20E0 " + }, + ExpectedTableWidth = 14 + }); + } + + [Fact] + public void GivenARowContainingUnicodeCombiningCharactersItWrapsCorrectly() + { + // See comment for GivenARowContainingUnicodeCombiningCharactersItPrintsCorrectly regarding string content + // This should wrap after the second grapheme rather than the second code point (constituting the first grapheme) + RunTest(new TestData() { + Columns = new[] { + "01" + }, + ColumnWidths = new[] { + 2 + }, + Rows = new string[][] { + new [] { + "\u0074\u20E0\u0065\u20E0\u0073\u20E0\u0074\u20E0" + } + }, + ExpectedLines = new[] { + "01", + "--", + "\u0074\u20E0\u0065\u20E0", + "\u0073\u20E0\u0074\u20E0" + }, + ExpectedTableWidth = 2 + }); + } + + [Fact] + public void GivenAnEmptyColumnHeaderItPrintsTheColumnHeaderAsEmpty() + { + RunTest(new TestData() { + Columns = new[] { + "First", + "", + "Third", + }, + Rows = new string[][] { + new[] { + "1st", + "2nd", + "3rd" + } + }, + ExpectedLines = new[] { + "First Third", + "-------------------------", + "1st 2nd 3rd " + }, + ExpectedTableWidth = 25 + }); + } + + [Fact] + public void GivenAllEmptyColumnHeadersItPrintsTheEntireHeaderAsEmpty() + { + RunTest(new TestData() { + Columns = new[] { + null, + "", + null, + }, + Rows = new string[][] { + new[] { + "1st", + "2nd", + "3rd" + } + }, + ExpectedLines = new[] { + " ", + "---------------------", + "1st 2nd 3rd" + }, + ExpectedTableWidth = 21 + }); + } + + [Fact] + public void GivenZeroWidthColumnsItSkipsTheColumns() + { + RunTest(new TestData() { + Columns = new[] { + "", + "First", + null, + "Second", + "" + }, + Rows = new string[][] { + new[] { + "", + "1st", + null, + "2nd", + "" + } + }, + ExpectedLines = new[] { + "First Second", + "-----------------", + "1st 2nd " + }, + ExpectedTableWidth = 17 + }); + } + + public class TestData + { + public IEnumerable Columns { get; set; } + public int[] ColumnWidths { get; set; } + public IEnumerable Rows { get; set; } + public IEnumerable ExpectedLines { get; set; } + public int ExpectedTableWidth { get; set; } + } + + private void RunTest(TestData data) + { + var table = new PrintableTable(); + + int index = 0; + foreach (var column in data.Columns) + { + var i = index; + table.AddColumn( + column, + r => r[i], + data.ColumnWidths?[i] ?? int.MaxValue); + ++index; + } + + var lines = new List(); + table.PrintRows(data.Rows, l => lines.Add(l)); + + lines.Should().Equal(data.ExpectedLines); + table.CalculateWidth(data.Rows).Should().Be(data.ExpectedTableWidth); + } + } +} From 6944a40878da122e6bf72dae05d017fc63ee2a15 Mon Sep 17 00:00:00 2001 From: Jeff Kluge Date: Tue, 27 Feb 2018 17:53:54 -0800 Subject: [PATCH 055/103] MSBuild 15.7.63 (#8696) * Update package version to 15.7.0-preview-000063 * Add dotnet.myget.org msbuild feed --- build/DependencyVersions.props | 2 +- build/NugetConfigFile.targets | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index a82e69839..258fd2e3e 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -4,7 +4,7 @@ 2.1.0-preview2-30171 2.1.0-preview2-26131-06 $(MicrosoftNETCoreAppPackageVersion) - 15.6.82 + 15.7.0-preview-000063 $(MicrosoftBuildPackageVersion) $(MicrosoftBuildPackageVersion) $(MicrosoftBuildPackageVersion) diff --git a/build/NugetConfigFile.targets b/build/NugetConfigFile.targets index 77318c3a9..c8c39b805 100644 --- a/build/NugetConfigFile.targets +++ b/build/NugetConfigFile.targets @@ -31,6 +31,7 @@ + ]]> From f9c40ce94d7ced870ad48026d35022d56acbb6f4 Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Tue, 27 Feb 2018 18:55:35 -0800 Subject: [PATCH 056/103] Log Windows product type and installation type, and Linux libc version (#8688) * Installation type * Product Type * Libc Release and Version * Catch all * Fix test * Fix mac test * Extract class * Remove CharSet * Remove extraneous assignment * Missing space * Typo * Fix comment XML * CR feedback --- .../Telemetry/ExternalTelemetryProperties.cs | 134 ++++++++++++++++++ .../Telemetry/TelemetryCommonProperties.cs | 14 +- .../UnixOnlyFactAttribute.cs | 19 +++ .../TelemetryCommonPropertiesTests.cs | 55 +++++++ 4 files changed, 221 insertions(+), 1 deletion(-) create mode 100644 src/dotnet/Telemetry/ExternalTelemetryProperties.cs create mode 100644 test/Microsoft.DotNet.Tools.Tests.Utilities/UnixOnlyFactAttribute.cs diff --git a/src/dotnet/Telemetry/ExternalTelemetryProperties.cs b/src/dotnet/Telemetry/ExternalTelemetryProperties.cs new file mode 100644 index 000000000..42a2ad9fc --- /dev/null +++ b/src/dotnet/Telemetry/ExternalTelemetryProperties.cs @@ -0,0 +1,134 @@ +// 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 System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Security; +using Microsoft.DotNet.PlatformAbstractions; +using Microsoft.Win32; +using RuntimeEnvironment = Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment; +using System.Runtime.InteropServices; +using System.Diagnostics; + +namespace Microsoft.DotNet.Cli.Telemetry +{ + // Some properties we need for telemetry, that don't yet have suitable + // public API + internal static class ExternalTelemetryProperties + { + /// + /// For Windows, returns the OS installation type, eg. "Nano Server", "Server Core", "Server", or "Client". + /// For Unix, or on error, currently returns empty string. + /// + internal static string GetInstallationType() + { + if (RuntimeEnvironment.OperatingSystemPlatform != Platform.Windows) + { + return ""; + } + + const string Key = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion"; + const string ValueName = @"InstallationType"; + + try + { + return (string)Registry.GetValue(Key, ValueName, defaultValue: ""); + } + // Catch everything: this is for telemetry only. + catch (Exception e) + { + Debug.Assert(e is ArgumentException | e is SecurityException | e is InvalidCastException); + return ""; + } + } + + [DllImport("kernel32.dll", ExactSpelling = true, SetLastError = false)] + private static extern bool GetProductInfo(uint dwOSMajorVersion, uint dwOSMinorVersion, uint dwSpMajorVersion, uint dwSpMinorVersion, out uint pdwReturnedProductType); + + /// + /// For Windows, returns the product type, loosely the SKU, as encoded by GetProductInfo(). + /// For example, Enterprise is "4" (0x4) and Professional is "48" (0x30) + /// See https://msdn.microsoft.com/en-us/library/windows/desktop/ms724358(v=vs.85).aspx for the full list. + /// We're not attempting to decode the value on the client side as new Windows releases may add new values. + /// For Unix, or on error, returns an empty string. + /// + internal static string GetProductType() + { + if (RuntimeEnvironment.OperatingSystemPlatform != Platform.Windows) + { + return ""; + } + + try + { + if (GetProductInfo((uint)Environment.OSVersion.Version.Major, (uint)Environment.OSVersion.Version.Minor, 0, 0, out uint productType)) + { + return productType.ToString("D", CultureInfo.InvariantCulture); + } + } + // Catch everything: this is for telemetry only + catch (Exception e) + { + Debug.Assert(false, $"Unexpected exception from GetProductInfo: ${e.GetType().Name}: ${e.Message}"); + } + + return ""; + } + + [DllImport("libc", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] + private static extern IntPtr gnu_get_libc_release(); + + [DllImport("libc", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] + private static extern IntPtr gnu_get_libc_version(); + + /// + /// If gnulibc is available, returns the release, such as "stable". + /// If the libc is musl, currently returns empty string. + /// Otherwise returns empty string. + /// + internal static string GetLibcRelease() + { + if (RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows) + { + return ""; + } + + try + { + return Marshal.PtrToStringUTF8(gnu_get_libc_release()); + } + // Catch everything: this is for telemetry only + catch (Exception e) + { + Debug.Assert(e is DllNotFoundException || e is EntryPointNotFoundException); + return ""; + } + } + + /// + /// If gnulibc is available, returns the version, such as "2.22". + /// If the libc is musl, currently returns empty string. (In future could run "ldd -version".) + /// Otherwise returns empty string. + /// + internal static string GetLibcVersion() + { + if (RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows) + { + return ""; + } + + try + { + return Marshal.PtrToStringUTF8(gnu_get_libc_version()); + } + // Catch everything: this is for telemetry only + catch (Exception e) + { + Debug.Assert(e is DllNotFoundException || e is EntryPointNotFoundException); + return ""; + } + } + } +} \ No newline at end of file diff --git a/src/dotnet/Telemetry/TelemetryCommonProperties.cs b/src/dotnet/Telemetry/TelemetryCommonProperties.cs index 6cbf02b47..a37cd70ef 100644 --- a/src/dotnet/Telemetry/TelemetryCommonProperties.cs +++ b/src/dotnet/Telemetry/TelemetryCommonProperties.cs @@ -6,10 +6,14 @@ using System.Collections.Generic; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.PlatformAbstractions; using System.IO; +using System.Security; using Microsoft.DotNet.Configurer; +using Microsoft.Win32; using System.Linq; using RuntimeEnvironment = Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment; using RuntimeInformation = System.Runtime.InteropServices.RuntimeInformation; +using System.Runtime.InteropServices; +using System.Diagnostics; namespace Microsoft.DotNet.Cli.Telemetry { @@ -43,6 +47,10 @@ namespace Microsoft.DotNet.Cli.Telemetry private const string MachineId = "Machine ID"; private const string DockerContainer = "Docker Container"; private const string KernelVersion = "Kernel Version"; + private const string InstallationType = "Installation Type"; + private const string ProductType = "Product Type"; + private const string LibcRelease = "Libc Release"; + private const string LibcVersion = "Libc Version"; private const string TelemetryProfileEnvironmentVariable = "DOTNET_CLI_TELEMETRY_PROFILE"; private const string CannotFindMacAddress = "Unknown"; @@ -62,7 +70,11 @@ namespace Microsoft.DotNet.Cli.Telemetry {DockerContainer, _userLevelCacheWriter.RunWithCache(IsDockerContainerCacheKey, () => _dockerContainerDetector.IsDockerContainer().ToString("G") )}, {CurrentPathHash, _hasher(_getCurrentDirectory())}, {MachineId, _userLevelCacheWriter.RunWithCache(MachineIdCacheKey, GetMachineId)}, - {KernelVersion, GetKernelVersion()} + {KernelVersion, GetKernelVersion()}, + {InstallationType, ExternalTelemetryProperties.GetInstallationType()}, + {ProductType, ExternalTelemetryProperties.GetProductType()}, + {LibcRelease, ExternalTelemetryProperties.GetLibcRelease()}, + {LibcVersion, ExternalTelemetryProperties.GetLibcVersion()} }; } diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/UnixOnlyFactAttribute.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/UnixOnlyFactAttribute.cs new file mode 100644 index 000000000..78be9c856 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/UnixOnlyFactAttribute.cs @@ -0,0 +1,19 @@ +// 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.PlatformAbstractions; +using Xunit; + +namespace Microsoft.DotNet.Tools.Test.Utilities +{ + public class UnixOnlyFactAttribute : FactAttribute + { + public UnixOnlyFactAttribute() + { + if (RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows) + { + this.Skip = "This test requires Unix to run"; + } + } + } +} diff --git a/test/dotnet.Tests/TelemetryCommonPropertiesTests.cs b/test/dotnet.Tests/TelemetryCommonPropertiesTests.cs index 7c6c5484d..6404a2b58 100644 --- a/test/dotnet.Tests/TelemetryCommonPropertiesTests.cs +++ b/test/dotnet.Tests/TelemetryCommonPropertiesTests.cs @@ -52,6 +52,61 @@ namespace Microsoft.DotNet.Tests unitUnderTest.GetTelemetryCommonProperties()["Kernel Version"].Should().Be(RuntimeInformation.OSDescription); } + [WindowsOnlyFact] + public void TelemetryCommonPropertiesShouldContainWindowsInstallType() + { + var unitUnderTest = new TelemetryCommonProperties(getMACAddress: () => null, userLevelCacheWriter: new NothingCache()); + unitUnderTest.GetTelemetryCommonProperties()["Installation Type"].Should().NotBeEmpty(); + } + + [UnixOnlyFact] + public void TelemetryCommonPropertiesShouldContainEmptyWindowsInstallType() + { + var unitUnderTest = new TelemetryCommonProperties(getMACAddress: () => null, userLevelCacheWriter: new NothingCache()); + unitUnderTest.GetTelemetryCommonProperties()["Installation Type"].Should().BeEmpty(); + } + + [WindowsOnlyFact] + public void TelemetryCommonPropertiesShouldContainWindowsProductType() + { + var unitUnderTest = new TelemetryCommonProperties(getMACAddress: () => null, userLevelCacheWriter: new NothingCache()); + unitUnderTest.GetTelemetryCommonProperties()["Product Type"].Should().NotBeEmpty(); + } + + [UnixOnlyFact] + public void TelemetryCommonPropertiesShouldContainEmptyWindowsProductType() + { + var unitUnderTest = new TelemetryCommonProperties(getMACAddress: () => null, userLevelCacheWriter: new NothingCache()); + unitUnderTest.GetTelemetryCommonProperties()["Product Type"].Should().BeEmpty(); + } + + [WindowsOnlyFact] + public void TelemetryCommonPropertiesShouldContainEmptyLibcReleaseAndVersion() + { + var unitUnderTest = new TelemetryCommonProperties(getMACAddress: () => null, userLevelCacheWriter: new NothingCache()); + unitUnderTest.GetTelemetryCommonProperties()["Libc Release"].Should().BeEmpty(); + unitUnderTest.GetTelemetryCommonProperties()["Libc Version"].Should().BeEmpty(); + } + + [MacOsOnlyFact] + public void TelemetryCommonPropertiesShouldContainEmptyLibcReleaseAndVersion2() + { + var unitUnderTest = new TelemetryCommonProperties(getMACAddress: () => null, userLevelCacheWriter: new NothingCache()); + unitUnderTest.GetTelemetryCommonProperties()["Libc Release"].Should().BeEmpty(); + unitUnderTest.GetTelemetryCommonProperties()["Libc Version"].Should().BeEmpty(); + } + + [LinuxOnlyFact] + public void TelemetryCommonPropertiesShouldContainLibcReleaseAndVersion() + { + if (!RuntimeEnvironment.OperatingSystem.Contains("Alpine", StringComparison.OrdinalIgnoreCase)) + { + var unitUnderTest = new TelemetryCommonProperties(getMACAddress: () => null, userLevelCacheWriter: new NothingCache()); + unitUnderTest.GetTelemetryCommonProperties()["Libc Release"].Should().NotBeEmpty(); + unitUnderTest.GetTelemetryCommonProperties()["Libc Version"].Should().NotBeEmpty(); + } + } + private class NothingCache : IUserLevelCacheWriter { public string RunWithCache(string cacheKey, Func getValueToCache) From a631900fa7f3c7aaa7d4c5cafd4225bbd23e8483 Mon Sep 17 00:00:00 2001 From: Livar Date: Wed, 28 Feb 2018 10:35:05 -0800 Subject: [PATCH 057/103] Update SDK to 2.1.300-preview2-62628-06 Carries the fix for the preview message. --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 258fd2e3e..3ca2fed30 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -14,7 +14,7 @@ $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) - 2.1.300-preview2-62607-04 + 2.1.300-preview2-62628-06 $(MicrosoftNETSdkPackageVersion) 2.1.0-preview2-30169 2.1.0-rel-20180215-1390388 From bcbbf6634ff3efd93758214b4370156d3d3d33c6 Mon Sep 17 00:00:00 2001 From: dotnet-bot Date: Mon, 19 Feb 2018 19:02:30 +0000 Subject: [PATCH 058/103] Update CoreSetup, CoreSetup, CoreSetup, Roslyn to preview2-26219-02, preview2-26219-02, preview2-26219-02, beta1-62616-10, respectively --- build/DependencyVersions.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 258fd2e3e..f3e6f0b18 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -28,8 +28,8 @@ $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) - 2.1.0-preview2-26131-06 - 2.1.0-preview2-26131-06 + 2.1.0-preview2-26219-02 + 2.1.0-preview2-26219-02 0.1.1-alpha-174 1.2.1-alpha-002133 $(MicrosoftDotNetProjectJsonMigrationPackageVersion) From b3a14f1ec9a3f15bcfac2a3c46ba63bc59954755 Mon Sep 17 00:00:00 2001 From: danmosemsft Date: Thu, 22 Feb 2018 13:34:28 -0800 Subject: [PATCH 059/103] Merge with master --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index f3e6f0b18..0f7b63583 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -69,4 +69,4 @@ 2.0.0-preview2-25331-01 - + \ No newline at end of file From 99b55ce2470be2f609d4724b2e7bd9eceacb3738 Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Sat, 24 Feb 2018 17:20:23 -0800 Subject: [PATCH 060/103] Update to latest CoreFX manually --- build/DependencyVersions.props | 4 ++-- .../CommandResolution/ProjectFactory.cs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 0f7b63583..a95bc79ad 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -28,8 +28,8 @@ $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) - 2.1.0-preview2-26219-02 - 2.1.0-preview2-26219-02 + 2.1.0-preview2-26222-01 + 2.1.0-preview2-26222-01 0.1.1-alpha-174 1.2.1-alpha-002133 $(MicrosoftDotNetProjectJsonMigrationPackageVersion) diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectFactory.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectFactory.cs index 31dd409ac..f62040a9b 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectFactory.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectFactory.cs @@ -70,6 +70,7 @@ namespace Microsoft.DotNet.Cli.Utils private string GetMSBuildProjPath(string projectDirectory) { + System.Console.WriteLine($"Dir={projectDirectory}"); IEnumerable projectFiles = Directory .GetFiles(projectDirectory, "*.*proj") .Where(d => !d.EndsWith(".xproj")); From 6c0944a017a428bfe225022485c2fc82a6a7487b Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Sat, 24 Feb 2018 18:01:42 -0800 Subject: [PATCH 061/103] Update again --- build/DependencyVersions.props | 2 +- .../CommandResolution/ProjectFactory.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index a95bc79ad..83a296ece 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -2,7 +2,7 @@ 2.1.0-preview2-30171 - 2.1.0-preview2-26131-06 + 2.1.0-preview2-26224-02 $(MicrosoftNETCoreAppPackageVersion) 15.7.0-preview-000063 $(MicrosoftBuildPackageVersion) diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectFactory.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectFactory.cs index f62040a9b..31dd409ac 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectFactory.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectFactory.cs @@ -70,7 +70,6 @@ namespace Microsoft.DotNet.Cli.Utils private string GetMSBuildProjPath(string projectDirectory) { - System.Console.WriteLine($"Dir={projectDirectory}"); IEnumerable projectFiles = Directory .GetFiles(projectDirectory, "*.*proj") .Where(d => !d.EndsWith(".xproj")); From d00060d449f4ee0b6b53ed0f7904d6cc3dd76d24 Mon Sep 17 00:00:00 2001 From: danmosemsft Date: Sat, 24 Feb 2018 18:39:19 -0800 Subject: [PATCH 062/103] Use core-setup version --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 83a296ece..9c1ace8e8 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -2,7 +2,7 @@ 2.1.0-preview2-30171 - 2.1.0-preview2-26224-02 + 2.1.0-preview2-26222-02 $(MicrosoftNETCoreAppPackageVersion) 15.7.0-preview-000063 $(MicrosoftBuildPackageVersion) From 8a6a642d6662fa2925fe4e872d54072c5f9532fa Mon Sep 17 00:00:00 2001 From: danmosemsft Date: Sat, 24 Feb 2018 18:48:35 -0800 Subject: [PATCH 063/103] 01 --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 9c1ace8e8..816cab447 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -2,7 +2,7 @@ 2.1.0-preview2-30171 - 2.1.0-preview2-26222-02 + 2.1.0-preview2-26222-01 $(MicrosoftNETCoreAppPackageVersion) 15.7.0-preview-000063 $(MicrosoftBuildPackageVersion) From 3965ce70479e90476cdf9b914b28c92a047d0188 Mon Sep 17 00:00:00 2001 From: danmosemsft Date: Sat, 24 Feb 2018 20:49:01 -0800 Subject: [PATCH 064/103] Updated core-setup --- build/DependencyVersions.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 816cab447..b8a2e6288 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -2,7 +2,7 @@ 2.1.0-preview2-30171 - 2.1.0-preview2-26222-01 + 2.1.0-preview2-26225-01 $(MicrosoftNETCoreAppPackageVersion) 15.7.0-preview-000063 $(MicrosoftBuildPackageVersion) @@ -28,8 +28,8 @@ $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) - 2.1.0-preview2-26222-01 - 2.1.0-preview2-26222-01 + 2.1.0-preview2-26225-01 + 2.1.0-preview2-26225-01 0.1.1-alpha-174 1.2.1-alpha-002133 $(MicrosoftDotNetProjectJsonMigrationPackageVersion) From 91fea0d7b402801f35b39cc107a39c1b73013129 Mon Sep 17 00:00:00 2001 From: William Li Date: Mon, 26 Feb 2018 12:13:26 -0800 Subject: [PATCH 065/103] ingest and publish rumtime agnostic package --- build/Branding.props | 2 +- build/BundledRuntimes.props | 4 ++-- build/LinuxDistrosNativeInstaller.props | 2 +- build/package/Installer.RPM.targets | 4 ++++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/build/Branding.props b/build/Branding.props index eadbd0927..fa9b1f31c 100644 --- a/build/Branding.props +++ b/build/Branding.props @@ -24,7 +24,7 @@ '$(HostRid)' == 'opensuse.42.1-x64' ">$(HostRid) $(HostOSName)-$(Architecture) $(HostMonikerRid) - $(Architecture) + $(Architecture) dotnet-sdk-internal dotnet-sdk-symbols diff --git a/build/BundledRuntimes.props b/build/BundledRuntimes.props index aeeaf373d..9738b731e 100644 --- a/build/BundledRuntimes.props +++ b/build/BundledRuntimes.props @@ -12,7 +12,7 @@ $(CoreSetupRid) - x64 + x64 dotnet-host$(InstallerStartSuffix)-$(SharedHostVersion)-$(SharedFrameworkInstallerFileRid)$(InstallerExtension) $(PackagesDirectory)/$(DownloadedSharedHostInstallerFileName) @@ -70,7 +70,7 @@ <_DownloadAndExtractItem Include="DownloadedRuntimeDepsInstallerFile" - Condition="'$(IsDebianBaseDistro)' == 'true' And '$(SkipBuildingInstallers)' != 'true' And !Exists('$(DownloadedRuntimeDepsInstallerFile)') And '$(InstallerExtension)' != ''"> + Condition="('$(IsDebianBaseDistro)' == 'true' OR '$(IsRPMBasedDistro)' == 'true') And '$(SkipBuildingInstallers)' != 'true' And !Exists('$(DownloadedRuntimeDepsInstallerFile)') And '$(InstallerExtension)' != ''"> $(CoreSetupRootUrl)$(MicrosoftNETCoreAppPackageVersion)/$(DownloadedRuntimeDepsInstallerFileName)$(CoreSetupBlobAccessTokenParam) $(DownloadedRuntimeDepsInstallerFile) diff --git a/build/LinuxDistrosNativeInstaller.props b/build/LinuxDistrosNativeInstaller.props index 3827e569e..d153e267a 100644 --- a/build/LinuxDistrosNativeInstaller.props +++ b/build/LinuxDistrosNativeInstaller.props @@ -8,7 +8,7 @@ rhel rpm - rhel-x64 + x64 diff --git a/build/package/Installer.RPM.targets b/build/package/Installer.RPM.targets index a3a9c7992..115d6070f 100644 --- a/build/package/Installer.RPM.targets +++ b/build/package/Installer.RPM.targets @@ -145,6 +145,8 @@ + $(MicrosoftNETCoreAppPackageVersion) + dotnet-runtime-deps-$(RuntimeDepsPackageVersion) $(SdkVersion) $(OutputDirectory)/sdk $(InstallerOutputDirectory)/$(DistroSpecificArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk)$(InstallerExtension) @@ -216,6 +218,7 @@ Outputs="$(RpmTestResultsXmlFile)" > + @@ -239,5 +242,6 @@ + From 80b485689a6f28ea345368d7911e396436e4228f Mon Sep 17 00:00:00 2001 From: William Li Date: Mon, 26 Feb 2018 15:51:09 -0800 Subject: [PATCH 066/103] Edit readme --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b00263619..b13340fd9 100644 --- a/README.md +++ b/README.md @@ -64,8 +64,7 @@ To download the .NET Core runtime **without** the SDK, visit https://github.com/ | **Windows x64** | [Installer][win-x64-installer] - [Checksum][win-x64-installer-checksum]
[zip][win-x64-zip] - [Checksum][win-x64-zip-checksum] | | **Windows x86** | [Installer][win-x86-installer] - [Checksum][win-x86-installer-checksum]
[zip][win-x86-zip] - [Checksum][win-x86-zip-checksum] | | **macOS** | [Installer][osx-installer] - [Checksum][osx-installer-checksum]
[tar.gz][osx-targz] - [Checksum][osx-targz-checksum] | -| **Linux x64** | [DEB Installer][linux-DEB-installer] - [Checksum][linux-DEB-installer-checksum]
_see installer note below_1
[tar.gz][linux-targz] - [Checksum][linux-targz-checksum] | -| **RHEL 7.2** | [Installer][rhel-7-installer] - [Checksum][rhel-7-installer-checksum]
[tar.gz][linux-targz] - [Checksum][linux-targz-checksum] | +| **Linux x64** | [DEB Installer][linux-DEB-installer] - [Checksum][linux-DEB-installer-checksum]
[RPM Installer][linux-RPM-installer] - [Checksum][linux-RPM-installer-checksum]
_see installer note below_1
[tar.gz][linux-targz] - [Checksum][linux-targz-checksum] | | **RHEL 6** | [tar.gz][rhel-6-targz] - [Checksum][rhel-6-targz-checksum] | | **Alpine 3.6** | [tar.gz][alpine-3.6-targz] - [Checksum][alpine-3.6-targz-checksum] | @@ -104,8 +103,8 @@ Reference notes: [linux-DEB-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-x64.deb [linux-DEB-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-x64.deb.sha -[rhel-7-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-rhel-x64.rpm -[rhel-7-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-rhel-x64.rpm.sha +[linux-RPM-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-x64.rpm +[linux-RPM-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-x64.rpm.sha [rhel-6-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-rhel.6-x64.tar.gz [rhel-6-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-rhel.6-x64.tar.gz.sha From 309be9c10d1cb2bd81b025efb5cbcab1515ff10c Mon Sep 17 00:00:00 2001 From: John Luo Date: Wed, 28 Feb 2018 12:19:27 -0800 Subject: [PATCH 067/103] Update Microsoft.DotNet.Archive version --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 258fd2e3e..24d940c6c 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -33,7 +33,7 @@ 0.1.1-alpha-174 1.2.1-alpha-002133 $(MicrosoftDotNetProjectJsonMigrationPackageVersion) - 0.2.0-beta-62606-02 + 0.2.0-beta-62628-01 1.6.0-beta2-25304 4.7.0-preview1-4927 $(NuGetBuildTasksPackageVersion) From 9c5c453da52083accce202e3ed758b0c8beecfcd Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Wed, 28 Feb 2018 13:20:17 -0800 Subject: [PATCH 068/103] Fixing the expected path to the generateDeps.proj file, now that the SDK moved away from the build folder. --- .../GivenAProjectToolsCommandResolver.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs index 4b5a3874b..89d74d82f 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs @@ -457,7 +457,7 @@ namespace Microsoft.DotNet.Tests { // When using the product, the ToolDepsJsonGeneratorProject property is used to get this path, but for testing // we'll hard code the path inside the SDK since we don't have a project to evaluate here - return Path.Combine(new RepoDirectoriesProvider().Stage2Sdk, "Sdks", "Microsoft.NET.Sdk", "build", "GenerateDeps", "GenerateDeps.proj"); + return Path.Combine(new RepoDirectoriesProvider().Stage2Sdk, "Sdks", "Microsoft.NET.Sdk", "targets", "GenerateDeps", "GenerateDeps.proj"); } } } From 4c36ae18f47a68ba163ccc3ce8dcb8e23644ff5c Mon Sep 17 00:00:00 2001 From: danmosemsft Date: Tue, 27 Feb 2018 19:14:42 -0800 Subject: [PATCH 069/103] Latest versions --- build/DependencyVersions.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index b8a2e6288..df6903a20 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -2,7 +2,7 @@ 2.1.0-preview2-30171 - 2.1.0-preview2-26225-01 + 2.1.0-preview2-26227-01 $(MicrosoftNETCoreAppPackageVersion) 15.7.0-preview-000063 $(MicrosoftBuildPackageVersion) @@ -28,8 +28,8 @@ $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) - 2.1.0-preview2-26225-01 - 2.1.0-preview2-26225-01 + 2.1.0-preview2-26227-01 + 2.1.0-preview2-26227-01 0.1.1-alpha-174 1.2.1-alpha-002133 $(MicrosoftDotNetProjectJsonMigrationPackageVersion) From e7759edfdb45d11ccc111f8fee0adba3b2cb09e7 Mon Sep 17 00:00:00 2001 From: William Li Date: Wed, 28 Feb 2018 14:09:32 -0800 Subject: [PATCH 070/103] Rename test to walk around test fail And a separate issue will continue the investigation of why rename fixed a test failure --- .../ToolPackageInstallerTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs index 9c4bf61f5..ce3787cbf 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs +++ b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs @@ -416,7 +416,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests [Theory] [InlineData(false)] [InlineData(true)] - public void GivenAnInstalledPackageUninstallRollsbackWhenTransactionAborts(bool testMockBehaviorIsInSync) + public void GivenAnInstalledPackageUninstallRollsbackWhenTransactionFails(bool testMockBehaviorIsInSync) { var source = GetTestLocalFeedPath(); From 030b6b406c97d7e30d65d30aabe3dc3972baf0e5 Mon Sep 17 00:00:00 2001 From: Mike Lorbetske Date: Wed, 28 Feb 2018 14:51:05 -0800 Subject: [PATCH 071/103] Update 2.1 test templates to use the 15.7 preview 1 test SDK --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 258fd2e3e..a6435d258 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -22,7 +22,7 @@ $(MicrosoftNETSdkWebPackageVersion) 1.0.1-beta3-20180104-1263555 1.0.1-beta3-20180104-1263555 - $(MicrosoftDotNetCommonProjectTemplates20PackageVersion) + 1.0.1-beta3-20180227-1423805 1.0.0-beta3-20171204-315 $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) From 6072355340cc15d248ee7b4ffe2a621faf108dc6 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Thu, 1 Mar 2018 14:09:06 -0800 Subject: [PATCH 072/103] Make the default verbosity for dotnet clean `normal`. This way we can get some meaningful output out of the command. --- src/dotnet/commands/dotnet-clean/Program.cs | 5 ++++- test/dotnet-msbuild.Tests/GivenDotnetCleanInvocation.cs | 4 ++-- test/msbuild.IntegrationTests/GivenDotnetInvokesMSBuild.cs | 1 - 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/dotnet/commands/dotnet-clean/Program.cs b/src/dotnet/commands/dotnet-clean/Program.cs index e07ec356d..b93057290 100644 --- a/src/dotnet/commands/dotnet-clean/Program.cs +++ b/src/dotnet/commands/dotnet-clean/Program.cs @@ -19,7 +19,10 @@ namespace Microsoft.DotNet.Tools.Clean public static CleanCommand FromArgs(string[] args, string msbuildPath = null) { - var msbuildArgs = new List(); + var msbuildArgs = new List + { + "/v:normal" + }; var parser = Parser.Instance; diff --git a/test/dotnet-msbuild.Tests/GivenDotnetCleanInvocation.cs b/test/dotnet-msbuild.Tests/GivenDotnetCleanInvocation.cs index 461dcc16a..241903afb 100644 --- a/test/dotnet-msbuild.Tests/GivenDotnetCleanInvocation.cs +++ b/test/dotnet-msbuild.Tests/GivenDotnetCleanInvocation.cs @@ -10,14 +10,14 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests { public class GivenDotnetCleanInvocation { - const string ExpectedPrefix = "exec /m /v:m /t:Clean"; + const string ExpectedPrefix = "exec /m /v:m /v:normal /t:Clean"; [Fact] public void ItAddsProjectToMsbuildInvocation() { var msbuildPath = ""; CleanCommand.FromArgs(new string[] { "" }, msbuildPath) - .GetProcessStartInfo().Arguments.Should().Be("exec /m /v:m /t:Clean"); + .GetProcessStartInfo().Arguments.Should().Be("exec /m /v:m /v:normal /t:Clean"); } [Theory] diff --git a/test/msbuild.IntegrationTests/GivenDotnetInvokesMSBuild.cs b/test/msbuild.IntegrationTests/GivenDotnetInvokesMSBuild.cs index af9b7d817..941e14715 100644 --- a/test/msbuild.IntegrationTests/GivenDotnetInvokesMSBuild.cs +++ b/test/msbuild.IntegrationTests/GivenDotnetInvokesMSBuild.cs @@ -34,7 +34,6 @@ namespace Microsoft.DotNet.Cli.MSBuild.IntegrationTests [Theory] [InlineData("build")] - [InlineData("clean")] [InlineData("msbuild")] [InlineData("pack")] [InlineData("publish")] From c7417a4cb2d300a87fb78b3661e119955c90e8f3 Mon Sep 17 00:00:00 2001 From: William Lee Date: Thu, 1 Mar 2018 21:27:28 -0800 Subject: [PATCH 073/103] Mirror tools package format change pass any as rid (#8695) --- build/BundledDotnetTools.proj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/BundledDotnetTools.proj b/build/BundledDotnetTools.proj index b94bac722..3c07a51f0 100644 --- a/build/BundledDotnetTools.proj +++ b/build/BundledDotnetTools.proj @@ -13,7 +13,8 @@ Condition="!Exists('$(DotnetToolsNuPkgPath)/$(TemplateFillInPackageName.ToLower())')"> - /p:TargetFramework=$(CliTargetFramework) + --runtime any + $(DotnetToolsRestoreAdditionalParameters) /p:TargetFramework=$(CliTargetFramework) $(DotnetToolsRestoreAdditionalParameters) /p:TemplateFillInPackageName=$(TemplateFillInPackageName) $(DotnetToolsRestoreAdditionalParameters) /p:TemplateFillInPackageVersion=$(TemplateFillInPackageVersion) $(DotnetToolsRestoreAdditionalParameters) /p:RestorePackagesPath=$(DotnetToolsLayoutDirectory) From 4490fd5aa841f2d3d9fad6a64e97e15663b32653 Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Wed, 21 Feb 2018 18:34:25 -0800 Subject: [PATCH 074/103] Implement `list tool` command. This commit implements the `list tool` command. The command is responsible for displaying a list of install global tools. Fixes #8548. --- src/dotnet/CommonLocalizableStrings.resx | 8 +- src/dotnet/ToolPackage/IToolPackageStore.cs | 2 +- src/dotnet/ToolPackage/ToolPackageInstance.cs | 17 +-- src/dotnet/ToolPackage/ToolPackageStore.cs | 30 +++- .../dotnet-help/LocalizableStrings.resx | 2 +- .../dotnet-help/xlf/LocalizableStrings.cs.xlf | 4 +- .../dotnet-help/xlf/LocalizableStrings.de.xlf | 4 +- .../dotnet-help/xlf/LocalizableStrings.es.xlf | 4 +- .../dotnet-help/xlf/LocalizableStrings.fr.xlf | 4 +- .../dotnet-help/xlf/LocalizableStrings.it.xlf | 4 +- .../dotnet-help/xlf/LocalizableStrings.ja.xlf | 4 +- .../dotnet-help/xlf/LocalizableStrings.ko.xlf | 4 +- .../dotnet-help/xlf/LocalizableStrings.pl.xlf | 4 +- .../xlf/LocalizableStrings.pt-BR.xlf | 4 +- .../dotnet-help/xlf/LocalizableStrings.ru.xlf | 4 +- .../dotnet-help/xlf/LocalizableStrings.tr.xlf | 4 +- .../xlf/LocalizableStrings.zh-Hans.xlf | 4 +- .../xlf/LocalizableStrings.zh-Hant.xlf | 4 +- .../{Program.cs => ListCommand.cs} | 12 +- .../commands/dotnet-list/ListCommandParser.cs | 28 ++-- ... ListProjectToProjectReferencesCommand.cs} | 2 +- ...ProjectToProjectReferencesCommandParser.cs | 20 +++ .../LocalizableStrings.resx | 2 +- .../dotnet-list-tool/ListToolCommand.cs | 88 +++++++++++ .../dotnet-list-tool/ListToolCommandParser.cs | 23 +++ .../dotnet-list-tool/LocalizableStrings.resx | 141 ++++++++++++++++++ .../xlf/LocalizableStrings.cs.xlf | 42 ++++++ .../xlf/LocalizableStrings.de.xlf | 42 ++++++ .../xlf/LocalizableStrings.es.xlf | 42 ++++++ .../xlf/LocalizableStrings.fr.xlf | 42 ++++++ .../xlf/LocalizableStrings.it.xlf | 42 ++++++ .../xlf/LocalizableStrings.ja.xlf | 42 ++++++ .../xlf/LocalizableStrings.ko.xlf | 42 ++++++ .../xlf/LocalizableStrings.pl.xlf | 42 ++++++ .../xlf/LocalizableStrings.pt-BR.xlf | 42 ++++++ .../xlf/LocalizableStrings.ru.xlf | 42 ++++++ .../xlf/LocalizableStrings.tr.xlf | 42 ++++++ .../xlf/LocalizableStrings.zh-Hans.xlf | 42 ++++++ .../xlf/LocalizableStrings.zh-Hant.xlf | 42 ++++++ .../tool/UninstallToolCommand.cs | 6 +- src/dotnet/dotnet.csproj | 1 + .../xlf/CommonLocalizableStrings.cs.xlf | 20 +-- .../xlf/CommonLocalizableStrings.de.xlf | 20 +-- .../xlf/CommonLocalizableStrings.es.xlf | 20 +-- .../xlf/CommonLocalizableStrings.fr.xlf | 20 +-- .../xlf/CommonLocalizableStrings.it.xlf | 20 +-- .../xlf/CommonLocalizableStrings.ja.xlf | 20 +-- .../xlf/CommonLocalizableStrings.ko.xlf | 20 +-- .../xlf/CommonLocalizableStrings.pl.xlf | 20 +-- .../xlf/CommonLocalizableStrings.pt-BR.xlf | 20 +-- .../xlf/CommonLocalizableStrings.ru.xlf | 20 +-- .../xlf/CommonLocalizableStrings.tr.xlf | 20 +-- .../xlf/CommonLocalizableStrings.zh-Hans.xlf | 20 +-- .../xlf/CommonLocalizableStrings.zh-Hant.xlf | 20 +-- ...ivenThatIWantToShowHelpForDotnetCommand.cs | 2 +- .../GivenDotnetListReference.cs | 1 + 56 files changed, 1043 insertions(+), 200 deletions(-) rename src/dotnet/commands/dotnet-list/{Program.cs => ListCommand.cs} (83%) rename src/dotnet/commands/dotnet-list/dotnet-list-reference/{Program.cs => ListProjectToProjectReferencesCommand.cs} (99%) create mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-reference/ListProjectToProjectReferencesCommandParser.cs create mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-tool/ListToolCommand.cs create mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-tool/ListToolCommandParser.cs create mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-tool/LocalizableStrings.resx create mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.cs.xlf create mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.de.xlf create mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.es.xlf create mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.fr.xlf create mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.it.xlf create mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.ja.xlf create mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.ko.xlf create mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.pl.xlf create mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.pt-BR.xlf create mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.ru.xlf create mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.tr.xlf create mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.zh-Hans.xlf create mode 100644 src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.zh-Hant.xlf diff --git a/src/dotnet/CommonLocalizableStrings.resx b/src/dotnet/CommonLocalizableStrings.resx index ea905e472..77847a864 100644 --- a/src/dotnet/CommonLocalizableStrings.resx +++ b/src/dotnet/CommonLocalizableStrings.resx @@ -610,11 +610,11 @@ setx PATH "%PATH%;{0}" Failed to uninstall tool package '{0}': {1} - - Package '{0}' is missing entry point file {1}. + + Entry point file '{0}' for command '{1}' was not found in the package. - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + Settings file 'DotnetToolSettings.xml' was not found in the package. Tool '{0}' (version '{1}') is already installed. diff --git a/src/dotnet/ToolPackage/IToolPackageStore.cs b/src/dotnet/ToolPackage/IToolPackageStore.cs index 31bea417f..72105d24d 100644 --- a/src/dotnet/ToolPackage/IToolPackageStore.cs +++ b/src/dotnet/ToolPackage/IToolPackageStore.cs @@ -11,6 +11,6 @@ namespace Microsoft.DotNet.ToolPackage { DirectoryPath Root { get; } - IEnumerable GetInstalledPackages(string packageId); + IEnumerable GetInstalledPackages(string packageId = null); } } diff --git a/src/dotnet/ToolPackage/ToolPackageInstance.cs b/src/dotnet/ToolPackage/ToolPackageInstance.cs index 0d28cfe97..5841c2ef6 100644 --- a/src/dotnet/ToolPackage/ToolPackageInstance.cs +++ b/src/dotnet/ToolPackage/ToolPackageInstance.cs @@ -109,10 +109,8 @@ namespace Microsoft.DotNet.ToolPackage var dotnetToolSettings = FindItemInTargetLibrary(library, ToolSettingsFileName); if (dotnetToolSettings == null) { - throw new ToolPackageException( - string.Format( - CommonLocalizableStrings.ToolPackageMissingSettingsFile, - PackageId)); + throw new ToolConfigurationException( + CommonLocalizableStrings.MissingToolSettingsFile); } var toolConfigurationPath = @@ -127,11 +125,11 @@ namespace Microsoft.DotNet.ToolPackage var entryPointFromLockFile = FindItemInTargetLibrary(library, configuration.ToolAssemblyEntryPoint); if (entryPointFromLockFile == null) { - throw new ToolPackageException( + throw new ToolConfigurationException( string.Format( - CommonLocalizableStrings.ToolPackageMissingEntryPointFile, - PackageId, - configuration.ToolAssemblyEntryPoint)); + CommonLocalizableStrings.MissingToolEntryPointFile, + configuration.ToolAssemblyEntryPoint, + configuration.CommandName)); } // Currently only "dotnet" commands are supported @@ -148,10 +146,9 @@ namespace Microsoft.DotNet.ToolPackage } catch (Exception ex) when (ex is UnauthorizedAccessException || ex is IOException) { - throw new ToolPackageException( + throw new ToolConfigurationException( string.Format( CommonLocalizableStrings.FailedToRetrieveToolConfiguration, - PackageId, ex.Message), ex); } diff --git a/src/dotnet/ToolPackage/ToolPackageStore.cs b/src/dotnet/ToolPackage/ToolPackageStore.cs index d2a9f79f1..f9575a9cc 100644 --- a/src/dotnet/ToolPackage/ToolPackageStore.cs +++ b/src/dotnet/ToolPackage/ToolPackageStore.cs @@ -15,13 +15,37 @@ namespace Microsoft.DotNet.ToolPackage public DirectoryPath Root { get; private set; } - public IEnumerable GetInstalledPackages(string packageId) + public IEnumerable GetInstalledPackages(string packageId = null) { - if (packageId == null) + if (packageId != null) { - throw new ArgumentNullException(nameof(packageId)); + return EnumerateVersions(packageId); } + return EnumerateAllPackages().SelectMany(p => p); + } + + private IEnumerable> EnumerateAllPackages() + { + if (!Directory.Exists(Root.Value)) + { + yield break; + } + + foreach (var subdirectory in Directory.EnumerateDirectories(Root.Value)) + { + var packageId = Path.GetFileName(subdirectory); + if (packageId == ToolPackageInstaller.StagingDirectory) + { + continue; + } + + yield return EnumerateVersions(packageId); + } + } + + private IEnumerable EnumerateVersions(string packageId) + { var packageRootDirectory = Root.WithSubDirectories(packageId); if (!Directory.Exists(packageRootDirectory.Value)) { diff --git a/src/dotnet/commands/dotnet-help/LocalizableStrings.resx b/src/dotnet/commands/dotnet-help/LocalizableStrings.resx index 77e1429ed..5c4f125dc 100644 --- a/src/dotnet/commands/dotnet-help/LocalizableStrings.resx +++ b/src/dotnet/commands/dotnet-help/LocalizableStrings.resx @@ -193,7 +193,7 @@ Remove reference from the project. - List reference in the project. + List project references or installed tools. Advanced Commands diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf index c7e572fee..2075f923e 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf @@ -153,8 +153,8 @@ - List reference in the project. - Vypíše odkaz v projektu. + List project references or installed tools. + Vypíše odkaz v projektu. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf index 76a830a57..b5105534b 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf @@ -153,8 +153,8 @@ - List reference in the project. - Verweis im Projekt auflisten. + List project references or installed tools. + Verweis im Projekt auflisten. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf index 156b555db..2c4f24649 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf @@ -153,8 +153,8 @@ - List reference in the project. - Muestra referencias en el proyecto. + List project references or installed tools. + Muestra referencias en el proyecto. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf index 0c7b146c3..4b69ddc7f 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf @@ -153,8 +153,8 @@ - List reference in the project. - Listez une référence dans le projet. + List project references or installed tools. + Listez une référence dans le projet. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf index c82936c0d..737a25340 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf @@ -153,8 +153,8 @@ - List reference in the project. - Elenca il riferimento nel progetto. + List project references or installed tools. + Elenca il riferimento nel progetto. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf index 676fb4114..a7ed545eb 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf @@ -153,8 +153,8 @@ - List reference in the project. - プロジェクト内の参照を一覧表示します。 + List project references or installed tools. + プロジェクト内の参照を一覧表示します。 diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf index dacf14f0b..d89150949 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf @@ -153,8 +153,8 @@ - List reference in the project. - 프로젝트의 참조를 나열합니다. + List project references or installed tools. + 프로젝트의 참조를 나열합니다. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf index 3ef41efc3..4e39e715c 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf @@ -153,8 +153,8 @@ - List reference in the project. - Wyświetl odwołanie w projekcie. + List project references or installed tools. + Wyświetl odwołanie w projekcie. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf index b6356780c..320d69e59 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf @@ -153,8 +153,8 @@ - List reference in the project. - Listar referência no projeto. + List project references or installed tools. + Listar referência no projeto. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf index 392df0743..bb7487a5e 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf @@ -153,8 +153,8 @@ - List reference in the project. - Список ссылок в проекте. + List project references or installed tools. + Список ссылок в проекте. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf index a168014f1..b192fb32a 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf @@ -153,8 +153,8 @@ - List reference in the project. - Projede başvuruyu listeleyin. + List project references or installed tools. + Projede başvuruyu listeleyin. diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf index 5940a4217..c3bb4684f 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf @@ -153,8 +153,8 @@ - List reference in the project. - 列出项目中的引用。 + List project references or installed tools. + 列出项目中的引用。 diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf index 2babfcb51..6247cdae5 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf @@ -153,8 +153,8 @@ - List reference in the project. - 列出專案中的參考。 + List project references or installed tools. + 列出專案中的參考。 diff --git a/src/dotnet/commands/dotnet-list/Program.cs b/src/dotnet/commands/dotnet-list/ListCommand.cs similarity index 83% rename from src/dotnet/commands/dotnet-list/Program.cs rename to src/dotnet/commands/dotnet-list/ListCommand.cs index 403302b39..969a44179 100644 --- a/src/dotnet/commands/dotnet-list/Program.cs +++ b/src/dotnet/commands/dotnet-list/ListCommand.cs @@ -7,6 +7,7 @@ using Microsoft.DotNet.Cli; using Microsoft.DotNet.Cli.CommandLine; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Tools.List.ProjectToProjectReferences; +using Microsoft.DotNet.Tools.List.Tool; namespace Microsoft.DotNet.Tools.List { @@ -22,16 +23,17 @@ namespace Microsoft.DotNet.Tools.List { { "reference", - o => new ListProjectToProjectReferencesCommand( - o, - ParseResult) + o => new ListProjectToProjectReferencesCommand(o, ParseResult) + }, + { + "tool", + o => new ListToolCommand(o["tool"], ParseResult) } }; public static int Run(string[] args) { - var command = new ListCommand(); - return command.RunCommand(args); + return new ListCommand().RunCommand(args); } } } \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/ListCommandParser.cs b/src/dotnet/commands/dotnet-list/ListCommandParser.cs index 1fee43e0f..1f2bb48d8 100644 --- a/src/dotnet/commands/dotnet-list/ListCommandParser.cs +++ b/src/dotnet/commands/dotnet-list/ListCommandParser.cs @@ -3,24 +3,24 @@ using Microsoft.DotNet.Cli.CommandLine; using Microsoft.DotNet.Tools; +using Microsoft.DotNet.Tools.List.ProjectToProjectReferences; +using Microsoft.DotNet.Tools.List.Tool; using LocalizableStrings = Microsoft.DotNet.Tools.List.LocalizableStrings; namespace Microsoft.DotNet.Cli { internal static class ListCommandParser { - public static Command List() => - Create.Command("list", - LocalizableStrings.NetListCommand, - Accept.ZeroOrOneArgument() - .With(name: CommonLocalizableStrings.CmdProjectFile, - description: - CommonLocalizableStrings.ArgumentsProjectDescription) - .DefaultToCurrentDirectory(), - CommonOptions.HelpOption(), - Create.Command("reference", - Tools.List.ProjectToProjectReferences.LocalizableStrings.AppFullName, - Accept.ZeroOrOneArgument(), - CommonOptions.HelpOption())); + public static Command List() => Create.Command( + "list", + LocalizableStrings.NetListCommand, + Accept.ZeroOrOneArgument() + .With( + name: CommonLocalizableStrings.CmdProjectFile, + description: CommonLocalizableStrings.ArgumentsProjectDescription) + .DefaultToCurrentDirectory(), + CommonOptions.HelpOption(), + ListProjectToProjectReferencesCommandParser.ListProjectToProjectReferences(), + ListToolCommandParser.ListTool()); } -} \ No newline at end of file +} diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-reference/Program.cs b/src/dotnet/commands/dotnet-list/dotnet-list-reference/ListProjectToProjectReferencesCommand.cs similarity index 99% rename from src/dotnet/commands/dotnet-list/dotnet-list-reference/Program.cs rename to src/dotnet/commands/dotnet-list/dotnet-list-reference/ListProjectToProjectReferencesCommand.cs index 7a4f3cb18..0a25c1a8c 100644 --- a/src/dotnet/commands/dotnet-list/dotnet-list-reference/Program.cs +++ b/src/dotnet/commands/dotnet-list/dotnet-list-reference/ListProjectToProjectReferencesCommand.cs @@ -50,4 +50,4 @@ namespace Microsoft.DotNet.Tools.List.ProjectToProjectReferences return 0; } } -} \ No newline at end of file +} diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-reference/ListProjectToProjectReferencesCommandParser.cs b/src/dotnet/commands/dotnet-list/dotnet-list-reference/ListProjectToProjectReferencesCommandParser.cs new file mode 100644 index 000000000..b0bf62e12 --- /dev/null +++ b/src/dotnet/commands/dotnet-list/dotnet-list-reference/ListProjectToProjectReferencesCommandParser.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.CommandLine; +using LocalizableStrings = Microsoft.DotNet.Tools.List.ProjectToProjectReferences.LocalizableStrings; + +namespace Microsoft.DotNet.Cli +{ + internal static class ListProjectToProjectReferencesCommandParser + { + public static Command ListProjectToProjectReferences() + { + return Create.Command( + "reference", + LocalizableStrings.AppFullName, + Accept.ZeroOrOneArgument(), + CommonOptions.HelpOption()); + } + } +} diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-reference/LocalizableStrings.resx b/src/dotnet/commands/dotnet-list/dotnet-list-reference/LocalizableStrings.resx index 5536ff5ef..887c6c584 100644 --- a/src/dotnet/commands/dotnet-list/dotnet-list-reference/LocalizableStrings.resx +++ b/src/dotnet/commands/dotnet-list/dotnet-list-reference/LocalizableStrings.resx @@ -127,4 +127,4 @@ There are no {0} references in project {1}. {0} is the type of the item being requested (project, package, p2p) and {1} is the object operated on (a project file or a solution file). - \ No newline at end of file + diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-tool/ListToolCommand.cs b/src/dotnet/commands/dotnet-list/dotnet-list-tool/ListToolCommand.cs new file mode 100644 index 000000000..b732ba3a8 --- /dev/null +++ b/src/dotnet/commands/dotnet-list/dotnet-list-tool/ListToolCommand.cs @@ -0,0 +1,88 @@ +// 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 System.Collections.Generic; +using System.Linq; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.CommandLine; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.Configurer; +using Microsoft.DotNet.ToolPackage; +using Microsoft.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.Tools.List.Tool +{ + internal class ListToolCommand : CommandBase + { + private const string CommandDelimiter = ", "; + private readonly AppliedOption _options; + private readonly IToolPackageStore _toolPackageStore; + private readonly IReporter _reporter; + private readonly IReporter _errorReporter; + + public ListToolCommand( + AppliedOption options, + ParseResult result, + IToolPackageStore toolPackageStore = null, + IReporter reporter = null) + : base(result) + { + _options = options ?? throw new ArgumentNullException(nameof(options)); + _toolPackageStore = toolPackageStore ?? new ToolPackageStore( + new DirectoryPath(new CliFolderPathCalculator().ToolsPackagePath)); + _reporter = reporter ?? Reporter.Output; + _errorReporter = reporter ?? Reporter.Error; + } + + public override int Execute() + { + if (!_options.ValueOrDefault("global")) + { + throw new GracefulException(LocalizableStrings.ListToolCommandOnlySupportsGlobal); + } + + var table = new PrintableTable(); + + table.AddColumn( + LocalizableStrings.PackageIdColumn, + p => p.PackageId); + table.AddColumn( + LocalizableStrings.VersionColumn, + p => p.PackageVersion); + table.AddColumn( + LocalizableStrings.CommandsColumn, + p => string.Join(CommandDelimiter, p.Commands.Select(c => c.Name))); + + table.PrintRows(GetPackages(), l => _reporter.WriteLine(l)); + return 0; + } + + private IEnumerable GetPackages() + { + return _toolPackageStore.GetInstalledPackages() + .Where(PackageHasCommands) + .OrderBy(p => p.PackageId) + .ToArray(); + } + + private bool PackageHasCommands(IToolPackage p) + { + try + { + // Attempt to read the commands collection + // If it fails, print a warning and treat as no commands + return p.Commands.Count >= 0; + } + catch (Exception ex) when (ex is ToolConfigurationException) + { + _errorReporter.WriteLine( + string.Format( + LocalizableStrings.InvalidPackageWarning, + p.PackageId, + ex.Message).Yellow()); + return false; + } + } + } +} diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-tool/ListToolCommandParser.cs b/src/dotnet/commands/dotnet-list/dotnet-list-tool/ListToolCommandParser.cs new file mode 100644 index 000000000..c75e2e1ac --- /dev/null +++ b/src/dotnet/commands/dotnet-list/dotnet-list-tool/ListToolCommandParser.cs @@ -0,0 +1,23 @@ +// 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.CommandLine; +using LocalizableStrings = Microsoft.DotNet.Tools.List.Tool.LocalizableStrings; + +namespace Microsoft.DotNet.Cli +{ + internal static class ListToolCommandParser + { + public static Command ListTool() + { + return Create.Command( + "tool", + LocalizableStrings.CommandDescription, + Create.Option( + "-g|--global", + LocalizableStrings.GlobalOptionDescription, + Accept.NoArguments()), + CommonOptions.HelpOption()); + } + } +} diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-tool/LocalizableStrings.resx b/src/dotnet/commands/dotnet-list/dotnet-list-tool/LocalizableStrings.resx new file mode 100644 index 000000000..b4d21c122 --- /dev/null +++ b/src/dotnet/commands/dotnet-list/dotnet-list-tool/LocalizableStrings.resx @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Lists installed tools in the current development environment. + + + List user wide tools. + + + The --global switch (-g) is currently required because only user wide tools are supported. + + + Warning: tool package '{0}' is invalid: {1} + + + Package Id + + + Version + + + Commands + + diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.cs.xlf new file mode 100644 index 000000000..649e0ecf4 --- /dev/null +++ b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.cs.xlf @@ -0,0 +1,42 @@ + + + + + + Lists installed tools in the current development environment. + Lists installed tools in the current development environment. + + + + List user wide tools. + List user wide tools. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Version + Version + + + + Commands + Commands + + + + Package Id + Package Id + + + + Warning: tool package '{0}' is invalid: {1} + Warning: tool package '{0}' is invalid: {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.de.xlf new file mode 100644 index 000000000..ea32b1a2c --- /dev/null +++ b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.de.xlf @@ -0,0 +1,42 @@ + + + + + + Lists installed tools in the current development environment. + Lists installed tools in the current development environment. + + + + List user wide tools. + List user wide tools. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Version + Version + + + + Commands + Commands + + + + Package Id + Package Id + + + + Warning: tool package '{0}' is invalid: {1} + Warning: tool package '{0}' is invalid: {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.es.xlf new file mode 100644 index 000000000..65116604b --- /dev/null +++ b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.es.xlf @@ -0,0 +1,42 @@ + + + + + + Lists installed tools in the current development environment. + Lists installed tools in the current development environment. + + + + List user wide tools. + List user wide tools. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Version + Version + + + + Commands + Commands + + + + Package Id + Package Id + + + + Warning: tool package '{0}' is invalid: {1} + Warning: tool package '{0}' is invalid: {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.fr.xlf new file mode 100644 index 000000000..0f383597d --- /dev/null +++ b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.fr.xlf @@ -0,0 +1,42 @@ + + + + + + Lists installed tools in the current development environment. + Lists installed tools in the current development environment. + + + + List user wide tools. + List user wide tools. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Version + Version + + + + Commands + Commands + + + + Package Id + Package Id + + + + Warning: tool package '{0}' is invalid: {1} + Warning: tool package '{0}' is invalid: {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.it.xlf new file mode 100644 index 000000000..33a6f2083 --- /dev/null +++ b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.it.xlf @@ -0,0 +1,42 @@ + + + + + + Lists installed tools in the current development environment. + Lists installed tools in the current development environment. + + + + List user wide tools. + List user wide tools. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Version + Version + + + + Commands + Commands + + + + Package Id + Package Id + + + + Warning: tool package '{0}' is invalid: {1} + Warning: tool package '{0}' is invalid: {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.ja.xlf new file mode 100644 index 000000000..c9e468b1a --- /dev/null +++ b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.ja.xlf @@ -0,0 +1,42 @@ + + + + + + Lists installed tools in the current development environment. + Lists installed tools in the current development environment. + + + + List user wide tools. + List user wide tools. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Version + Version + + + + Commands + Commands + + + + Package Id + Package Id + + + + Warning: tool package '{0}' is invalid: {1} + Warning: tool package '{0}' is invalid: {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.ko.xlf new file mode 100644 index 000000000..7d5475c1f --- /dev/null +++ b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.ko.xlf @@ -0,0 +1,42 @@ + + + + + + Lists installed tools in the current development environment. + Lists installed tools in the current development environment. + + + + List user wide tools. + List user wide tools. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Version + Version + + + + Commands + Commands + + + + Package Id + Package Id + + + + Warning: tool package '{0}' is invalid: {1} + Warning: tool package '{0}' is invalid: {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.pl.xlf new file mode 100644 index 000000000..5c81b12ec --- /dev/null +++ b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.pl.xlf @@ -0,0 +1,42 @@ + + + + + + Lists installed tools in the current development environment. + Lists installed tools in the current development environment. + + + + List user wide tools. + List user wide tools. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Version + Version + + + + Commands + Commands + + + + Package Id + Package Id + + + + Warning: tool package '{0}' is invalid: {1} + Warning: tool package '{0}' is invalid: {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.pt-BR.xlf new file mode 100644 index 000000000..146703c1a --- /dev/null +++ b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.pt-BR.xlf @@ -0,0 +1,42 @@ + + + + + + Lists installed tools in the current development environment. + Lists installed tools in the current development environment. + + + + List user wide tools. + List user wide tools. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Version + Version + + + + Commands + Commands + + + + Package Id + Package Id + + + + Warning: tool package '{0}' is invalid: {1} + Warning: tool package '{0}' is invalid: {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.ru.xlf new file mode 100644 index 000000000..dfda07a01 --- /dev/null +++ b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.ru.xlf @@ -0,0 +1,42 @@ + + + + + + Lists installed tools in the current development environment. + Lists installed tools in the current development environment. + + + + List user wide tools. + List user wide tools. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Version + Version + + + + Commands + Commands + + + + Package Id + Package Id + + + + Warning: tool package '{0}' is invalid: {1} + Warning: tool package '{0}' is invalid: {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.tr.xlf new file mode 100644 index 000000000..f51db1c10 --- /dev/null +++ b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.tr.xlf @@ -0,0 +1,42 @@ + + + + + + Lists installed tools in the current development environment. + Lists installed tools in the current development environment. + + + + List user wide tools. + List user wide tools. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Version + Version + + + + Commands + Commands + + + + Package Id + Package Id + + + + Warning: tool package '{0}' is invalid: {1} + Warning: tool package '{0}' is invalid: {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.zh-Hans.xlf new file mode 100644 index 000000000..0473cd7d7 --- /dev/null +++ b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.zh-Hans.xlf @@ -0,0 +1,42 @@ + + + + + + Lists installed tools in the current development environment. + Lists installed tools in the current development environment. + + + + List user wide tools. + List user wide tools. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Version + Version + + + + Commands + Commands + + + + Package Id + Package Id + + + + Warning: tool package '{0}' is invalid: {1} + Warning: tool package '{0}' is invalid: {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.zh-Hant.xlf new file mode 100644 index 000000000..34eadedae --- /dev/null +++ b/src/dotnet/commands/dotnet-list/dotnet-list-tool/xlf/LocalizableStrings.zh-Hant.xlf @@ -0,0 +1,42 @@ + + + + + + Lists installed tools in the current development environment. + Lists installed tools in the current development environment. + + + + List user wide tools. + List user wide tools. + + + + The --global switch (-g) is currently required because only user wide tools are supported. + The --global switch (-g) is currently required because only user wide tools are supported. + + + + Version + Version + + + + Commands + Commands + + + + Package Id + Package Id + + + + Warning: tool package '{0}' is invalid: {1} + Warning: tool package '{0}' is invalid: {1} + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs index c9778cd7a..d362e3838 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs +++ b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs @@ -67,9 +67,9 @@ namespace Microsoft.DotNet.Tools.Uninstall.Tool catch (InvalidOperationException) { _errorReporter.WriteLine( - string.Format( - LocalizableStrings.ToolHasMultipleVersionsInstalled, - packageId).Red()); + string.Format( + LocalizableStrings.ToolHasMultipleVersionsInstalled, + packageId).Red()); return 1; } diff --git a/src/dotnet/dotnet.csproj b/src/dotnet/dotnet.csproj index 6b17fb237..ecfeb2ba3 100644 --- a/src/dotnet/dotnet.csproj +++ b/src/dotnet/dotnet.csproj @@ -26,6 +26,7 @@ + diff --git a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf index cde9c4124..8f0e7c10c 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf @@ -694,16 +694,6 @@ Právě jste nainstalovali sadu .NET Core SDK, bude proto nutné před spuštěním nainstalovaného nástroje znovu otevřít okno příkazového řádku. - - Package '{0}' is missing entry point file {1}. - V balíčku {0} chybí soubor vstupního bodu {1}. - - - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - V balíčku {0} chybí soubor nastavení nástroje DotnetToolSettings.xml. - - Tool defines a command with a missing name setting. Nástroj definuje příkaz s chybějícím nastavením názvu. @@ -853,6 +843,16 @@ setx PATH "%PATH%;{0}" Column maximum width must be greater than zero. + + Entry point file '{0}' for command '{1}' was not found in the package. + Entry point file '{0}' for command '{1}' was not found in the package. + + + + Settings file 'DotnetToolSettings.xml' was not found in the package. + Settings file 'DotnetToolSettings.xml' was not found in the package. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf index 2ea94a468..3a93064c3 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf @@ -694,16 +694,6 @@ Da Sie gerade das .NET Core SDK installiert haben, müssen Sie das Eingabeaufforderungsfenster neu öffnen, bevor Sie das installierte Tool ausführen. - - Package '{0}' is missing entry point file {1}. - Im Paket "{0}" fehlt die Einstiegspunktdatei "{1}". - - - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Im Paket "{0}" fehlt die Datei mit den Tooleinstellungen "DotnetToolSettings.xml". - - Tool defines a command with a missing name setting. Das Tool definiert einen Befehl mit fehlender Namenseinstellung. @@ -853,6 +843,16 @@ setx PATH "%PATH%;{0}" Column maximum width must be greater than zero. + + Entry point file '{0}' for command '{1}' was not found in the package. + Entry point file '{0}' for command '{1}' was not found in the package. + + + + Settings file 'DotnetToolSettings.xml' was not found in the package. + Settings file 'DotnetToolSettings.xml' was not found in the package. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf index 0b2245c24..f283122ee 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf @@ -694,16 +694,6 @@ Dado que acaba de instalar el SDK de .Net Core, tendrá que volver a abrir la ventana del símbolo del sistema antes de ejecutar la herramienta instalada. - - Package '{0}' is missing entry point file {1}. - Al paquete "{0}" le falta el archivo de punto de entrada {1}. - - - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Al paquete "{0}" le falta el archivo de configuración de herramientas DotnetToolSettings.xml. - - Tool defines a command with a missing name setting. La herramienta define un comando en el que falta un valor de nombre. @@ -853,6 +843,16 @@ setx PATH "%PATH%;{0}" Column maximum width must be greater than zero. + + Entry point file '{0}' for command '{1}' was not found in the package. + Entry point file '{0}' for command '{1}' was not found in the package. + + + + Settings file 'DotnetToolSettings.xml' was not found in the package. + Settings file 'DotnetToolSettings.xml' was not found in the package. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf index 347fa1778..3a668e77f 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf @@ -694,16 +694,6 @@ Dans la mesure où vous venez d'installer le kit SDK .NET Core, vous devez rouvrir la fenêtre d'invite de commandes avant d'exécuter l'outil que vous avez installé. - - Package '{0}' is missing entry point file {1}. - Le package '{0}' ne contient pas le fichier de point d'entrée {1}. - - - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Le package '{0}' ne contient pas le fichier de paramètres d'outils DotnetToolSettings.xml. - - Tool defines a command with a missing name setting. L'outil définit une commande avec un paramètre de nom manquant. @@ -853,6 +843,16 @@ setx PATH "%PATH%;{0}" Column maximum width must be greater than zero. + + Entry point file '{0}' for command '{1}' was not found in the package. + Entry point file '{0}' for command '{1}' was not found in the package. + + + + Settings file 'DotnetToolSettings.xml' was not found in the package. + Settings file 'DotnetToolSettings.xml' was not found in the package. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf index 888a733b7..89d2e6f1e 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf @@ -694,16 +694,6 @@ Dal momento che è stato appena installato .NET Core SDK, è necessario riaprire la finestra del prompt dei comandi prima di eseguire lo strumento installato. - - Package '{0}' is missing entry point file {1}. - Nel pacchetto '{0}' manca il file del punto di ingresso {1}. - - - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Nel pacchetto '{0}' manca il file di impostazioni dello strumento DotnetToolSettings.xml. - - Tool defines a command with a missing name setting. Lo strumento definisce un comando con un'impostazione di nome mancante. @@ -853,6 +843,16 @@ setx PATH "%PATH%;{0}" Column maximum width must be greater than zero. + + Entry point file '{0}' for command '{1}' was not found in the package. + Entry point file '{0}' for command '{1}' was not found in the package. + + + + Settings file 'DotnetToolSettings.xml' was not found in the package. + Settings file 'DotnetToolSettings.xml' was not found in the package. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf index 9fe190d9c..5d42dbf93 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf @@ -694,16 +694,6 @@ .NET Core SDK をインストールしたばかりなので、インストールしたツールを実行する前に、コマンド プロンプト ウィンドウを再び開く必要があります。 - - Package '{0}' is missing entry point file {1}. - パッケージ '{0}' にエントリ ポイント ファイル {1} がありません。 - - - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - パッケージ '{0}' にツール設定ファイル DotnetToolSettings.xml がありません。 - - Tool defines a command with a missing name setting. ツールは、名前設定がないコマンドを定義します。 @@ -853,6 +843,16 @@ setx PATH "%PATH%;{0}" Column maximum width must be greater than zero. + + Entry point file '{0}' for command '{1}' was not found in the package. + Entry point file '{0}' for command '{1}' was not found in the package. + + + + Settings file 'DotnetToolSettings.xml' was not found in the package. + Settings file 'DotnetToolSettings.xml' was not found in the package. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf index 0055c89c2..e136f3d5c 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf @@ -694,16 +694,6 @@ .NET Core SDK를 방금 설치했기 때문에 설치한 도구를 실행하기 전에 명령 프롬프트 창을 다시 열어야 합니다. - - Package '{0}' is missing entry point file {1}. - 패키지 '{0}'이(가) 누락된 진입점 파일 {1}입니다. - - - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - 패키지 '{0}'이(가) 누락된 도구 설정 파일 DotnetToolSettings.xml입니다. - - Tool defines a command with a missing name setting. 도구에서 이름 설정 없이 명령을 정의합니다. @@ -853,6 +843,16 @@ setx PATH "%PATH%;{0}" Column maximum width must be greater than zero. + + Entry point file '{0}' for command '{1}' was not found in the package. + Entry point file '{0}' for command '{1}' was not found in the package. + + + + Settings file 'DotnetToolSettings.xml' was not found in the package. + Settings file 'DotnetToolSettings.xml' was not found in the package. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf index 84ab68ba8..0a2d70abc 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf @@ -694,16 +694,6 @@ Właśnie zainstalowano zestaw .NET Core SDK, dlatego należy ponownie otworzyć okno wiersza polecenia przed uruchomieniem zainstalowanego narzędzia. - - Package '{0}' is missing entry point file {1}. - Brak pliku punktu wejściowego {1} w pakiecie „{0}”. - - - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Brak pliku ustawień narzędzia DotnetToolSettings.xml w pakiecie „{0}”. - - Tool defines a command with a missing name setting. Narzędzie definiuje polecenie z brakującym ustawieniem nazwy. @@ -853,6 +843,16 @@ setx PATH "%PATH%;{0}" Column maximum width must be greater than zero. + + Entry point file '{0}' for command '{1}' was not found in the package. + Entry point file '{0}' for command '{1}' was not found in the package. + + + + Settings file 'DotnetToolSettings.xml' was not found in the package. + Settings file 'DotnetToolSettings.xml' was not found in the package. + + \ 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 93c4e1338..81b666a10 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf @@ -694,16 +694,6 @@ Já que você acabou de instalar o SDK do .NET Core, você ainda precisará reabrir a janela do Prompt de Comando antes de executar a ferramenta instalada. - - Package '{0}' is missing entry point file {1}. - O arquivo de ponto de entrada {1} está ausente do pacote '{0}'. - - - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - O arquivo de configuração DotnetToolSettings.xml da ferramenta está ausente do pacote '{0}'. - - Tool defines a command with a missing name setting. A ferramenta define um comando com uma configuração de nome ausente. @@ -853,6 +843,16 @@ setx PATH "%PATH%;{0}" Column maximum width must be greater than zero. + + Entry point file '{0}' for command '{1}' was not found in the package. + Entry point file '{0}' for command '{1}' was not found in the package. + + + + Settings file 'DotnetToolSettings.xml' was not found in the package. + Settings file 'DotnetToolSettings.xml' was not found in the package. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf index 8f686a333..0926eee52 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf @@ -694,16 +694,6 @@ Так как вы только что установили пакет SDK для .NET Core, перед его запуском нужно заново открыть окно командной строки. - - Package '{0}' is missing entry point file {1}. - В пакете "{0}" отсутствует файл точки входа {1}. - - - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - В пакете "{0}" отсутствует файл параметров инструмента DotnetToolSettings.xml. - - Tool defines a command with a missing name setting. Инструмент определяет команду, для которой не задано имя. @@ -853,6 +843,16 @@ setx PATH "%PATH%;{0}" Column maximum width must be greater than zero. + + Entry point file '{0}' for command '{1}' was not found in the package. + Entry point file '{0}' for command '{1}' was not found in the package. + + + + Settings file 'DotnetToolSettings.xml' was not found in the package. + Settings file 'DotnetToolSettings.xml' was not found in the package. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf index 22d6637a9..3d316c24f 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf @@ -694,16 +694,6 @@ .NET Core SDK’sını yüklediğinizden, yüklediğiniz aracı çalıştırmadan önce Komut İstemi penceresini yeniden açmanız gerekiyor. - - Package '{0}' is missing entry point file {1}. - '{0}' paketinde {1} giriş noktası dosyası eksik. - - - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - '{0}' paketinde DotnetToolSettings.xml araç ayarları dosyası eksik. - - Tool defines a command with a missing name setting. Araçta ad ayarı eksik bir komut tanımlanıyor. @@ -853,6 +843,16 @@ setx PATH "%PATH%;{0}" Column maximum width must be greater than zero. + + Entry point file '{0}' for command '{1}' was not found in the package. + Entry point file '{0}' for command '{1}' was not found in the package. + + + + Settings file 'DotnetToolSettings.xml' was not found in the package. + Settings file 'DotnetToolSettings.xml' was not found in the package. + + \ 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 14b24e453..b18d951b8 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf @@ -694,16 +694,6 @@ 由于刚安装了 .NET Core SDK,因此在运行安装的工具之前,需要重新打开命令提示符窗口。 - - Package '{0}' is missing entry point file {1}. - 包“{0}”缺少入口点文件 {1}。 - - - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - 包“{0}”缺少工具设置文件 DotnetToolSettings.xml。 - - Tool defines a command with a missing name setting. 工具使用缺失的名称设置定义命令。 @@ -853,6 +843,16 @@ setx PATH "%PATH%;{0}" Column maximum width must be greater than zero. + + Entry point file '{0}' for command '{1}' was not found in the package. + Entry point file '{0}' for command '{1}' was not found in the package. + + + + Settings file 'DotnetToolSettings.xml' was not found in the package. + Settings file 'DotnetToolSettings.xml' was not found in the package. + + \ 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 01e11d97a..8c61b8d28 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf @@ -694,16 +694,6 @@ 因為您剛才安裝了 .NET Core SDK,您必須先重新開啟 [命令提示字元] 視窗,才能執行您安裝的工具。 - - Package '{0}' is missing entry point file {1}. - 套件 '{0}' 缺少進入點檔案 {1}。 - - - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - 套件 '{0}' 缺少工具設定檔 DotnetToolSettings.xml。 - - Tool defines a command with a missing name setting. 工具使用了缺少的名稱設定定義命令。 @@ -853,6 +843,16 @@ setx PATH "%PATH%;{0}" Column maximum width must be greater than zero. + + Entry point file '{0}' for command '{1}' was not found in the package. + Entry point file '{0}' for command '{1}' was not found in the package. + + + + Settings file 'DotnetToolSettings.xml' was not found in the package. + Settings file 'DotnetToolSettings.xml' was not found in the package. + + \ No newline at end of file diff --git a/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs b/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs index f1f26eca6..6ed105cbf 100644 --- a/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs +++ b/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs @@ -34,7 +34,7 @@ SDK commands: sln Modify solution (SLN) files. add Add reference to the project. remove Remove reference from the project. - list List reference in the project. + list List project references or installed tools. nuget Provides additional NuGet commands. msbuild Runs Microsoft Build Engine (MSBuild). vstest Runs Microsoft Test Execution Command Line Tool. diff --git a/test/dotnet-list-reference.Tests/GivenDotnetListReference.cs b/test/dotnet-list-reference.Tests/GivenDotnetListReference.cs index 12766e983..8cfbc7173 100644 --- a/test/dotnet-list-reference.Tests/GivenDotnetListReference.cs +++ b/test/dotnet-list-reference.Tests/GivenDotnetListReference.cs @@ -33,6 +33,7 @@ Options: Commands: reference .NET Core Project-to-Project dependency viewer + tool Lists installed tools in the current development environment. "; const string FrameworkNet451Arg = "-f net451"; From 5ebbd618ec27e5c6da9142b8c1166b2755cba898 Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Thu, 22 Feb 2018 19:13:36 -0800 Subject: [PATCH 075/103] Fix case sensitivity of tool package identifiers. This commit fixes the case sensitivity of tool package identifiers. Previously the install and uninstall commands unintentionally required the tool package ids to specified in all lowercase for the install / uninstall to work. Fixes #8682. --- src/dotnet/CommonLocalizableStrings.resx | 3 + src/dotnet/ToolPackage/IToolPackage.cs | 5 +- .../ToolPackage/IToolPackageInstaller.cs | 5 +- src/dotnet/ToolPackage/IToolPackageStore.cs | 15 +- src/dotnet/ToolPackage/PackageId.cs | 43 +++++ .../ToolPackage/ToolPackageInstaller.cs | 43 ++--- src/dotnet/ToolPackage/ToolPackageInstance.cs | 33 ++-- src/dotnet/ToolPackage/ToolPackageStore.cs | 84 +++++++-- .../dotnet-install-tool/InstallToolCommand.cs | 23 ++- .../LocalizableStrings.resx | 3 + .../xlf/LocalizableStrings.cs.xlf | 5 + .../xlf/LocalizableStrings.de.xlf | 5 + .../xlf/LocalizableStrings.es.xlf | 5 + .../xlf/LocalizableStrings.fr.xlf | 5 + .../xlf/LocalizableStrings.it.xlf | 5 + .../xlf/LocalizableStrings.ja.xlf | 5 + .../xlf/LocalizableStrings.ko.xlf | 5 + .../xlf/LocalizableStrings.pl.xlf | 5 + .../xlf/LocalizableStrings.pt-BR.xlf | 5 + .../xlf/LocalizableStrings.ru.xlf | 5 + .../xlf/LocalizableStrings.tr.xlf | 5 + .../xlf/LocalizableStrings.zh-Hans.xlf | 5 + .../xlf/LocalizableStrings.zh-Hant.xlf | 5 + .../dotnet-list-tool/ListToolCommand.cs | 10 +- .../tool/UninstallToolCommand.cs | 9 +- .../xlf/CommonLocalizableStrings.cs.xlf | 5 + .../xlf/CommonLocalizableStrings.de.xlf | 5 + .../xlf/CommonLocalizableStrings.es.xlf | 5 + .../xlf/CommonLocalizableStrings.fr.xlf | 5 + .../xlf/CommonLocalizableStrings.it.xlf | 5 + .../xlf/CommonLocalizableStrings.ja.xlf | 5 + .../xlf/CommonLocalizableStrings.ko.xlf | 5 + .../xlf/CommonLocalizableStrings.pl.xlf | 5 + .../xlf/CommonLocalizableStrings.pt-BR.xlf | 5 + .../xlf/CommonLocalizableStrings.ru.xlf | 5 + .../xlf/CommonLocalizableStrings.tr.xlf | 5 + .../xlf/CommonLocalizableStrings.zh-Hans.xlf | 5 + .../xlf/CommonLocalizableStrings.zh-Hant.xlf | 5 + .../ToolPackageInstallerTests.cs | 91 ++++++---- .../ProjectRestorerMock.cs | 27 +-- .../ToolPackageInstallerMock.cs | 26 ++- .../ToolPackageMock.cs | 17 +- .../ToolPackageStoreMock.cs | 77 +++++++- .../CommandTests/InstallToolCommandTests.cs | 164 +++++++++++++++--- 44 files changed, 629 insertions(+), 179 deletions(-) create mode 100644 src/dotnet/ToolPackage/PackageId.cs diff --git a/src/dotnet/CommonLocalizableStrings.resx b/src/dotnet/CommonLocalizableStrings.resx index 77847a864..236b2fd26 100644 --- a/src/dotnet/CommonLocalizableStrings.resx +++ b/src/dotnet/CommonLocalizableStrings.resx @@ -619,6 +619,9 @@ setx PATH "%PATH%;{0}" Tool '{0}' (version '{1}') is already installed. + + Failed to find staged tool package '{0}'. + Column maximum width must be greater than zero. diff --git a/src/dotnet/ToolPackage/IToolPackage.cs b/src/dotnet/ToolPackage/IToolPackage.cs index 3ee968cb9..c769b002d 100644 --- a/src/dotnet/ToolPackage/IToolPackage.cs +++ b/src/dotnet/ToolPackage/IToolPackage.cs @@ -4,14 +4,15 @@ using System; using System.Collections.Generic; using Microsoft.Extensions.EnvironmentAbstractions; +using NuGet.Versioning; namespace Microsoft.DotNet.ToolPackage { internal interface IToolPackage { - string PackageId { get; } + PackageId Id { get; } - string PackageVersion { get; } + NuGetVersion Version { get; } DirectoryPath PackageDirectory { get; } diff --git a/src/dotnet/ToolPackage/IToolPackageInstaller.cs b/src/dotnet/ToolPackage/IToolPackageInstaller.cs index d8501d22d..c6ef964e1 100644 --- a/src/dotnet/ToolPackage/IToolPackageInstaller.cs +++ b/src/dotnet/ToolPackage/IToolPackageInstaller.cs @@ -4,14 +4,15 @@ using System; using System.Collections.Generic; using Microsoft.Extensions.EnvironmentAbstractions; +using NuGet.Versioning; namespace Microsoft.DotNet.ToolPackage { internal interface IToolPackageInstaller { IToolPackage InstallPackage( - string packageId, - string packageVersion = null, + PackageId packageId, + VersionRange versionRange = null, string targetFramework = null, FilePath? nugetConfig = null, string source = null, diff --git a/src/dotnet/ToolPackage/IToolPackageStore.cs b/src/dotnet/ToolPackage/IToolPackageStore.cs index 72105d24d..4e3e88c65 100644 --- a/src/dotnet/ToolPackage/IToolPackageStore.cs +++ b/src/dotnet/ToolPackage/IToolPackageStore.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using Microsoft.Extensions.EnvironmentAbstractions; +using NuGet.Versioning; namespace Microsoft.DotNet.ToolPackage { @@ -11,6 +12,18 @@ namespace Microsoft.DotNet.ToolPackage { DirectoryPath Root { get; } - IEnumerable GetInstalledPackages(string packageId = null); + DirectoryPath GetRandomStagingDirectory(); + + NuGetVersion GetStagedPackageVersion(DirectoryPath stagingDirectory, PackageId packageId); + + DirectoryPath GetRootPackageDirectory(PackageId packageId); + + DirectoryPath GetPackageDirectory(PackageId packageId, NuGetVersion version); + + IEnumerable EnumeratePackages(); + + IEnumerable EnumeratePackageVersions(PackageId packageId); + + IToolPackage GetPackage(PackageId packageId, NuGetVersion version); } } diff --git a/src/dotnet/ToolPackage/PackageId.cs b/src/dotnet/ToolPackage/PackageId.cs new file mode 100644 index 000000000..07846bf7a --- /dev/null +++ b/src/dotnet/ToolPackage/PackageId.cs @@ -0,0 +1,43 @@ +// 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.InternalAbstractions; + +namespace Microsoft.DotNet.ToolPackage +{ + internal struct PackageId : IEquatable, IComparable + { + private string _id; + + public PackageId(string id) + { + _id = id?.ToLowerInvariant() ?? throw new ArgumentNullException(nameof(id)); + } + + public bool Equals(PackageId other) + { + return ToString() == other.ToString(); + } + + public int CompareTo(PackageId other) + { + return string.Compare(ToString(), other.ToString(), StringComparison.Ordinal); + } + + public override bool Equals(object obj) + { + return obj is PackageId id && Equals(id); + } + + public override int GetHashCode() + { + return ToString().GetHashCode(); + } + + public override string ToString() + { + return _id ?? ""; + } + } +} diff --git a/src/dotnet/ToolPackage/ToolPackageInstaller.cs b/src/dotnet/ToolPackage/ToolPackageInstaller.cs index e30a4cc7e..cf655a301 100644 --- a/src/dotnet/ToolPackage/ToolPackageInstaller.cs +++ b/src/dotnet/ToolPackage/ToolPackageInstaller.cs @@ -7,13 +7,12 @@ using Microsoft.DotNet.Cli; using Microsoft.DotNet.Configurer; using Microsoft.DotNet.Tools; using Microsoft.Extensions.EnvironmentAbstractions; +using NuGet.Versioning; namespace Microsoft.DotNet.ToolPackage { internal class ToolPackageInstaller : IToolPackageInstaller { - public const string StagingDirectory = ".stage"; - private readonly IToolPackageStore _store; private readonly IProjectRestorer _projectRestorer; private readonly FilePath? _tempProject; @@ -32,33 +31,27 @@ namespace Microsoft.DotNet.ToolPackage } public IToolPackage InstallPackage( - string packageId, - string packageVersion = null, + PackageId packageId, + VersionRange versionRange = null, string targetFramework = null, FilePath? nugetConfig = null, string source = null, string verbosity = null) { - if (packageId == null) - { - throw new ArgumentNullException(nameof(packageId)); - } - - var packageRootDirectory = _store.Root.WithSubDirectories(packageId); + var packageRootDirectory = _store.GetRootPackageDirectory(packageId); string rollbackDirectory = null; return TransactionalAction.Run( action: () => { try { - - var stageDirectory = _store.Root.WithSubDirectories(StagingDirectory, Path.GetRandomFileName()); + var stageDirectory = _store.GetRandomStagingDirectory(); Directory.CreateDirectory(stageDirectory.Value); rollbackDirectory = stageDirectory.Value; var tempProject = CreateTempProject( packageId: packageId, - packageVersion: packageVersion, + versionRange: versionRange, targetFramework: targetFramework ?? BundledTargetFramework.GetTargetFrameworkMoniker(), restoreDirectory: stageDirectory); @@ -76,29 +69,22 @@ namespace Microsoft.DotNet.ToolPackage File.Delete(tempProject.Value); } - packageVersion = Path.GetFileName( - Directory.EnumerateDirectories( - stageDirectory.WithSubDirectories(packageId).Value).Single()); - - var packageDirectory = packageRootDirectory.WithSubDirectories(packageVersion); + var version = _store.GetStagedPackageVersion(stageDirectory, packageId); + var packageDirectory = _store.GetPackageDirectory(packageId, version); if (Directory.Exists(packageDirectory.Value)) { throw new ToolPackageException( string.Format( CommonLocalizableStrings.ToolPackageConflictPackageId, packageId, - packageVersion)); + version.ToNormalizedString())); } Directory.CreateDirectory(packageRootDirectory.Value); Directory.Move(stageDirectory.Value, packageDirectory.Value); rollbackDirectory = packageDirectory.Value; - return new ToolPackageInstance( - _store, - packageId, - packageVersion, - packageDirectory); + return new ToolPackageInstance(_store, packageId, version, packageDirectory); } catch (Exception ex) when (ex is UnauthorizedAccessException || ex is IOException) { @@ -126,8 +112,8 @@ namespace Microsoft.DotNet.ToolPackage } private FilePath CreateTempProject( - string packageId, - string packageVersion, + PackageId packageId, + VersionRange versionRange, string targetFramework, DirectoryPath restoreDirectory) { @@ -159,8 +145,9 @@ namespace Microsoft.DotNet.ToolPackage new XElement("DisableImplicitNuGetFallbackFolder", "true")), // disable SDK side implicit NuGetFallbackFolder new XElement("ItemGroup", new XElement("PackageReference", - new XAttribute("Include", packageId), - new XAttribute("Version", packageVersion ?? "*") // nuget will restore * for latest + new XAttribute("Include", packageId.ToString()), + new XAttribute("Version", + versionRange?.ToString("S", new VersionRangeFormatter()) ?? "*") // nuget will restore latest stable for * )) )); diff --git a/src/dotnet/ToolPackage/ToolPackageInstance.cs b/src/dotnet/ToolPackage/ToolPackageInstance.cs index 5841c2ef6..74b092109 100644 --- a/src/dotnet/ToolPackage/ToolPackageInstance.cs +++ b/src/dotnet/ToolPackage/ToolPackageInstance.cs @@ -6,6 +6,7 @@ using Microsoft.DotNet.Cli; using Microsoft.DotNet.Tools; using Microsoft.Extensions.EnvironmentAbstractions; using NuGet.ProjectModel; +using NuGet.Versioning; namespace Microsoft.DotNet.ToolPackage { @@ -17,20 +18,21 @@ namespace Microsoft.DotNet.ToolPackage public ToolPackageInstance( IToolPackageStore store, - string packageId, - string packageVersion, + PackageId id, + NuGetVersion version, DirectoryPath packageDirectory) { _store = store ?? throw new ArgumentNullException(nameof(store)); - PackageId = packageId ?? throw new ArgumentNullException(nameof(packageId)); - PackageVersion = packageVersion ?? throw new ArgumentNullException(nameof(packageVersion)); - PackageDirectory = packageDirectory; _commands = new Lazy>(GetCommands); + + Id = id; + Version = version ?? throw new ArgumentNullException(nameof(version)); + PackageDirectory = packageDirectory; } - public string PackageId { get; private set; } + public PackageId Id { get; private set; } - public string PackageVersion { get; private set; } + public NuGetVersion Version { get; private set; } public DirectoryPath PackageDirectory { get; private set; } @@ -53,13 +55,9 @@ namespace Microsoft.DotNet.ToolPackage { if (Directory.Exists(PackageDirectory.Value)) { - // Use the same staging directory for uninstall instead of temp + // Use the staging directory for uninstall // This prevents cross-device moves when temp is mounted to a different device - var tempPath = _store - .Root - .WithSubDirectories(ToolPackageInstaller.StagingDirectory) - .WithFile(Path.GetRandomFileName()) - .Value; + var tempPath = _store.GetRandomStagingDirectory().Value; Directory.Move(PackageDirectory.Value, tempPath); tempPackageDirectory = tempPath; } @@ -75,7 +73,7 @@ namespace Microsoft.DotNet.ToolPackage throw new ToolPackageException( string.Format( CommonLocalizableStrings.FailedToUninstallToolPackage, - PackageId, + Id, ex.Message), ex); } @@ -116,7 +114,7 @@ namespace Microsoft.DotNet.ToolPackage var toolConfigurationPath = PackageDirectory .WithSubDirectories( - PackageId, + Id.ToString(), library.Version.ToNormalizedString()) .WithFile(dotnetToolSettings.Path); @@ -138,7 +136,7 @@ namespace Microsoft.DotNet.ToolPackage "dotnet", PackageDirectory .WithSubDirectories( - PackageId, + Id.ToString(), library.Version.ToNormalizedString()) .WithFile(entryPointFromLockFile.Path))); @@ -158,7 +156,8 @@ namespace Microsoft.DotNet.ToolPackage { return lockFile ?.Targets?.SingleOrDefault(t => t.RuntimeIdentifier != null) - ?.Libraries?.SingleOrDefault(l => l.Name == PackageId); + ?.Libraries?.SingleOrDefault(l => + string.Compare(l.Name, Id.ToString(), StringComparison.CurrentCultureIgnoreCase) == 0); } private static LockFileItem FindItemInTargetLibrary(LockFileTargetLibrary library, string targetRelativeFilePath) diff --git a/src/dotnet/ToolPackage/ToolPackageStore.cs b/src/dotnet/ToolPackage/ToolPackageStore.cs index f9575a9cc..f424b6062 100644 --- a/src/dotnet/ToolPackage/ToolPackageStore.cs +++ b/src/dotnet/ToolPackage/ToolPackageStore.cs @@ -2,12 +2,16 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using Microsoft.DotNet.Tools; using Microsoft.Extensions.EnvironmentAbstractions; +using NuGet.Versioning; namespace Microsoft.DotNet.ToolPackage { internal class ToolPackageStore : IToolPackageStore { + public const string StagingDirectory = ".stage"; + public ToolPackageStore(DirectoryPath root) { Root = root; @@ -15,17 +19,45 @@ namespace Microsoft.DotNet.ToolPackage public DirectoryPath Root { get; private set; } - public IEnumerable GetInstalledPackages(string packageId = null) + public DirectoryPath GetRandomStagingDirectory() { - if (packageId != null) - { - return EnumerateVersions(packageId); - } - - return EnumerateAllPackages().SelectMany(p => p); + return Root.WithSubDirectories(StagingDirectory, Path.GetRandomFileName()); } - private IEnumerable> EnumerateAllPackages() + public NuGetVersion GetStagedPackageVersion(DirectoryPath stagingDirectory, PackageId packageId) + { + if (NuGetVersion.TryParse( + Path.GetFileName( + Directory.EnumerateDirectories( + stagingDirectory.WithSubDirectories(packageId.ToString()).Value).FirstOrDefault()), + out var version)) + { + return version; + } + + throw new ToolPackageException( + string.Format( + CommonLocalizableStrings.FailedToFindStagedToolPackage, + packageId)); + } + + public DirectoryPath GetRootPackageDirectory(PackageId packageId) + { + return Root.WithSubDirectories(packageId.ToString()); + } + + public DirectoryPath GetPackageDirectory(PackageId packageId, NuGetVersion version) + { + if (version == null) + { + throw new ArgumentNullException(nameof(version)); + } + + return GetRootPackageDirectory(packageId) + .WithSubDirectories(version.ToNormalizedString().ToLowerInvariant()); + } + + public IEnumerable EnumeratePackages() { if (!Directory.Exists(Root.Value)) { @@ -34,19 +66,25 @@ namespace Microsoft.DotNet.ToolPackage foreach (var subdirectory in Directory.EnumerateDirectories(Root.Value)) { - var packageId = Path.GetFileName(subdirectory); - if (packageId == ToolPackageInstaller.StagingDirectory) + var name = Path.GetFileName(subdirectory); + var packageId = new PackageId(name); + + // Ignore the staging directory and any directory that isn't the same as the package id + if (name == StagingDirectory || name != packageId.ToString()) { continue; } - yield return EnumerateVersions(packageId); + foreach (var package in EnumeratePackageVersions(packageId)) + { + yield return package; + } } } - private IEnumerable EnumerateVersions(string packageId) + public IEnumerable EnumeratePackageVersions(PackageId packageId) { - var packageRootDirectory = Root.WithSubDirectories(packageId); + var packageRootDirectory = Root.WithSubDirectories(packageId.ToString()); if (!Directory.Exists(packageRootDirectory.Value)) { yield break; @@ -54,13 +92,27 @@ namespace Microsoft.DotNet.ToolPackage foreach (var subdirectory in Directory.EnumerateDirectories(packageRootDirectory.Value)) { - var version = Path.GetFileName(subdirectory); yield return new ToolPackageInstance( this, packageId, - version, - packageRootDirectory.WithSubDirectories(version)); + NuGetVersion.Parse(Path.GetFileName(subdirectory)), + new DirectoryPath(subdirectory)); } } + + public IToolPackage GetPackage(PackageId packageId, NuGetVersion version) + { + if (version == null) + { + throw new ArgumentNullException(nameof(version)); + } + + var directory = GetPackageDirectory(packageId, version); + if (!Directory.Exists(directory.Value)) + { + return null; + } + return new ToolPackageInstance(this, packageId, version, directory); + } } } 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 881f81491..8459c2b55 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs @@ -13,6 +13,7 @@ using Microsoft.DotNet.Configurer; using Microsoft.DotNet.ShellShim; using Microsoft.DotNet.ToolPackage; using Microsoft.Extensions.EnvironmentAbstractions; +using NuGet.Versioning; namespace Microsoft.DotNet.Tools.Install.Tool { @@ -25,7 +26,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool private readonly IReporter _reporter; private readonly IReporter _errorReporter; - private readonly string _packageId; + private readonly PackageId _packageId; private readonly string _packageVersion; private readonly string _configFilePath; private readonly string _framework; @@ -48,7 +49,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool throw new ArgumentNullException(nameof(appliedCommand)); } - _packageId = appliedCommand.Arguments.Single(); + _packageId = new PackageId(appliedCommand.Arguments.Single()); _packageVersion = appliedCommand.ValueOrDefault("version"); _configFilePath = appliedCommand.ValueOrDefault("configfile"); _framework = appliedCommand.ValueOrDefault("framework"); @@ -91,8 +92,16 @@ namespace Microsoft.DotNet.Tools.Install.Tool Path.GetFullPath(_configFilePath))); } - // Prevent installation if any version of the package is installed - if (_toolPackageStore.GetInstalledPackages(_packageId).FirstOrDefault() != null) + VersionRange versionRange = null; + if (!string.IsNullOrEmpty(_packageVersion) && !VersionRange.TryParse(_packageVersion, out versionRange)) + { + throw new GracefulException( + string.Format( + LocalizableStrings.InvalidNuGetVersionRange, + _packageVersion)); + } + + if (_toolPackageStore.EnumeratePackageVersions(_packageId).FirstOrDefault() != null) { _errorReporter.WriteLine(string.Format(LocalizableStrings.ToolAlreadyInstalled, _packageId).Red()); return 1; @@ -113,7 +122,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool { package = _toolPackageInstaller.InstallPackage( packageId: _packageId, - packageVersion: _packageVersion, + versionRange: versionRange, targetFramework: _framework, nugetConfig: configFile, source: _source, @@ -133,8 +142,8 @@ namespace Microsoft.DotNet.Tools.Install.Tool string.Format( LocalizableStrings.InstallationSucceeded, string.Join(", ", package.Commands.Select(c => c.Name)), - package.PackageId, - package.PackageVersion).Green()); + package.Id, + package.Version.ToNormalizedString()).Green()); return 0; } catch (ToolPackageException ex) 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 8d366537c..2b463ae96 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/LocalizableStrings.resx +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/LocalizableStrings.resx @@ -178,4 +178,7 @@ Tool '{1}' (version '{2}') was successfully installed. Failed to create shell shim for tool '{0}': {1} + + Specified version '{0}' is not a valid NuGet version range. + \ No newline at end of file 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 eb8dae6d6..894f345b3 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 @@ -104,6 +104,11 @@ Instalace byla úspěšná. Pokud nejsou další pokyny, můžete přímo do já Balíček nástroje nebylo možné obnovit. + + Specified version '{0}' is not a valid NuGet version range. + Specified version '{0}' is not a valid NuGet version range. + + \ 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 941d48da4..2d551c8f0 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 @@ -104,6 +104,11 @@ Die Installation war erfolgreich. Sofern keine weiteren Anweisungen vorliegen, k Das Toolpaket konnte nicht wiederhergestellt werden. + + Specified version '{0}' is not a valid NuGet version range. + Specified version '{0}' is not a valid NuGet version range. + + \ 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 13656cbc9..1907042c2 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 @@ -104,6 +104,11 @@ La instalación se completó correctamente. Si no hay más instrucciones, puede No se puede restaurar el paquete de la herramienta. + + Specified version '{0}' is not a valid NuGet version range. + Specified version '{0}' is not a valid NuGet version range. + + \ 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 65a0f7bcd..217f901ca 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 @@ -104,6 +104,11 @@ L'installation a réussi. En l'absence d'instructions supplémentaires, vous pou Impossible de restaurer le package de l'outil. + + Specified version '{0}' is not a valid NuGet version range. + Specified version '{0}' is not a valid NuGet version range. + + \ 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 9ffb72dfb..69df9674e 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 @@ -104,6 +104,11 @@ L'installazione è riuscita. Se non ci sono altre istruzioni, è possibile digit Non è stato possibile ripristinare il pacchetto dello strumento. + + Specified version '{0}' is not a valid NuGet version range. + Specified version '{0}' is not a valid NuGet version range. + + \ 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 dd81fbb48..eb86d3b58 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 @@ -104,6 +104,11 @@ Tool '{1}' (version '{2}') was successfully installed. ツール パッケージを復元できませんでした。 + + Specified version '{0}' is not a valid NuGet version range. + Specified version '{0}' is not a valid NuGet version range. + + \ 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 79acf23a0..41b63aff0 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 @@ -104,6 +104,11 @@ Tool '{1}' (version '{2}') was successfully installed. 도구 패키지를 복원할 수 없습니다. + + Specified version '{0}' is not a valid NuGet version range. + Specified version '{0}' is not a valid NuGet version range. + + \ 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 95e8b774f..c77c195ab 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 @@ -104,6 +104,11 @@ Instalacja powiodła się. Jeśli nie ma dodatkowych instrukcji, możesz wpisać Nie można przywrócić pakietu narzędzia. + + Specified version '{0}' is not a valid NuGet version range. + Specified version '{0}' is not a valid NuGet version range. + + \ 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 d70b28da7..ab6c7b086 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 @@ -104,6 +104,11 @@ A instalação foi bem-sucedida. Se não houver outras instruções, digite o se O pacote da ferramenta não pôde ser restaurado. + + Specified version '{0}' is not a valid NuGet version range. + Specified version '{0}' is not a valid NuGet version range. + + \ 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 a3705f15d..d4b0de225 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 @@ -104,6 +104,11 @@ Tool '{1}' (version '{2}') was successfully installed. Не удалось восстановить пакет инструмента. + + Specified version '{0}' is not a valid NuGet version range. + Specified version '{0}' is not a valid NuGet version range. + + \ 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 a9dd17bb6..13ed942cf 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 @@ -104,6 +104,11 @@ Yükleme başarılı oldu. Daha fazla yönerge yoksa, çağırmak için şu komu Araç paketi geri yüklenemedi. + + Specified version '{0}' is not a valid NuGet version range. + Specified version '{0}' is not a valid NuGet version range. + + \ 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 840ebd25a..29f352687 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 @@ -104,6 +104,11 @@ Tool '{1}' (version '{2}') was successfully installed. 无法还原工具包。 + + Specified version '{0}' is not a valid NuGet version range. + Specified version '{0}' is not a valid NuGet version range. + + \ 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 1a75879a6..911527d54 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 @@ -104,6 +104,11 @@ Tool '{1}' (version '{2}') was successfully installed. 此工具套件無法還原。 + + Specified version '{0}' is not a valid NuGet version range. + Specified version '{0}' is not a valid NuGet version range. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-list/dotnet-list-tool/ListToolCommand.cs b/src/dotnet/commands/dotnet-list/dotnet-list-tool/ListToolCommand.cs index b732ba3a8..b567ac74d 100644 --- a/src/dotnet/commands/dotnet-list/dotnet-list-tool/ListToolCommand.cs +++ b/src/dotnet/commands/dotnet-list/dotnet-list-tool/ListToolCommand.cs @@ -46,10 +46,10 @@ namespace Microsoft.DotNet.Tools.List.Tool table.AddColumn( LocalizableStrings.PackageIdColumn, - p => p.PackageId); + p => p.Id.ToString()); table.AddColumn( LocalizableStrings.VersionColumn, - p => p.PackageVersion); + p => p.Version.ToNormalizedString()); table.AddColumn( LocalizableStrings.CommandsColumn, p => string.Join(CommandDelimiter, p.Commands.Select(c => c.Name))); @@ -60,9 +60,9 @@ namespace Microsoft.DotNet.Tools.List.Tool private IEnumerable GetPackages() { - return _toolPackageStore.GetInstalledPackages() + return _toolPackageStore.EnumeratePackages() .Where(PackageHasCommands) - .OrderBy(p => p.PackageId) + .OrderBy(p => p.Id) .ToArray(); } @@ -79,7 +79,7 @@ namespace Microsoft.DotNet.Tools.List.Tool _errorReporter.WriteLine( string.Format( LocalizableStrings.InvalidPackageWarning, - p.PackageId, + p.Id, ex.Message).Yellow()); return false; } diff --git a/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs index d362e3838..ca470f4a6 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs +++ b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs @@ -49,12 +49,11 @@ namespace Microsoft.DotNet.Tools.Uninstall.Tool throw new GracefulException(LocalizableStrings.UninstallToolCommandOnlySupportsGlobal); } - var packageId = _options.Arguments.Single(); + var packageId = new PackageId(_options.Arguments.Single()); IToolPackage package = null; - try { - package = _toolPackageStore.GetInstalledPackages(packageId).SingleOrDefault(); + package = _toolPackageStore.EnumeratePackageVersions(packageId).SingleOrDefault(); if (package == null) { _errorReporter.WriteLine( @@ -92,8 +91,8 @@ namespace Microsoft.DotNet.Tools.Uninstall.Tool _reporter.WriteLine( string.Format( LocalizableStrings.UninstallSucceeded, - package.PackageId, - package.PackageVersion).Green()); + package.Id, + package.Version.ToNormalizedString()).Green()); return 0; } catch (ToolPackageException ex) diff --git a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf index 8f0e7c10c..70be5e60b 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf @@ -853,6 +853,11 @@ setx PATH "%PATH%;{0}" Settings file 'DotnetToolSettings.xml' was not found in the package. + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf index 3a93064c3..6ef10330e 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf @@ -853,6 +853,11 @@ setx PATH "%PATH%;{0}" Settings file 'DotnetToolSettings.xml' was not found in the package. + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf index f283122ee..c9d3df366 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf @@ -853,6 +853,11 @@ setx PATH "%PATH%;{0}" Settings file 'DotnetToolSettings.xml' was not found in the package. + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf index 3a668e77f..ab0d6ae1f 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf @@ -853,6 +853,11 @@ setx PATH "%PATH%;{0}" Settings file 'DotnetToolSettings.xml' was not found in the package. + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf index 89d2e6f1e..6210b184f 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf @@ -853,6 +853,11 @@ setx PATH "%PATH%;{0}" Settings file 'DotnetToolSettings.xml' was not found in the package. + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf index 5d42dbf93..4541550f0 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf @@ -853,6 +853,11 @@ setx PATH "%PATH%;{0}" Settings file 'DotnetToolSettings.xml' was not found in the package. + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf index e136f3d5c..c9d93cce8 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf @@ -853,6 +853,11 @@ setx PATH "%PATH%;{0}" Settings file 'DotnetToolSettings.xml' was not found in the package. + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf index 0a2d70abc..2b22b4c8c 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf @@ -853,6 +853,11 @@ setx PATH "%PATH%;{0}" Settings file 'DotnetToolSettings.xml' was not found in the package. + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + \ 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 81b666a10..60b4b7863 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf @@ -853,6 +853,11 @@ setx PATH "%PATH%;{0}" Settings file 'DotnetToolSettings.xml' was not found in the package. + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf index 0926eee52..50ee839d2 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf @@ -853,6 +853,11 @@ setx PATH "%PATH%;{0}" Settings file 'DotnetToolSettings.xml' was not found in the package. + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf index 3d316c24f..a20c55ce0 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf @@ -853,6 +853,11 @@ setx PATH "%PATH%;{0}" Settings file 'DotnetToolSettings.xml' was not found in the package. + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + \ 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 b18d951b8..d26ed195d 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf @@ -853,6 +853,11 @@ setx PATH "%PATH%;{0}" Settings file 'DotnetToolSettings.xml' was not found in the package. + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + \ 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 8c61b8d28..fc901551e 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf @@ -853,6 +853,11 @@ setx PATH "%PATH%;{0}" Settings file 'DotnetToolSettings.xml' was not found in the package. + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + \ No newline at end of file diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs index 9c4bf61f5..46268c106 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs +++ b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs @@ -16,6 +16,7 @@ using Microsoft.DotNet.Tools.Install.Tool; using Microsoft.DotNet.Tools.Tests.ComponentMocks; using Microsoft.Extensions.DependencyModel.Tests; using Microsoft.Extensions.EnvironmentAbstractions; +using NuGet.Versioning; using Xunit; namespace Microsoft.DotNet.ToolPackage.Tests @@ -33,13 +34,13 @@ namespace Microsoft.DotNet.ToolPackage.Tests Action a = () => installer.InstallPackage( packageId: TestPackageId, - packageVersion: TestPackageVersion, + versionRange: VersionRange.Parse(TestPackageVersion), targetFramework: _testTargetframework); a.ShouldThrow().WithMessage(LocalizableStrings.ToolInstallationRestoreFailed); reporter.Lines.Count.Should().Be(1); - reporter.Lines[0].Should().Contain(TestPackageId); + reporter.Lines[0].Should().Contain(TestPackageId.ToString()); } [Theory] @@ -54,7 +55,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests var package = installer.InstallPackage( packageId: TestPackageId, - packageVersion: TestPackageVersion, + versionRange: VersionRange.Parse(TestPackageVersion), targetFramework: _testTargetframework); AssertPackageInstall(reporter, fileSystem, package, store); @@ -75,7 +76,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests var package = installer.InstallPackage( packageId: TestPackageId, - packageVersion: TestPackageVersion, + versionRange: VersionRange.Parse(TestPackageVersion), targetFramework: _testTargetframework, nugetConfig: nugetConfigPath); @@ -102,7 +103,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests { package = installer.InstallPackage( packageId: TestPackageId, - packageVersion: TestPackageVersion, + versionRange: VersionRange.Parse(TestPackageVersion), targetFramework: _testTargetframework, nugetConfig: nugetConfigPath); @@ -127,7 +128,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests var package = installer.InstallPackage( packageId: TestPackageId, - packageVersion: TestPackageVersion, + versionRange: VersionRange.Parse(TestPackageVersion), targetFramework: _testTargetframework, nugetConfig: nugetConfigPath); @@ -166,7 +167,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests var package = installer.InstallPackage( packageId: TestPackageId, - packageVersion: TestPackageVersion, + versionRange: VersionRange.Parse(TestPackageVersion), targetFramework: _testTargetframework); AssertPackageInstall(reporter, fileSystem, package, store); @@ -208,7 +209,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests var package = installer.InstallPackage( packageId: TestPackageId, - packageVersion: TestPackageVersion, + versionRange: VersionRange.Parse(TestPackageVersion), nugetConfig: nugetConfigPath); AssertPackageInstall(reporter, fileSystem, package, store); @@ -229,7 +230,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests var package = installer.InstallPackage( packageId: TestPackageId, - packageVersion: TestPackageVersion, + versionRange: VersionRange.Parse(TestPackageVersion), targetFramework: _testTargetframework, source: source); @@ -251,7 +252,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests TransactionScopeOption.Required, TimeSpan.Zero)) { - installer.InstallPackage("non.existent.package.id"); + installer.InstallPackage(new PackageId("non.existent.package.id")); t.Complete(); } @@ -282,7 +283,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests { installer.InstallPackage( packageId: TestPackageId, - packageVersion: TestPackageVersion, + versionRange: VersionRange.Parse(TestPackageVersion), targetFramework: _testTargetframework, source: source); @@ -314,7 +315,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests { Action first = () => installer.InstallPackage( packageId: TestPackageId, - packageVersion: TestPackageVersion, + versionRange: VersionRange.Parse(TestPackageVersion), targetFramework: _testTargetframework, source: source); @@ -322,7 +323,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests installer.InstallPackage( packageId: TestPackageId, - packageVersion: TestPackageVersion, + versionRange: VersionRange.Parse(TestPackageVersion), targetFramework: _testTargetframework, source: source); @@ -353,7 +354,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests var package = installer.InstallPackage( packageId: TestPackageId, - packageVersion: TestPackageVersion, + versionRange: VersionRange.Parse(TestPackageVersion), targetFramework: _testTargetframework, source: source); @@ -361,7 +362,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests Action secondCall = () => installer.InstallPackage( packageId: TestPackageId, - packageVersion: TestPackageVersion, + versionRange: VersionRange.Parse(TestPackageVersion), targetFramework: _testTargetframework, source: source); @@ -376,7 +377,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests fileSystem .Directory - .Exists(store.Root.WithSubDirectories(TestPackageId).Value) + .Exists(store.Root.WithSubDirectories(TestPackageId.ToString()).Value) .Should() .BeTrue(); @@ -384,7 +385,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests fileSystem .Directory - .EnumerateFileSystemEntries(store.Root.WithSubDirectories(".stage").Value) + .EnumerateFileSystemEntries(store.Root.WithSubDirectories(ToolPackageStore.StagingDirectory).Value) .Should() .BeEmpty(); } @@ -402,7 +403,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests var package = installer.InstallPackage( packageId: TestPackageId, - packageVersion: TestPackageVersion, + versionRange: VersionRange.Parse(TestPackageVersion), targetFramework: _testTargetframework, source: source); @@ -410,7 +411,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests package.Uninstall(); - store.GetInstalledPackages(TestPackageId).Should().BeEmpty(); + store.EnumeratePackages().Should().BeEmpty(); } [Theory] @@ -426,7 +427,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests var package = installer.InstallPackage( packageId: TestPackageId, - packageVersion: TestPackageVersion, + versionRange: VersionRange.Parse(TestPackageVersion), targetFramework: _testTargetframework, source: source); @@ -438,10 +439,10 @@ namespace Microsoft.DotNet.ToolPackage.Tests { package.Uninstall(); - store.GetInstalledPackages(TestPackageId).Should().BeEmpty(); + store.EnumeratePackages().Should().BeEmpty(); } - package = store.GetInstalledPackages(TestPackageId).First(); + package = store.EnumeratePackageVersions(TestPackageId).First(); AssertPackageInstall(reporter, fileSystem, package, store); } @@ -459,7 +460,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests var package = installer.InstallPackage( packageId: TestPackageId, - packageVersion: TestPackageVersion, + versionRange: VersionRange.Parse(TestPackageVersion), targetFramework: _testTargetframework, source: source); @@ -473,7 +474,28 @@ namespace Microsoft.DotNet.ToolPackage.Tests scope.Complete(); } - store.GetInstalledPackages(TestPackageId).Should().BeEmpty(); + store.EnumeratePackages().Should().BeEmpty(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAPackageNameWithDifferentCaseItCanInstallThePackage(bool testMockBehaviorIsInSync) + { + var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); + + var (store, installer, reporter, fileSystem) = Setup( + useMock: testMockBehaviorIsInSync, + feeds: GetMockFeedsForConfigFile(nugetConfigPath)); + + var package = installer.InstallPackage( + packageId: new PackageId("GlObAl.TooL.coNsoLe.DemO"), + targetFramework: _testTargetframework, + nugetConfig: nugetConfigPath); + + AssertPackageInstall(reporter, fileSystem, package, store); + + package.Uninstall(); } private static void AssertPackageInstall( @@ -484,11 +506,14 @@ namespace Microsoft.DotNet.ToolPackage.Tests { reporter.Lines.Should().BeEmpty(); - package.PackageId.Should().Be(TestPackageId); - package.PackageVersion.Should().Be(TestPackageVersion); + package.Id.Should().Be(TestPackageId); + package.Version.ToNormalizedString().Should().Be(TestPackageVersion); package.PackageDirectory.Value.Should().Contain(store.Root.Value); - store.GetInstalledPackages(TestPackageId).Select(p => p.PackageVersion).Should().Equal(TestPackageVersion); + store.EnumeratePackageVersions(TestPackageId) + .Select(p => p.Version.ToNormalizedString()) + .Should() + .Equal(TestPackageVersion); package.Commands.Count.Should().Be(1); fileSystem.File.Exists(package.Commands[0].Executable.Value).Should().BeTrue($"{package.Commands[0].Executable.Value} should exist"); @@ -506,11 +531,11 @@ namespace Microsoft.DotNet.ToolPackage.Tests .Directory .EnumerateFileSystemEntries(store.Root.Value) .Should() - .NotContain(e => Path.GetFileName(e) != ".stage"); + .NotContain(e => Path.GetFileName(e) != ToolPackageStore.StagingDirectory); fileSystem .Directory - .EnumerateFileSystemEntries(store.Root.WithSubDirectories(".stage").Value) + .EnumerateFileSystemEntries(store.Root.WithSubDirectories(ToolPackageStore.StagingDirectory).Value) .Should() .BeEmpty(); } @@ -536,7 +561,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests { new MockFeedPackage { - PackageId = TestPackageId, + PackageId = TestPackageId.ToString(), Version = TestPackageVersion } } @@ -556,7 +581,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests { new MockFeedPackage { - PackageId = TestPackageId, + PackageId = TestPackageId.ToString(), Version = TestPackageVersion } } @@ -576,7 +601,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests { new MockFeedPackage { - PackageId = TestPackageId, + PackageId = TestPackageId.ToString(), Version = TestPackageVersion } } @@ -642,6 +667,6 @@ namespace Microsoft.DotNet.ToolPackage.Tests private static string GetTestLocalFeedPath() => Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestAssetLocalNugetFeed"); private readonly string _testTargetframework = BundledTargetFramework.GetTargetFrameworkMoniker(); private const string TestPackageVersion = "1.0.4"; - private const string TestPackageId = "global.tool.console.demo"; + private static readonly PackageId TestPackageId = new PackageId("global.tool.console.demo"); } } diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ProjectRestorerMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ProjectRestorerMock.cs index 2bdb35820..f4f280df5 100644 --- a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ProjectRestorerMock.cs +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ProjectRestorerMock.cs @@ -11,6 +11,7 @@ using Microsoft.DotNet.ToolPackage; using Microsoft.DotNet.Tools; using Microsoft.DotNet.Tools.Install.Tool; using Microsoft.Extensions.EnvironmentAbstractions; +using NuGet.Versioning; namespace Microsoft.DotNet.Tools.Tests.ComponentMocks { @@ -63,7 +64,7 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks string verbosity = null) { string packageId; - string packageVersion; + VersionRange versionRange; string targetFramework; try @@ -77,7 +78,7 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks } packageId = tokens[0]; - packageVersion = tokens[1]; + versionRange = VersionRange.Parse(tokens[1]); targetFramework = tokens[2]; } catch (IOException) @@ -92,16 +93,16 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks var feedPackage = GetPackage( packageId, - packageVersion, + versionRange, nugetConfig, source); - packageVersion = feedPackage.Version; + var packageVersion = feedPackage.Version; targetFramework = string.IsNullOrEmpty(targetFramework) ? "targetFramework" : targetFramework; var fakeExecutableSubDirectory = Path.Combine( - packageId, - packageVersion, + packageId.ToLowerInvariant(), + packageVersion.ToLowerInvariant(), "tools", targetFramework, "any"); @@ -116,7 +117,7 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks private MockFeedPackage GetPackage( string packageId, - string packageVersion = null, + VersionRange versionRange = null, FilePath? nugetConfig = null, string source = null) { @@ -133,7 +134,7 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks return true; }) .SelectMany(f => f.Packages) - .Where(p => MatchPackageVersion(p, packageId, packageVersion)).OrderByDescending(p => p.Version) + .Where(p => MatchPackage(p, packageId, versionRange)).OrderByDescending(p => p.Version) .FirstOrDefault(); if (package == null) @@ -148,13 +149,15 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks return package; } - private static bool MatchPackageVersion(MockFeedPackage p, string packageId, string packageVersion) + private static bool MatchPackage(MockFeedPackage p, string packageId, VersionRange versionRange) { - if (string.IsNullOrEmpty(packageVersion)) + if (string.Compare(p.PackageId, packageId, StringComparison.CurrentCultureIgnoreCase) != 0) { - return p.PackageId == packageId; + return false; } - return p.PackageId == packageId && p.Version == packageVersion; + + return versionRange == null || + versionRange.FindBestMatch(new[] { NuGetVersion.Parse(p.Version) }) != null; } } } diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageInstallerMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageInstallerMock.cs index cce1000f5..9966ddb6a 100644 --- a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageInstallerMock.cs +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageInstallerMock.cs @@ -10,6 +10,7 @@ using Microsoft.DotNet.Cli; using Microsoft.DotNet.ToolPackage; using Microsoft.DotNet.Tools; using Microsoft.Extensions.EnvironmentAbstractions; +using NuGet.Versioning; namespace Microsoft.DotNet.Tools.Tests.ComponentMocks { @@ -35,19 +36,19 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks } public IToolPackage InstallPackage( - string packageId, - string packageVersion = null, + PackageId packageId, + VersionRange versionRange = null, string targetFramework = null, FilePath? nugetConfig = null, string source = null, string verbosity = null) { - var packageRootDirectory = _store.Root.WithSubDirectories(packageId); + var packageRootDirectory = _store.GetRootPackageDirectory(packageId); string rollbackDirectory = null; return TransactionalAction.Run( action: () => { - var stageDirectory = _store.Root.WithSubDirectories(".stage", Path.GetRandomFileName()); + var stageDirectory = _store.GetRandomStagingDirectory(); _fileSystem.Directory.CreateDirectory(stageDirectory.Value); rollbackDirectory = stageDirectory.Value; @@ -56,7 +57,7 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks // Write a fake project with the requested package id, version, and framework _fileSystem.File.WriteAllText( tempProject.Value, - $"{packageId}:{packageVersion}:{targetFramework}"); + $"{packageId}:{versionRange?.ToString("S", new VersionRangeFormatter()) ?? "*"}:{targetFramework}"); // Perform a restore on the fake project _projectRestorer.Restore( @@ -71,29 +72,22 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks _installCallback(); } - packageVersion = Path.GetFileName( - _fileSystem.Directory.EnumerateFileSystemEntries( - stageDirectory.WithSubDirectories(packageId).Value).Single()); - - var packageDirectory = packageRootDirectory.WithSubDirectories(packageVersion); + var version = _store.GetStagedPackageVersion(stageDirectory, packageId); + var packageDirectory = _store.GetPackageDirectory(packageId, version); if (_fileSystem.Directory.Exists(packageDirectory.Value)) { throw new ToolPackageException( string.Format( CommonLocalizableStrings.ToolPackageConflictPackageId, packageId, - packageVersion)); + version.ToNormalizedString())); } _fileSystem.Directory.CreateDirectory(packageRootDirectory.Value); _fileSystem.Directory.Move(stageDirectory.Value, packageDirectory.Value); rollbackDirectory = packageDirectory.Value; - return new ToolPackageMock( - _fileSystem, - packageId, - packageVersion, - packageDirectory); + return new ToolPackageMock(_fileSystem, packageId, version, packageDirectory); }, rollback: () => { if (rollbackDirectory != null && _fileSystem.Directory.Exists(rollbackDirectory)) diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageMock.cs index 5e968a288..6ad826441 100644 --- a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageMock.cs +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageMock.cs @@ -8,6 +8,7 @@ using System.Linq; using Microsoft.DotNet.Cli; using Microsoft.DotNet.ToolPackage; using Microsoft.Extensions.EnvironmentAbstractions; +using NuGet.Versioning; namespace Microsoft.DotNet.Tools.Tests.ComponentMocks { @@ -19,22 +20,22 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks public ToolPackageMock( IFileSystem fileSystem, - string packageId, - string packageVersion, + PackageId id, + NuGetVersion version, DirectoryPath packageDirectory, Action uninstallCallback = null) { _fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)); - PackageId = packageId ?? throw new ArgumentNullException(nameof(packageId)); - PackageVersion = packageVersion ?? throw new ArgumentNullException(nameof(packageVersion)); + Id = id; + Version = version ?? throw new ArgumentNullException(nameof(version)); PackageDirectory = packageDirectory; _commands = new Lazy>(GetCommands); _uninstallCallback = uninstallCallback; } - public string PackageId { get; private set; } + public PackageId Id { get; private set; } - public string PackageVersion { get; private set; } + public NuGetVersion Version { get; private set; } public DirectoryPath PackageDirectory { get; private set; } @@ -78,7 +79,7 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks throw new ToolPackageException( string.Format( CommonLocalizableStrings.FailedToUninstallToolPackage, - PackageId, + Id, ex.Message), ex); } @@ -118,7 +119,7 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks throw new ToolPackageException( string.Format( CommonLocalizableStrings.FailedToRetrieveToolConfiguration, - PackageId, + Id, ex.Message), ex); } diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageStoreMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageStoreMock.cs index 4681d3123..e8219560c 100644 --- a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageStoreMock.cs +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageStoreMock.cs @@ -8,6 +8,7 @@ using System.Linq; using Microsoft.DotNet.Cli; using Microsoft.DotNet.ToolPackage; using Microsoft.Extensions.EnvironmentAbstractions; +using NuGet.Versioning; namespace Microsoft.DotNet.Tools.Tests.ComponentMocks { @@ -28,9 +29,66 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks public DirectoryPath Root { get; private set; } - public IEnumerable GetInstalledPackages(string packageId) + public DirectoryPath GetRandomStagingDirectory() { - var packageRootDirectory = Root.WithSubDirectories(packageId); + return Root.WithSubDirectories(ToolPackageStore.StagingDirectory, Path.GetRandomFileName()); + } + + public NuGetVersion GetStagedPackageVersion(DirectoryPath stagingDirectory, PackageId packageId) + { + if (NuGetVersion.TryParse( + Path.GetFileName( + _fileSystem.Directory.EnumerateFileSystemEntries( + stagingDirectory.WithSubDirectories(packageId.ToString()).Value).FirstOrDefault()), + out var version)) + { + return version; + } + + throw new ToolPackageException( + string.Format( + CommonLocalizableStrings.FailedToFindStagedToolPackage, + packageId)); + } + + public DirectoryPath GetRootPackageDirectory(PackageId packageId) + { + return Root.WithSubDirectories(packageId.ToString()); + } + + public DirectoryPath GetPackageDirectory(PackageId packageId, NuGetVersion version) + { + return GetRootPackageDirectory(packageId) + .WithSubDirectories(version.ToNormalizedString().ToLowerInvariant()); + } + + public IEnumerable EnumeratePackages() + { + if (!_fileSystem.Directory.Exists(Root.Value)) + { + yield break; + } + + foreach (var subdirectory in _fileSystem.Directory.EnumerateFileSystemEntries(Root.Value)) + { + var name = Path.GetFileName(subdirectory); + var packageId = new PackageId(name); + + if (name == ToolPackageStore.StagingDirectory || name != packageId.ToString()) + { + continue; + } + + foreach (var package in EnumeratePackageVersions(packageId)) + { + yield return package; + } + } + } + + public IEnumerable EnumeratePackageVersions(PackageId packageId) + { + var packageRootDirectory = Root.WithSubDirectories(packageId.ToString()); if (!_fileSystem.Directory.Exists(packageRootDirectory.Value)) { yield break; @@ -38,14 +96,23 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks foreach (var subdirectory in _fileSystem.Directory.EnumerateFileSystemEntries(packageRootDirectory.Value)) { - var version = Path.GetFileName(subdirectory); yield return new ToolPackageMock( _fileSystem, packageId, - version, - packageRootDirectory.WithSubDirectories(version), + NuGetVersion.Parse(Path.GetFileName(subdirectory)), + new DirectoryPath(subdirectory), _uninstallCallback); } } + + public IToolPackage GetPackage(PackageId packageId, NuGetVersion version) + { + var directory = GetPackageDirectory(packageId, version); + if (!_fileSystem.Directory.Exists(directory.Value)) + { + return null; + } + return new ToolPackageMock(_fileSystem, packageId, version, directory, _uninstallCallback); + } } } diff --git a/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs b/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs index 1a1f140b0..15b626428 100644 --- a/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs @@ -148,17 +148,12 @@ namespace Microsoft.DotNet.Tests.Commands installToolCommand.Execute().Should().Be(1); - _reporter.Lines.Count.Should().Be(2); - _reporter - .Lines[0] + .Lines .Should() - .Contain("Simulated error"); - - _reporter - .Lines[1] - .Should() - .Contain(string.Format(LocalizableStrings.ToolInstallationFailed, PackageId)); + .Equal( + "Simulated error".Red(), + string.Format(LocalizableStrings.ToolInstallationFailed, PackageId).Red()); _fileSystem.Directory.Exists(Path.Combine(PathToPlacePackages, PackageId)).Should().BeFalse(); } @@ -205,20 +200,14 @@ namespace Microsoft.DotNet.Tests.Commands installToolCommand.Execute().Should().Be(1); - _reporter.Lines.Count.Should().Be(2); - _reporter - .Lines[0] + .Lines .Should() - .Contain( + .Equal( string.Format( LocalizableStrings.InvalidToolConfiguration, - "Simulated error")); - - _reporter - .Lines[1] - .Should() - .Contain(string.Format(LocalizableStrings.ToolInstallationFailedContactAuthor, PackageId)); + "Simulated error").Red(), + string.Format(LocalizableStrings.ToolInstallationFailedContactAuthor, PackageId).Red()); } [Fact] @@ -237,13 +226,144 @@ namespace Microsoft.DotNet.Tests.Commands _reporter .Lines - .Single() .Should() - .Contain(string.Format( + .Equal(string.Format( LocalizableStrings.InstallationSucceeded, ProjectRestorerMock.FakeCommandName, PackageId, - PackageVersion)); + PackageVersion).Green()); + } + + [Fact] + public void WhenRunWithInvalidVersionItShouldThrow() + { + const string invalidVersion = "!NotValidVersion!"; + ParseResult result = Parser.Instance.Parse($"dotnet install tool -g {PackageId} --version {invalidVersion}"); + AppliedOption appliedCommand = result["dotnet"]["install"]["tool"]; + + var installToolCommand = new InstallToolCommand( + appliedCommand, + result, + _toolPackageStore, + CreateToolPackageInstaller(), + _shellShimRepositoryMock, + new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true), + _reporter); + + Action action = () => installToolCommand.Execute(); + + action + .ShouldThrow() + .WithMessage(string.Format( + LocalizableStrings.InvalidNuGetVersionRange, + invalidVersion)); + } + + [Fact] + public void WhenRunWithExactVersionItShouldSucceed() + { + ParseResult result = Parser.Instance.Parse($"dotnet install tool -g {PackageId} --version {PackageVersion}"); + AppliedOption appliedCommand = result["dotnet"]["install"]["tool"]; + + var installToolCommand = new InstallToolCommand( + appliedCommand, + result, + _toolPackageStore, + CreateToolPackageInstaller(), + _shellShimRepositoryMock, + new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true), + _reporter); + + installToolCommand.Execute().Should().Be(0); + + _reporter + .Lines + .Should() + .Equal(string.Format( + LocalizableStrings.InstallationSucceeded, + ProjectRestorerMock.FakeCommandName, + PackageId, + PackageVersion).Green()); + } + + [Fact] + public void WhenRunWithValidVersionRangeItShouldSucceed() + { + ParseResult result = Parser.Instance.Parse($"dotnet install tool -g {PackageId} --version [1.0,2.0]"); + AppliedOption appliedCommand = result["dotnet"]["install"]["tool"]; + + var installToolCommand = new InstallToolCommand( + appliedCommand, + result, + _toolPackageStore, + CreateToolPackageInstaller(), + _shellShimRepositoryMock, + new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true), + _reporter); + + installToolCommand.Execute().Should().Be(0); + + _reporter + .Lines + .Should() + .Equal(string.Format( + LocalizableStrings.InstallationSucceeded, + ProjectRestorerMock.FakeCommandName, + PackageId, + PackageVersion).Green()); + } + + [Fact] + public void WhenRunWithoutAMatchingRangeItShouldFail() + { + ParseResult result = Parser.Instance.Parse($"dotnet install tool -g {PackageId} --version [5.0,10.0]"); + AppliedOption appliedCommand = result["dotnet"]["install"]["tool"]; + + var installToolCommand = new InstallToolCommand( + appliedCommand, + result, + _toolPackageStore, + CreateToolPackageInstaller(), + _shellShimRepositoryMock, + new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true), + _reporter); + + installToolCommand.Execute().Should().Be(1); + + _reporter + .Lines + .Should() + .Equal( + $"Error: failed to restore package {PackageId}.", // From mock implementation, not localized + LocalizableStrings.ToolInstallationRestoreFailed.Red(), + string.Format(LocalizableStrings.ToolInstallationFailed, PackageId).Red()); + } + + [Fact] + public void WhenRunWithValidVersionWildcardItShouldSucceed() + { + ParseResult result = Parser.Instance.Parse($"dotnet install tool -g {PackageId} --version 1.0.*"); + AppliedOption appliedCommand = result["dotnet"]["install"]["tool"]; + + var installToolCommand = new InstallToolCommand( + appliedCommand, + result, + _toolPackageStore, + CreateToolPackageInstaller(), + _shellShimRepositoryMock, + new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true), + _reporter); + + installToolCommand.Execute().Should().Be(0); + + _reporter + .Lines + .Should() + .Equal(string.Format( + LocalizableStrings.InstallationSucceeded, + ProjectRestorerMock.FakeCommandName, + PackageId, + PackageVersion).Green()); } private IToolPackageInstaller CreateToolPackageInstaller( From da90a08ada0e91992e6bb3ed060dffe780af6531 Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Fri, 2 Mar 2018 14:35:23 -0800 Subject: [PATCH 076/103] Implement tests for the list tool command. This commit implements tests for the `list tool` command. --- src/dotnet/Properties/AssemblyInfo.cs | 1 + .../CommandTests/ListToolCommandTests.cs | 261 ++++++++++++++++++ test/dotnet.Tests/dotnet.Tests.csproj | 2 + 3 files changed, 264 insertions(+) create mode 100644 test/dotnet.Tests/CommandTests/ListToolCommandTests.cs diff --git a/src/dotnet/Properties/AssemblyInfo.cs b/src/dotnet/Properties/AssemblyInfo.cs index 25bd8cb8c..b5f0b8fe0 100644 --- a/src/dotnet/Properties/AssemblyInfo.cs +++ b/src/dotnet/Properties/AssemblyInfo.cs @@ -21,3 +21,4 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Microsoft.DotNet.Tools.Tests.ComponentMocks, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.DotNet.ToolPackage.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.DotNet.ShellShim.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] diff --git a/test/dotnet.Tests/CommandTests/ListToolCommandTests.cs b/test/dotnet.Tests/CommandTests/ListToolCommandTests.cs new file mode 100644 index 000000000..3b764abb4 --- /dev/null +++ b/test/dotnet.Tests/CommandTests/ListToolCommandTests.cs @@ -0,0 +1,261 @@ +// 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 System.Collections.Generic; +using System.IO; +using System.Linq; +using FluentAssertions; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.CommandLine; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.ToolPackage; +using Microsoft.DotNet.Tools; +using Microsoft.DotNet.Tools.List.Tool; +using Microsoft.DotNet.Tools.Test.Utilities; +using Microsoft.Extensions.DependencyModel.Tests; +using Microsoft.Extensions.EnvironmentAbstractions; +using Moq; +using NuGet.Versioning; +using Xunit; +using Parser = Microsoft.DotNet.Cli.Parser; +using LocalizableStrings = Microsoft.DotNet.Tools.List.Tool.LocalizableStrings; + +namespace Microsoft.DotNet.Tests.Commands +{ + public class ListToolCommandTests + { + private readonly BufferedReporter _reporter; + + public ListToolCommandTests() + { + _reporter = new BufferedReporter(); + } + + [Fact] + public void GivenAMissingGlobalOptionItErrors() + { + var store = new Mock(MockBehavior.Strict); + + var command = CreateCommand(store.Object); + + Action a = () => { + command.Execute(); + }; + + a.ShouldThrow() + .And + .Message + .Should() + .Be(LocalizableStrings.ListToolCommandOnlySupportsGlobal); + } + + [Fact] + public void GivenNoInstalledPackagesItPrintsEmptyTable() + { + var store = new Mock(MockBehavior.Strict); + store + .Setup(s => s.EnumeratePackages()) + .Returns(new IToolPackage[0]); + + var command = CreateCommand(store.Object, "-g"); + + command.Execute().Should().Be(0); + + _reporter.Lines.Should().Equal( + string.Format( + "{0} {1} {2}", + LocalizableStrings.PackageIdColumn, + LocalizableStrings.VersionColumn, + LocalizableStrings.CommandsColumn + ), + "-------------------------------------"); + } + + [Fact] + public void GivenASingleInstalledPackageItPrintsThePackage() + { + var store = new Mock(MockBehavior.Strict); + store + .Setup(s => s.EnumeratePackages()) + .Returns(new[] { + CreateMockToolPackage( + "test.tool", + "1.3.5-preview", + new[] { + new CommandSettings("foo", "dotnet", new FilePath("tool")) + } + ) + }); + + var command = CreateCommand(store.Object, "-g"); + + command.Execute().Should().Be(0); + + _reporter.Lines.Should().Equal( + string.Format( + "{0} {1} {2}", + LocalizableStrings.PackageIdColumn, + LocalizableStrings.VersionColumn, + LocalizableStrings.CommandsColumn + ), + "-------------------------------------------", + "test.tool 1.3.5-preview foo "); + } + + [Fact] + public void GivenMultipleInstalledPackagesItPrintsThePackages() + { + var store = new Mock(MockBehavior.Strict); + store + .Setup(s => s.EnumeratePackages()) + .Returns(new[] { + CreateMockToolPackage( + "test.tool", + "1.3.5-preview", + new[] { + new CommandSettings("foo", "dotnet", new FilePath("tool")) + } + ), + CreateMockToolPackage( + "another.tool", + "2.7.3", + new[] { + new CommandSettings("bar", "dotnet", new FilePath("tool")) + } + ), + CreateMockToolPackage( + "some.tool", + "1.0.0", + new[] { + new CommandSettings("fancy-foo", "dotnet", new FilePath("tool")) + } + ) + }); + + var command = CreateCommand(store.Object, "-g"); + + command.Execute().Should().Be(0); + + _reporter.Lines.Should().Equal( + string.Format( + "{0} {1} {2} ", + LocalizableStrings.PackageIdColumn, + LocalizableStrings.VersionColumn, + LocalizableStrings.CommandsColumn + ), + "----------------------------------------------", + "another.tool 2.7.3 bar ", + "some.tool 1.0.0 fancy-foo", + "test.tool 1.3.5-preview foo "); + } + + [Fact] + public void GivenAPackageWithMultipleCommandsItListsThem() + { + var store = new Mock(MockBehavior.Strict); + store + .Setup(s => s.EnumeratePackages()) + .Returns(new[] { + CreateMockToolPackage( + "test.tool", + "1.3.5-preview", + new[] { + new CommandSettings("foo", "dotnet", new FilePath("tool")), + new CommandSettings("bar", "dotnet", new FilePath("tool")), + new CommandSettings("baz", "dotnet", new FilePath("tool")) + } + ) + }); + + var command = CreateCommand(store.Object, "-g"); + + command.Execute().Should().Be(0); + + _reporter.Lines.Should().Equal( + string.Format( + "{0} {1} {2} ", + LocalizableStrings.PackageIdColumn, + LocalizableStrings.VersionColumn, + LocalizableStrings.CommandsColumn + ), + "------------------------------------------------", + "test.tool 1.3.5-preview foo, bar, baz"); + } + + [Fact] + public void GivenABrokenPackageItPrintsWarning() + { + var store = new Mock(MockBehavior.Strict); + store + .Setup(s => s.EnumeratePackages()) + .Returns(new[] { + CreateMockToolPackage( + "test.tool", + "1.3.5-preview", + new[] { + new CommandSettings("foo", "dotnet", new FilePath("tool")) + } + ), + CreateMockBrokenPackage("another.tool", "2.7.3"), + CreateMockToolPackage( + "some.tool", + "1.0.0", + new[] { + new CommandSettings("fancy-foo", "dotnet", new FilePath("tool")) + } + ) + }); + + var command = CreateCommand(store.Object, "-g"); + + command.Execute().Should().Be(0); + + _reporter.Lines.Should().Equal( + string.Format( + LocalizableStrings.InvalidPackageWarning, + "another.tool", + "broken" + ).Yellow(), + string.Format( + "{0} {1} {2} ", + LocalizableStrings.PackageIdColumn, + LocalizableStrings.VersionColumn, + LocalizableStrings.CommandsColumn + ), + "--------------------------------------------", + "some.tool 1.0.0 fancy-foo", + "test.tool 1.3.5-preview foo "); + } + + private IToolPackage CreateMockToolPackage(string id, string version, IReadOnlyList commands) + { + var package = new Mock(MockBehavior.Strict); + + package.SetupGet(p => p.Id).Returns(new PackageId(id)); + package.SetupGet(p => p.Version).Returns(NuGetVersion.Parse(version)); + package.SetupGet(p => p.Commands).Returns(commands); + return package.Object; + } + + private IToolPackage CreateMockBrokenPackage(string id, string version) + { + var package = new Mock(MockBehavior.Strict); + + package.SetupGet(p => p.Id).Returns(new PackageId(id)); + package.SetupGet(p => p.Version).Returns(NuGetVersion.Parse(version)); + package.SetupGet(p => p.Commands).Throws(new ToolConfigurationException("broken")); + return package.Object; + } + + private ListToolCommand CreateCommand(IToolPackageStore store, string options = "") + { + ParseResult result = Parser.Instance.Parse("dotnet list tool " + options); + return new ListToolCommand( + result["dotnet"]["list"]["tool"], + result, + store, + _reporter); + } + } +} diff --git a/test/dotnet.Tests/dotnet.Tests.csproj b/test/dotnet.Tests/dotnet.Tests.csproj index 561d03b72..7d080f445 100644 --- a/test/dotnet.Tests/dotnet.Tests.csproj +++ b/test/dotnet.Tests/dotnet.Tests.csproj @@ -81,7 +81,9 @@ + + From a4eaae7155df63163f51013c80fe54e386497073 Mon Sep 17 00:00:00 2001 From: dotnet-bot Date: Tue, 6 Mar 2018 10:11:12 +0000 Subject: [PATCH 077/103] Update CoreSetup, CoreSetup, CoreSetup, Roslyn to preview2-26306-03, preview2-26306-03, preview2-26306-03, beta1-62628-07, respectively --- build/DependencyVersions.props | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 39cf842ab..3b5da77df 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -2,7 +2,7 @@ 2.1.0-preview2-30171 - 2.1.0-preview2-26227-01 + 2.1.0-preview2-26306-03 $(MicrosoftNETCoreAppPackageVersion) 15.7.0-preview-000063 $(MicrosoftBuildPackageVersion) @@ -10,7 +10,7 @@ $(MicrosoftBuildPackageVersion) $(MicrosoftBuildPackageVersion) 10.1.4-rtm-180213-0 - 2.8.0-beta1-62608-01 + 2.8.0-beta1-62628-07 $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) @@ -28,8 +28,8 @@ $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) - 2.1.0-preview2-26227-01 - 2.1.0-preview2-26227-01 + 2.1.0-preview2-26306-03 + 2.1.0-preview2-26306-03 0.1.1-alpha-174 1.2.1-alpha-002133 $(MicrosoftDotNetProjectJsonMigrationPackageVersion) From 3d1caf1d63fc6108a80dddca05cd513946d30bad Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Tue, 6 Mar 2018 09:23:25 -0600 Subject: [PATCH 078/103] Revert Roslyn update In order to isolate the changes to find the break. --- build/DependencyVersions.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 3b5da77df..7a6c20fdf 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -10,7 +10,7 @@ $(MicrosoftBuildPackageVersion) $(MicrosoftBuildPackageVersion) 10.1.4-rtm-180213-0 - 2.8.0-beta1-62628-07 + 2.8.0-beta1-62608-01 $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) @@ -69,4 +69,4 @@ 2.0.0-preview2-25331-01 - \ No newline at end of file + From 9178360c5416fc61524e3415cc68d3de428f56f9 Mon Sep 17 00:00:00 2001 From: Andy Gerlicher Date: Tue, 6 Mar 2018 10:05:22 -0800 Subject: [PATCH 079/103] MSBuild 15.7.66 --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 39cf842ab..abc431c7f 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -4,7 +4,7 @@ 2.1.0-preview2-30171 2.1.0-preview2-26227-01 $(MicrosoftNETCoreAppPackageVersion) - 15.7.0-preview-000063 + 15.7.0-preview-000066 $(MicrosoftBuildPackageVersion) $(MicrosoftBuildPackageVersion) $(MicrosoftBuildPackageVersion) From 1d38617765923a35deb91dfa6319320c1d148dcb Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 6 Mar 2018 14:25:44 -0800 Subject: [PATCH 080/103] Update AspNetCore and WebSdk versions --- build/DependencyVersions.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 7a6c20fdf..c2405642c 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -1,7 +1,7 @@ - 2.1.0-preview2-30171 + 2.1.0-preview2-30248 2.1.0-preview2-26306-03 $(MicrosoftNETCoreAppPackageVersion) 15.7.0-preview-000063 @@ -16,8 +16,8 @@ $(MicrosoftCodeAnalysisCSharpPackageVersion) 2.1.300-preview2-62628-06 $(MicrosoftNETSdkPackageVersion) - 2.1.0-preview2-30169 - 2.1.300-preview2-20180221-1406058 + $(MicrosoftAspNetCoreAppPackageVersion) + 2.1.300-preview2-20180306-1448279 $(MicrosoftNETSdkWebPackageVersion) $(MicrosoftNETSdkWebPackageVersion) 1.0.1-beta3-20180104-1263555 From 0598e6cb704c79570cac0ca2e7467f69ce139318 Mon Sep 17 00:00:00 2001 From: William Lee Date: Tue, 6 Mar 2018 15:58:05 -0800 Subject: [PATCH 081/103] tool-path option -- "Session tool" (#8716) * Change to escape string via XML * tool-path option -- "Session tool" From the beginning design, shim and packageInstaller take package location from constructor and don't have assumption anymore. From previous discussion, tool-path will simply change global location to the one user want, and everything else is the same. However, this "override" need to happen during the call, that means InstallToolCommand will create different shim and packageInstaller object according to the tool-path during the call instead of constructor DI. * global package location change * block of leading dot as command name * Localization of tool-path option --- .../CliFolderPathCalculator.cs | 10 +- .../ToolPackageFolderPathCalculator.cs | 16 ++ .../DirectoryPath.cs | 5 + src/dotnet/CommonLocalizableStrings.resx | 3 + .../ShellShim/ShellShimRepositoryFactory.cs | 22 +++ src/dotnet/ToolPackage/ToolConfiguration.cs | 12 ++ src/dotnet/ToolPackage/ToolPackageFactory.cs | 41 ++++ .../dotnet-install-tool/InstallToolCommand.cs | 59 +++--- .../InstallToolCommandParser.cs | 4 + .../LocalizableStrings.resx | 14 +- .../dotnet-install-tool/ProjectRestorer.cs | 2 +- .../xlf/LocalizableStrings.cs.xlf | 20 +- .../xlf/LocalizableStrings.de.xlf | 20 +- .../xlf/LocalizableStrings.es.xlf | 20 +- .../xlf/LocalizableStrings.fr.xlf | 20 +- .../xlf/LocalizableStrings.it.xlf | 20 +- .../xlf/LocalizableStrings.ja.xlf | 20 +- .../xlf/LocalizableStrings.ko.xlf | 20 +- .../xlf/LocalizableStrings.pl.xlf | 20 +- .../xlf/LocalizableStrings.pt-BR.xlf | 20 +- .../xlf/LocalizableStrings.ru.xlf | 20 +- .../xlf/LocalizableStrings.tr.xlf | 20 +- .../xlf/LocalizableStrings.zh-Hans.xlf | 20 +- .../xlf/LocalizableStrings.zh-Hant.xlf | 20 +- .../tool/LocalizableStrings.resx | 12 +- .../tool/UninstallToolCommand.cs | 42 +++-- .../tool/UninstallToolCommandParser.cs | 4 + .../tool/xlf/LocalizableStrings.cs.xlf | 20 +- .../tool/xlf/LocalizableStrings.de.xlf | 20 +- .../tool/xlf/LocalizableStrings.es.xlf | 20 +- .../tool/xlf/LocalizableStrings.fr.xlf | 20 +- .../tool/xlf/LocalizableStrings.it.xlf | 20 +- .../tool/xlf/LocalizableStrings.ja.xlf | 20 +- .../tool/xlf/LocalizableStrings.ko.xlf | 20 +- .../tool/xlf/LocalizableStrings.pl.xlf | 20 +- .../tool/xlf/LocalizableStrings.pt-BR.xlf | 20 +- .../tool/xlf/LocalizableStrings.ru.xlf | 20 +- .../tool/xlf/LocalizableStrings.tr.xlf | 20 +- .../tool/xlf/LocalizableStrings.zh-Hans.xlf | 20 +- .../tool/xlf/LocalizableStrings.zh-Hant.xlf | 20 +- src/dotnet/dotnet.csproj | 2 +- .../xlf/CommonLocalizableStrings.cs.xlf | 5 + .../xlf/CommonLocalizableStrings.de.xlf | 5 + .../xlf/CommonLocalizableStrings.es.xlf | 5 + .../xlf/CommonLocalizableStrings.fr.xlf | 5 + .../xlf/CommonLocalizableStrings.it.xlf | 5 + .../xlf/CommonLocalizableStrings.ja.xlf | 5 + .../xlf/CommonLocalizableStrings.ko.xlf | 5 + .../xlf/CommonLocalizableStrings.pl.xlf | 5 + .../xlf/CommonLocalizableStrings.pt-BR.xlf | 5 + .../xlf/CommonLocalizableStrings.ru.xlf | 5 + .../xlf/CommonLocalizableStrings.tr.xlf | 5 + .../xlf/CommonLocalizableStrings.zh-Hans.xlf | 5 + .../xlf/CommonLocalizableStrings.zh-Hant.xlf | 5 + .../ToolConfigurationDeserializerTests.cs | 12 ++ .../EnvironmentPathInstructionMock.cs | 3 +- .../CommandTests/InstallToolCommandTests.cs | 175 ++++++++++++------ .../CommandTests/UninstallToolCommandTests.cs | 61 +++--- .../ParserTests/InstallToolParserTests.cs | 10 + .../UninstallInstallToolParserTests.cs | 55 ++++++ 60 files changed, 884 insertions(+), 265 deletions(-) create mode 100644 src/Microsoft.DotNet.Configurer/ToolPackageFolderPathCalculator.cs create mode 100644 src/dotnet/ShellShim/ShellShimRepositoryFactory.cs create mode 100644 src/dotnet/ToolPackage/ToolPackageFactory.cs create mode 100644 test/dotnet.Tests/ParserTests/UninstallInstallToolParserTests.cs diff --git a/src/Microsoft.DotNet.Configurer/CliFolderPathCalculator.cs b/src/Microsoft.DotNet.Configurer/CliFolderPathCalculator.cs index 20901eb48..f75920997 100644 --- a/src/Microsoft.DotNet.Configurer/CliFolderPathCalculator.cs +++ b/src/Microsoft.DotNet.Configurer/CliFolderPathCalculator.cs @@ -4,25 +4,19 @@ using System; using System.IO; using System.Runtime.InteropServices; -using Microsoft.DotNet.Cli.Utils; -using Microsoft.DotNet.PlatformAbstractions; using NuGet.Common; namespace Microsoft.DotNet.Configurer { public class CliFolderPathCalculator { - // ToolsShimFolderName ToolPackageFolderName cannot be the same - // or if the PackageId is the same as CommandName, they will conflict on unix. - private const string ToolsShimFolderName = "tools"; - private const string ToolPackageFolderName = "toolspkgs"; private const string DotnetProfileDirectoryName = ".dotnet"; + private const string ToolsShimFolderName = "tools"; public string CliFallbackFolderPath => Environment.GetEnvironmentVariable("DOTNET_CLI_TEST_FALLBACKFOLDER") ?? Path.Combine(new DirectoryInfo(AppContext.BaseDirectory).Parent.FullName, "NuGetFallbackFolder"); - public string ToolsShimPath => Path.Combine(DotnetUserProfileFolderPath, ToolsShimFolderName); - public string ToolsPackagePath => Path.Combine(DotnetUserProfileFolderPath, ToolPackageFolderName); + public string ToolsPackagePath => ToolPackageFolderPathCalculator.GetToolPackageFolderPath(ToolsShimPath); public BashPathUnderHomeDirectory ToolsShimPathInUnix { get diff --git a/src/Microsoft.DotNet.Configurer/ToolPackageFolderPathCalculator.cs b/src/Microsoft.DotNet.Configurer/ToolPackageFolderPathCalculator.cs new file mode 100644 index 000000000..4323520dd --- /dev/null +++ b/src/Microsoft.DotNet.Configurer/ToolPackageFolderPathCalculator.cs @@ -0,0 +1,16 @@ +// 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.IO; + +namespace Microsoft.DotNet.Configurer +{ + public static class ToolPackageFolderPathCalculator + { + private const string NestedToolPackageFolderName = ".store"; + public static string GetToolPackageFolderPath(string toolsShimPath) + { + return Path.Combine(toolsShimPath, NestedToolPackageFolderName); + } + } +} diff --git a/src/Microsoft.DotNet.InternalAbstractions/DirectoryPath.cs b/src/Microsoft.DotNet.InternalAbstractions/DirectoryPath.cs index 40e898d3e..3d578432e 100644 --- a/src/Microsoft.DotNet.InternalAbstractions/DirectoryPath.cs +++ b/src/Microsoft.DotNet.InternalAbstractions/DirectoryPath.cs @@ -34,6 +34,11 @@ namespace Microsoft.Extensions.EnvironmentAbstractions return $"\"{Value}\""; } + public string ToXmlEncodeString() + { + return System.Net.WebUtility.HtmlEncode(Value); + } + public override string ToString() { return ToQuotedString(); diff --git a/src/dotnet/CommonLocalizableStrings.resx b/src/dotnet/CommonLocalizableStrings.resx index 236b2fd26..ad40ada4d 100644 --- a/src/dotnet/CommonLocalizableStrings.resx +++ b/src/dotnet/CommonLocalizableStrings.resx @@ -625,4 +625,7 @@ setx PATH "%PATH%;{0}" Column maximum width must be greater than zero. + + Command '{0}' has a leading dot. + diff --git a/src/dotnet/ShellShim/ShellShimRepositoryFactory.cs b/src/dotnet/ShellShim/ShellShimRepositoryFactory.cs new file mode 100644 index 000000000..fe3bdcd60 --- /dev/null +++ b/src/dotnet/ShellShim/ShellShimRepositoryFactory.cs @@ -0,0 +1,22 @@ +// 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.Configurer; +using Microsoft.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.ShellShim +{ + internal static class ShellShimRepositoryFactory + { + public static IShellShimRepository CreateShellShimRepository(DirectoryPath? nonGlobalLocation = null) + { + return new ShellShimRepository(nonGlobalLocation ?? GetShimLocation()); + } + + private static DirectoryPath GetShimLocation() + { + var cliFolderPathCalculator = new CliFolderPathCalculator(); + return new DirectoryPath(cliFolderPathCalculator.ToolsShimPath); + } + } +} diff --git a/src/dotnet/ToolPackage/ToolConfiguration.cs b/src/dotnet/ToolPackage/ToolConfiguration.cs index 286d7db68..fe6eeb2a9 100644 --- a/src/dotnet/ToolPackage/ToolConfiguration.cs +++ b/src/dotnet/ToolPackage/ToolConfiguration.cs @@ -27,6 +27,7 @@ namespace Microsoft.DotNet.ToolPackage commandName)); } + EnsureNoLeadingDot(commandName); EnsureNoInvalidFilenameCharacters(commandName); CommandName = commandName; @@ -46,6 +47,17 @@ namespace Microsoft.DotNet.ToolPackage } } + private void EnsureNoLeadingDot(string commandName) + { + if (commandName.StartsWith(".", StringComparison.OrdinalIgnoreCase)) + { + throw new ToolConfigurationException( + string.Format( + CommonLocalizableStrings.ToolSettingsInvalidLeadingDotCommandName, + commandName)); + } + } + public string CommandName { get; } public string ToolAssemblyEntryPoint { get; } } diff --git a/src/dotnet/ToolPackage/ToolPackageFactory.cs b/src/dotnet/ToolPackage/ToolPackageFactory.cs new file mode 100644 index 000000000..c619df4a3 --- /dev/null +++ b/src/dotnet/ToolPackage/ToolPackageFactory.cs @@ -0,0 +1,41 @@ +// 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; +using Microsoft.DotNet.Configurer; +using Microsoft.DotNet.Tools.Install.Tool; +using Microsoft.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.ToolPackage +{ + internal static class ToolPackageFactory + { + public static (IToolPackageStore, IToolPackageInstaller) CreateToolPackageStoreAndInstaller( + DirectoryPath? nonGlobalLocation = null) + { + IToolPackageStore toolPackageStore = CreateToolPackageStore(nonGlobalLocation); + var toolPackageInstaller = new ToolPackageInstaller( + toolPackageStore, + new ProjectRestorer(Reporter.Output)); + + return (toolPackageStore, toolPackageInstaller); + } + + public static IToolPackageStore CreateToolPackageStore( + DirectoryPath? nonGlobalLocation = null) + { + var toolPackageStore = + new ToolPackageStore(nonGlobalLocation.HasValue + ? new DirectoryPath(ToolPackageFolderPathCalculator.GetToolPackageFolderPath(nonGlobalLocation.Value.Value)) + : GetPackageLocation()); + + return toolPackageStore; + } + + private static DirectoryPath GetPackageLocation() + { + var cliFolderPathCalculator = new CliFolderPathCalculator(); + return new DirectoryPath(cliFolderPathCalculator.ToolsPackagePath); + } + } +} 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 8459c2b55..43abd0bc9 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs @@ -17,14 +17,16 @@ using NuGet.Versioning; namespace Microsoft.DotNet.Tools.Install.Tool { + internal delegate IShellShimRepository CreateShellShimRepository(DirectoryPath? nonGlobalLocation = null); + internal delegate (IToolPackageStore, IToolPackageInstaller) CreateToolPackageStoreAndInstaller(DirectoryPath? nonGlobalLocation = null); + internal class InstallToolCommand : CommandBase { - private readonly IToolPackageStore _toolPackageStore; - private readonly IToolPackageInstaller _toolPackageInstaller; - private readonly IShellShimRepository _shellShimRepository; private readonly IEnvironmentPathInstruction _environmentPathInstruction; private readonly IReporter _reporter; private readonly IReporter _errorReporter; + private CreateShellShimRepository _createShellShimRepository; + private CreateToolPackageStoreAndInstaller _createToolPackageStoreAndInstaller; private readonly PackageId _packageId; private readonly string _packageVersion; @@ -33,13 +35,13 @@ namespace Microsoft.DotNet.Tools.Install.Tool private readonly string _source; private readonly bool _global; private readonly string _verbosity; + private readonly string _toolPath; public InstallToolCommand( AppliedOption appliedCommand, ParseResult parseResult, - IToolPackageStore toolPackageStore = null, - IToolPackageInstaller toolPackageInstaller = null, - IShellShimRepository shellShimRepository = null, + CreateToolPackageStoreAndInstaller createToolPackageStoreAndInstaller = null, + CreateShellShimRepository createShellShimRepository = null, IEnvironmentPathInstruction environmentPathInstruction = null, IReporter reporter = null) : base(parseResult) @@ -56,22 +58,15 @@ namespace Microsoft.DotNet.Tools.Install.Tool _source = appliedCommand.ValueOrDefault("source"); _global = appliedCommand.ValueOrDefault("global"); _verbosity = appliedCommand.SingleArgumentOrDefault("verbosity"); + _toolPath = appliedCommand.SingleArgumentOrDefault("tool-path"); var cliFolderPathCalculator = new CliFolderPathCalculator(); - _toolPackageStore = toolPackageStore - ?? new ToolPackageStore(new DirectoryPath(cliFolderPathCalculator.ToolsPackagePath)); - - _toolPackageInstaller = toolPackageInstaller - ?? new ToolPackageInstaller( - _toolPackageStore, - new ProjectRestorer(_reporter)); + _createToolPackageStoreAndInstaller = createToolPackageStoreAndInstaller ?? ToolPackageFactory.CreateToolPackageStoreAndInstaller; _environmentPathInstruction = environmentPathInstruction ?? EnvironmentPathFactory.CreateEnvironmentPathInstruction(); - - _shellShimRepository = shellShimRepository - ?? new ShellShimRepository(new DirectoryPath(cliFolderPathCalculator.ToolsShimPath)); + _createShellShimRepository = createShellShimRepository ?? ShellShimRepositoryFactory.CreateShellShimRepository; _reporter = (reporter ?? Reporter.Output); _errorReporter = (reporter ?? Reporter.Error); @@ -79,9 +74,14 @@ namespace Microsoft.DotNet.Tools.Install.Tool public override int Execute() { - if (!_global) + if (string.IsNullOrWhiteSpace(_toolPath) && !_global) { - throw new GracefulException(LocalizableStrings.InstallToolCommandOnlySupportGlobal); + throw new GracefulException(LocalizableStrings.InstallToolCommandNeedGlobalOrToolPath); + } + + if (!string.IsNullOrWhiteSpace(_toolPath) && _global) + { + throw new GracefulException(LocalizableStrings.InstallToolCommandInvalidGlobalAndToolPath); } if (_configFilePath != null && !File.Exists(_configFilePath)) @@ -92,6 +92,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool Path.GetFullPath(_configFilePath))); } + VersionRange versionRange = null; if (!string.IsNullOrEmpty(_packageVersion) && !VersionRange.TryParse(_packageVersion, out versionRange)) { @@ -101,7 +102,18 @@ namespace Microsoft.DotNet.Tools.Install.Tool _packageVersion)); } - if (_toolPackageStore.EnumeratePackageVersions(_packageId).FirstOrDefault() != null) + DirectoryPath? toolPath = null; + if (_toolPath != null) + { + toolPath = new DirectoryPath(_toolPath); + } + + (IToolPackageStore toolPackageStore, IToolPackageInstaller toolPackageInstaller) = + _createToolPackageStoreAndInstaller(toolPath); + IShellShimRepository shellShimRepository = _createShellShimRepository(toolPath); + + // Prevent installation if any version of the package is installed + if (toolPackageStore.EnumeratePackageVersions(_packageId).FirstOrDefault() != null) { _errorReporter.WriteLine(string.Format(LocalizableStrings.ToolAlreadyInstalled, _packageId).Red()); return 1; @@ -120,7 +132,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool TransactionScopeOption.Required, TimeSpan.Zero)) { - package = _toolPackageInstaller.InstallPackage( + package = toolPackageInstaller.InstallPackage( packageId: _packageId, versionRange: versionRange, targetFramework: _framework, @@ -130,13 +142,16 @@ namespace Microsoft.DotNet.Tools.Install.Tool foreach (var command in package.Commands) { - _shellShimRepository.CreateShim(command.Executable, command.Name); + shellShimRepository.CreateShim(command.Executable, command.Name); } scope.Complete(); } - _environmentPathInstruction.PrintAddPathInstructionIfPathDoesNotExist(); + if (_global) + { + _environmentPathInstruction.PrintAddPathInstructionIfPathDoesNotExist(); + } _reporter.WriteLine( string.Format( 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 c4d2a9696..2d5e980a0 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommandParser.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommandParser.cs @@ -19,6 +19,10 @@ namespace Microsoft.DotNet.Cli "-g|--global", LocalizableStrings.GlobalOptionDescription, Accept.NoArguments()), + Create.Option( + "--tool-path", + LocalizableStrings.ToolPathDescription, + Accept.ExactlyOneArgument()), Create.Option( "--version", LocalizableStrings.VersionOptionDescription, 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 2b463ae96..a6f6cc58c 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/LocalizableStrings.resx +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/LocalizableStrings.resx @@ -157,9 +157,6 @@ Tool '{1}' (version '{2}') was successfully installed. .NET Install Command - - 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} @@ -181,4 +178,13 @@ Tool '{1}' (version '{2}') was successfully installed. Specified version '{0}' is not a valid NuGet version range. - \ No newline at end of file + + Need either global or tool-path provided. + + + Cannot have global and tool-path as opinion at the same time. + + + Location of shim to access tool + + 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 813e6a8fd..06cc81c38 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/ProjectRestorer.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/ProjectRestorer.cs @@ -48,7 +48,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool { "--runtime", AnyRid, - $"/p:BaseIntermediateOutputPath={assetJsonOutput.ToQuotedString()}" + $"/p:BaseIntermediateOutputPath={assetJsonOutput.ToXmlEncodeString()}" }); argsToPassToRestore.Add($"/verbosity:{verbosity ?? "quiet"}"); 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 894f345b3..bb04e2bfb 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 @@ -64,11 +64,6 @@ Instalace byla úspěšná. Pokud nejsou další pokyny, můžete přímo do já Příkaz Instalovat rozhraní .NET - - The --global switch (-g) is currently required because only user wide tools are supported. - Přepínač --global (-g) se aktuálně vyžaduje, protože se podporují jenom nástroje pro všechny uživatele. - - The settings file in the tool's NuGet package is invalid: {0} Soubor nastavení v balíčku NuGet nástroje je neplatný: {0}. @@ -109,6 +104,21 @@ Instalace byla úspěšná. Pokud nejsou další pokyny, můžete přímo do já Specified version '{0}' is not a valid NuGet version range. + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Cannot have global and tool-path as opinion at the same time. + Cannot have global and tool-path as opinion at the same time. + + + + Location of shim to access tool + Location of shim to access tool + + \ 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 2d551c8f0..e97c39e5d 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 @@ -64,11 +64,6 @@ Die Installation war erfolgreich. Sofern keine weiteren Anweisungen vorliegen, k .NET-Installationsbefehl - - The --global switch (-g) is currently required because only user wide tools are supported. - Die Option --global (-g) ist aktuell erforderlich, weil nur benutzerweite Tools unterstützt werden. - - The settings file in the tool's NuGet package is invalid: {0} Die Einstellungsdatei im NuGet-Paket des Tools ist ungültig: {0} @@ -109,6 +104,21 @@ Die Installation war erfolgreich. Sofern keine weiteren Anweisungen vorliegen, k Specified version '{0}' is not a valid NuGet version range. + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Cannot have global and tool-path as opinion at the same time. + Cannot have global and tool-path as opinion at the same time. + + + + Location of shim to access tool + Location of shim to access tool + + \ 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 1907042c2..c5e4465b6 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 @@ -64,11 +64,6 @@ La instalación se completó correctamente. Si no hay más instrucciones, puede Comando para la instalación de .NET - - The --global switch (-g) is currently required because only user wide tools are supported. - El conmutador --global (g) se requiere actualmente porque solo se admiten herramientas para todos los usuarios. - - The settings file in the tool's NuGet package is invalid: {0} El archivo de configuración del paquete NuGet de la herramienta no es válido: {0} @@ -109,6 +104,21 @@ La instalación se completó correctamente. Si no hay más instrucciones, puede Specified version '{0}' is not a valid NuGet version range. + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Cannot have global and tool-path as opinion at the same time. + Cannot have global and tool-path as opinion at the same time. + + + + Location of shim to access tool + Location of shim to access tool + + \ 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 217f901ca..e9e97f243 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 @@ -64,11 +64,6 @@ L'installation a réussi. En l'absence d'instructions supplémentaires, vous pou Commande d'installation .NET - - The --global switch (-g) is currently required because only user wide tools are supported. - Le commutateur --global (-g) est obligatoire, car seuls les outils à l'échelle des utilisateurs sont pris en charge. - - The settings file in the tool's NuGet package is invalid: {0} Le fichier de paramètres dans le package NuGet de l'outil n'est pas valide : {0} @@ -109,6 +104,21 @@ L'installation a réussi. En l'absence d'instructions supplémentaires, vous pou Specified version '{0}' is not a valid NuGet version range. + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Cannot have global and tool-path as opinion at the same time. + Cannot have global and tool-path as opinion at the same time. + + + + Location of shim to access tool + Location of shim to access tool + + \ 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 69df9674e..578339d9a 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 @@ -64,11 +64,6 @@ L'installazione è riuscita. Se non ci sono altre istruzioni, è possibile digit Comando di installazione .NET - - The --global switch (-g) is currently required because only user wide tools are supported. - L'opzione --global (-g) è attualmente obbligatoria perché sono supportati solo gli strumenti a livello di utente. - - The settings file in the tool's NuGet package is invalid: {0} Il file di impostazioni nel pacchetto NuGet dello strumento non è valido: {0} @@ -109,6 +104,21 @@ L'installazione è riuscita. Se non ci sono altre istruzioni, è possibile digit Specified version '{0}' is not a valid NuGet version range. + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Cannot have global and tool-path as opinion at the same time. + Cannot have global and tool-path as opinion at the same time. + + + + Location of shim to access tool + Location of shim to access tool + + \ 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 eb86d3b58..cd32d2d52 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 @@ -64,11 +64,6 @@ Tool '{1}' (version '{2}') was successfully installed. .NET インストール コマンド - - The --global switch (-g) is currently required because only user wide tools are supported. - サポートされているのはユーザー全体のツールだけなので、現在 --global スイッチ (-g) が必要です。 - - The settings file in the tool's NuGet package is invalid: {0} ツールの NuGet パッケージ内の設定ファイルが無効です: {0} @@ -109,6 +104,21 @@ Tool '{1}' (version '{2}') was successfully installed. Specified version '{0}' is not a valid NuGet version range. + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Cannot have global and tool-path as opinion at the same time. + Cannot have global and tool-path as opinion at the same time. + + + + Location of shim to access tool + Location of shim to access tool + + \ 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 41b63aff0..3f5c31436 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 @@ -64,11 +64,6 @@ Tool '{1}' (version '{2}') was successfully installed. .NET 설치 명령 - - The --global switch (-g) is currently required because only user wide tools are supported. - 사용자 전체 도구만 지원되므로 -global 스위치(-g)가 필요합니다. - - The settings file in the tool's NuGet package is invalid: {0} 도구의 NuGet 패키지에 있는 설정 파일이 잘못되었습니다. {0} @@ -109,6 +104,21 @@ Tool '{1}' (version '{2}') was successfully installed. Specified version '{0}' is not a valid NuGet version range. + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Cannot have global and tool-path as opinion at the same time. + Cannot have global and tool-path as opinion at the same time. + + + + Location of shim to access tool + Location of shim to access tool + + \ 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 c77c195ab..33fbb68c4 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 @@ -64,11 +64,6 @@ Instalacja powiodła się. Jeśli nie ma dodatkowych instrukcji, możesz wpisać Polecenie instalacji platformy .NET - - The --global switch (-g) is currently required because only user wide tools are supported. - Obecnie jest wymagany przełącznik --global (-g), ponieważ obsługiwane są tylko narzędzia użytkownika. - - The settings file in the tool's NuGet package is invalid: {0} Plik ustawień w pakiecie NuGet narzędzia jest nieprawidłowy: {0} @@ -109,6 +104,21 @@ Instalacja powiodła się. Jeśli nie ma dodatkowych instrukcji, możesz wpisać Specified version '{0}' is not a valid NuGet version range. + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Cannot have global and tool-path as opinion at the same time. + Cannot have global and tool-path as opinion at the same time. + + + + Location of shim to access tool + Location of shim to access tool + + \ 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 ab6c7b086..3de8ddbc3 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 @@ -64,11 +64,6 @@ A instalação foi bem-sucedida. Se não houver outras instruções, digite o se Comando de instalação do .NET - - The --global switch (-g) is currently required because only user wide tools are supported. - A opção --global (-g) é obrigatória, pois somente ferramentas para todo o usuário são compatíveis. - - The settings file in the tool's NuGet package is invalid: {0} O arquivo de configurações no pacote NuGet da ferramenta é inválido: {0} @@ -109,6 +104,21 @@ A instalação foi bem-sucedida. Se não houver outras instruções, digite o se Specified version '{0}' is not a valid NuGet version range. + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Cannot have global and tool-path as opinion at the same time. + Cannot have global and tool-path as opinion at the same time. + + + + Location of shim to access tool + Location of shim to access tool + + \ 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 d4b0de225..2d167c9e2 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 @@ -64,11 +64,6 @@ Tool '{1}' (version '{2}') was successfully installed. Команда установки .NET - - The --global switch (-g) is currently required because only user wide tools are supported. - Параметр "--global switch (-g)" сейчас обязателен, так как поддерживаются только инструменты уровня пользователя. - - The settings file in the tool's NuGet package is invalid: {0} Недопустимый файл параметров в пакете NuGet инструмента: {0} @@ -109,6 +104,21 @@ Tool '{1}' (version '{2}') was successfully installed. Specified version '{0}' is not a valid NuGet version range. + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Cannot have global and tool-path as opinion at the same time. + Cannot have global and tool-path as opinion at the same time. + + + + Location of shim to access tool + Location of shim to access tool + + \ 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 13ed942cf..de1fd3e5f 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 @@ -64,11 +64,6 @@ Yükleme başarılı oldu. Daha fazla yönerge yoksa, çağırmak için şu komu .NET Yükleme Komutu - - The --global switch (-g) is currently required because only user wide tools are supported. - Yalnızca kullanıcı için araçlar desteklendiğinden --global anahtarı (-g) şu anda gereklidir. - - The settings file in the tool's NuGet package is invalid: {0} Aracın NuGet paketindeki ayar dosyası geçersiz: {0} @@ -109,6 +104,21 @@ Yükleme başarılı oldu. Daha fazla yönerge yoksa, çağırmak için şu komu Specified version '{0}' is not a valid NuGet version range. + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Cannot have global and tool-path as opinion at the same time. + Cannot have global and tool-path as opinion at the same time. + + + + Location of shim to access tool + Location of shim to access tool + + \ 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 29f352687..98c614b43 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 @@ -64,11 +64,6 @@ Tool '{1}' (version '{2}') was successfully installed. .NET 安装命令 - - The --global switch (-g) is currently required because only user wide tools are supported. - 目前需要 --global 开关 (-g),因为仅支持用户范围工具。 - - The settings file in the tool's NuGet package is invalid: {0} 工具的 NuGet 包中的设置文件无效: {0} @@ -109,6 +104,21 @@ Tool '{1}' (version '{2}') was successfully installed. Specified version '{0}' is not a valid NuGet version range. + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Cannot have global and tool-path as opinion at the same time. + Cannot have global and tool-path as opinion at the same time. + + + + Location of shim to access tool + Location of shim to access tool + + \ 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 911527d54..82e923141 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 @@ -64,11 +64,6 @@ Tool '{1}' (version '{2}') was successfully installed. .NET 安裝命令 - - The --global switch (-g) is currently required because only user wide tools are supported. - 因為只支援適用於全體使用者的工具,所以目前必須有 --global 參數 (-g)。 - - The settings file in the tool's NuGet package is invalid: {0} 工具之 NuGet 套件中的設定檔案無效: {0} @@ -109,6 +104,21 @@ Tool '{1}' (version '{2}') was successfully installed. Specified version '{0}' is not a valid NuGet version range. + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Cannot have global and tool-path as opinion at the same time. + Cannot have global and tool-path as opinion at the same time. + + + + Location of shim to access tool + Location of shim to access tool + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/LocalizableStrings.resx b/src/dotnet/commands/dotnet-uninstall/tool/LocalizableStrings.resx index bbca43b66..83309121e 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/LocalizableStrings.resx +++ b/src/dotnet/commands/dotnet-uninstall/tool/LocalizableStrings.resx @@ -132,9 +132,6 @@ Uninstall user wide. - - The --global switch (-g) is currently required because only user wide tools are supported. - Tool '{0}' (version '{1}') was successfully uninstalled. @@ -147,4 +144,13 @@ Failed to uninstall tool '{0}': {1} + + Need either global or tool-path provided. + + + Location of shim to access tool + + + Cannot have global and tool-path as opinion at the same time." + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs index ca470f4a6..063686b21 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs +++ b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs @@ -15,45 +15,63 @@ using Microsoft.Extensions.EnvironmentAbstractions; namespace Microsoft.DotNet.Tools.Uninstall.Tool { + internal delegate IShellShimRepository CreateShellShimRepository(DirectoryPath? nonGlobalLocation = null); + internal delegate IToolPackageStore CreateToolPackageStore(DirectoryPath? nonGlobalLocation = null); internal class UninstallToolCommand : CommandBase { private readonly AppliedOption _options; - private readonly IToolPackageStore _toolPackageStore; - private readonly IShellShimRepository _shellShimRepository; private readonly IReporter _reporter; private readonly IReporter _errorReporter; + private CreateShellShimRepository _createShellShimRepository; + private CreateToolPackageStore _createToolPackageStoreAndInstaller; public UninstallToolCommand( AppliedOption options, ParseResult result, - IToolPackageStore toolPackageStore = null, - IShellShimRepository shellShimRepository = null, + CreateToolPackageStore createToolPackageStoreAndInstaller = null, + CreateShellShimRepository createShellShimRepository = null, IReporter reporter = null) : base(result) { var pathCalculator = new CliFolderPathCalculator(); _options = options ?? throw new ArgumentNullException(nameof(options)); - _toolPackageStore = toolPackageStore ?? new ToolPackageStore( - new DirectoryPath(pathCalculator.ToolsPackagePath)); - _shellShimRepository = shellShimRepository ?? new ShellShimRepository( - new DirectoryPath(pathCalculator.ToolsShimPath)); _reporter = reporter ?? Reporter.Output; _errorReporter = reporter ?? Reporter.Error; + + _createShellShimRepository = createShellShimRepository ?? ShellShimRepositoryFactory.CreateShellShimRepository; + _createToolPackageStoreAndInstaller = createToolPackageStoreAndInstaller ?? ToolPackageFactory.CreateToolPackageStore; } public override int Execute() { - if (!_options.ValueOrDefault("global")) + var global = _options.ValueOrDefault("global"); + var toolPath = _options.SingleArgumentOrDefault("tool-path"); + + if (string.IsNullOrWhiteSpace(toolPath) && !global) { - throw new GracefulException(LocalizableStrings.UninstallToolCommandOnlySupportsGlobal); + throw new GracefulException(LocalizableStrings.UninstallToolCommandNeedGlobalOrToolPath); } + if (!string.IsNullOrWhiteSpace(toolPath) && global) + { + throw new GracefulException(LocalizableStrings.UninstallToolCommandInvalidGlobalAndToolPath); + } + + DirectoryPath? toolDirectoryPath = null; + if (!string.IsNullOrWhiteSpace(toolPath)) + { + toolDirectoryPath = new DirectoryPath(toolPath); + } + + IToolPackageStore toolPackageStore = _createToolPackageStoreAndInstaller(toolDirectoryPath); + IShellShimRepository shellShimRepository = _createShellShimRepository(toolDirectoryPath); + var packageId = new PackageId(_options.Arguments.Single()); IToolPackage package = null; try { - package = _toolPackageStore.EnumeratePackageVersions(packageId).SingleOrDefault(); + package = toolPackageStore.EnumeratePackageVersions(packageId).SingleOrDefault(); if (package == null) { _errorReporter.WriteLine( @@ -80,7 +98,7 @@ namespace Microsoft.DotNet.Tools.Uninstall.Tool { foreach (var command in package.Commands) { - _shellShimRepository.RemoveShim(command.Name); + shellShimRepository.RemoveShim(command.Name); } package.Uninstall(); diff --git a/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommandParser.cs b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommandParser.cs index 61fca31dc..028d44a0f 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommandParser.cs +++ b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommandParser.cs @@ -19,6 +19,10 @@ namespace Microsoft.DotNet.Cli "-g|--global", LocalizableStrings.GlobalOptionDescription, Accept.NoArguments()), + Create.Option( + "--tool-path", + LocalizableStrings.ToolPathDescription, + Accept.ExactlyOneArgument()), CommonOptions.HelpOption()); } } diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.cs.xlf index b826078e4..c45412a8e 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.cs.xlf +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.cs.xlf @@ -27,11 +27,6 @@ Uninstall user wide. - - The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. - - Tool '{0}' (version '{1}') was successfully uninstalled. Tool '{0}' (version '{1}') was successfully uninstalled. @@ -52,6 +47,21 @@ Failed to uninstall tool '{0}': {1} + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Location of shim to access tool + Location of shim to access tool + + + + Cannot have global and tool-path as opinion at the same time." + Cannot have global and tool-path as opinion at the same time." + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.de.xlf index 82291d6a6..b7d0fef06 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.de.xlf +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.de.xlf @@ -27,11 +27,6 @@ Uninstall user wide. - - The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. - - Tool '{0}' (version '{1}') was successfully uninstalled. Tool '{0}' (version '{1}') was successfully uninstalled. @@ -52,6 +47,21 @@ Failed to uninstall tool '{0}': {1} + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Location of shim to access tool + Location of shim to access tool + + + + Cannot have global and tool-path as opinion at the same time." + Cannot have global and tool-path as opinion at the same time." + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.es.xlf index fdadddde1..0f0884a52 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.es.xlf +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.es.xlf @@ -27,11 +27,6 @@ Uninstall user wide. - - The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. - - Tool '{0}' (version '{1}') was successfully uninstalled. Tool '{0}' (version '{1}') was successfully uninstalled. @@ -52,6 +47,21 @@ Failed to uninstall tool '{0}': {1} + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Location of shim to access tool + Location of shim to access tool + + + + Cannot have global and tool-path as opinion at the same time." + Cannot have global and tool-path as opinion at the same time." + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.fr.xlf index 07535f668..bbc1608da 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.fr.xlf +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.fr.xlf @@ -27,11 +27,6 @@ Uninstall user wide. - - The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. - - Tool '{0}' (version '{1}') was successfully uninstalled. Tool '{0}' (version '{1}') was successfully uninstalled. @@ -52,6 +47,21 @@ Failed to uninstall tool '{0}': {1} + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Location of shim to access tool + Location of shim to access tool + + + + Cannot have global and tool-path as opinion at the same time." + Cannot have global and tool-path as opinion at the same time." + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.it.xlf index 39fb58449..28354ec20 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.it.xlf +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.it.xlf @@ -27,11 +27,6 @@ Uninstall user wide. - - The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. - - Tool '{0}' (version '{1}') was successfully uninstalled. Tool '{0}' (version '{1}') was successfully uninstalled. @@ -52,6 +47,21 @@ Failed to uninstall tool '{0}': {1} + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Location of shim to access tool + Location of shim to access tool + + + + Cannot have global and tool-path as opinion at the same time." + Cannot have global and tool-path as opinion at the same time." + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ja.xlf index 47e7895c4..cf28053cb 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ja.xlf +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ja.xlf @@ -27,11 +27,6 @@ Uninstall user wide. - - The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. - - Tool '{0}' (version '{1}') was successfully uninstalled. Tool '{0}' (version '{1}') was successfully uninstalled. @@ -52,6 +47,21 @@ Failed to uninstall tool '{0}': {1} + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Location of shim to access tool + Location of shim to access tool + + + + Cannot have global and tool-path as opinion at the same time." + Cannot have global and tool-path as opinion at the same time." + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ko.xlf index a44f80a79..b2cc666d5 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ko.xlf +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ko.xlf @@ -27,11 +27,6 @@ Uninstall user wide. - - The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. - - Tool '{0}' (version '{1}') was successfully uninstalled. Tool '{0}' (version '{1}') was successfully uninstalled. @@ -52,6 +47,21 @@ Failed to uninstall tool '{0}': {1} + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Location of shim to access tool + Location of shim to access tool + + + + Cannot have global and tool-path as opinion at the same time." + Cannot have global and tool-path as opinion at the same time." + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.pl.xlf index d02afe79a..552aaeda3 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.pl.xlf +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.pl.xlf @@ -27,11 +27,6 @@ Uninstall user wide. - - The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. - - Tool '{0}' (version '{1}') was successfully uninstalled. Tool '{0}' (version '{1}') was successfully uninstalled. @@ -52,6 +47,21 @@ Failed to uninstall tool '{0}': {1} + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Location of shim to access tool + Location of shim to access tool + + + + Cannot have global and tool-path as opinion at the same time." + Cannot have global and tool-path as opinion at the same time." + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.pt-BR.xlf index 6b7e490f5..d7093abd1 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.pt-BR.xlf @@ -27,11 +27,6 @@ Uninstall user wide. - - The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. - - Tool '{0}' (version '{1}') was successfully uninstalled. Tool '{0}' (version '{1}') was successfully uninstalled. @@ -52,6 +47,21 @@ Failed to uninstall tool '{0}': {1} + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Location of shim to access tool + Location of shim to access tool + + + + Cannot have global and tool-path as opinion at the same time." + Cannot have global and tool-path as opinion at the same time." + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ru.xlf index e98348039..7215ef17a 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ru.xlf +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ru.xlf @@ -27,11 +27,6 @@ Uninstall user wide. - - The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. - - Tool '{0}' (version '{1}') was successfully uninstalled. Tool '{0}' (version '{1}') was successfully uninstalled. @@ -52,6 +47,21 @@ Failed to uninstall tool '{0}': {1} + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Location of shim to access tool + Location of shim to access tool + + + + Cannot have global and tool-path as opinion at the same time." + Cannot have global and tool-path as opinion at the same time." + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.tr.xlf index 208741783..56e68b543 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.tr.xlf +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.tr.xlf @@ -27,11 +27,6 @@ Uninstall user wide. - - The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. - - Tool '{0}' (version '{1}') was successfully uninstalled. Tool '{0}' (version '{1}') was successfully uninstalled. @@ -52,6 +47,21 @@ Failed to uninstall tool '{0}': {1} + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Location of shim to access tool + Location of shim to access tool + + + + Cannot have global and tool-path as opinion at the same time." + Cannot have global and tool-path as opinion at the same time." + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.zh-Hans.xlf index e57075c58..04cae1765 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.zh-Hans.xlf @@ -27,11 +27,6 @@ Uninstall user wide. - - The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. - - Tool '{0}' (version '{1}') was successfully uninstalled. Tool '{0}' (version '{1}') was successfully uninstalled. @@ -52,6 +47,21 @@ Failed to uninstall tool '{0}': {1} + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Location of shim to access tool + Location of shim to access tool + + + + Cannot have global and tool-path as opinion at the same time." + Cannot have global and tool-path as opinion at the same time." + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.zh-Hant.xlf index fc809894b..c59aef876 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.zh-Hant.xlf @@ -27,11 +27,6 @@ Uninstall user wide. - - The --global switch (-g) is currently required because only user wide tools are supported. - The --global switch (-g) is currently required because only user wide tools are supported. - - Tool '{0}' (version '{1}') was successfully uninstalled. Tool '{0}' (version '{1}') was successfully uninstalled. @@ -52,6 +47,21 @@ Failed to uninstall tool '{0}': {1} + + Need either global or tool-path provided. + Need either global or tool-path provided. + + + + Location of shim to access tool + Location of shim to access tool + + + + Cannot have global and tool-path as opinion at the same time." + Cannot have global and tool-path as opinion at the same time." + + \ No newline at end of file diff --git a/src/dotnet/dotnet.csproj b/src/dotnet/dotnet.csproj index b88203c7b..d294220e1 100644 --- a/src/dotnet/dotnet.csproj +++ b/src/dotnet/dotnet.csproj @@ -77,4 +77,4 @@ - + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf index 70be5e60b..f464118ce 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf @@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}" Failed to find staged tool package '{0}'. + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf index 6ef10330e..cae4ffe72 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf @@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}" Failed to find staged tool package '{0}'. + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf index c9d3df366..55e770628 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf @@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}" Failed to find staged tool package '{0}'. + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf index ab0d6ae1f..5d7e2755f 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf @@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}" Failed to find staged tool package '{0}'. + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf index 6210b184f..28d31da38 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf @@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}" Failed to find staged tool package '{0}'. + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf index 4541550f0..46d5302b0 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf @@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}" Failed to find staged tool package '{0}'. + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf index c9d93cce8..470eb0bc5 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf @@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}" Failed to find staged tool package '{0}'. + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf index 2b22b4c8c..889ec7173 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf @@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}" Failed to find staged tool package '{0}'. + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. + + \ 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 60b4b7863..7d9b411ff 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf @@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}" Failed to find staged tool package '{0}'. + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf index 50ee839d2..7ecf75ccc 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf @@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}" Failed to find staged tool package '{0}'. + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf index a20c55ce0..b633fd9cd 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf @@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}" Failed to find staged tool package '{0}'. + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. + + \ 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 d26ed195d..11fef08ba 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf @@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}" Failed to find staged tool package '{0}'. + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. + + \ 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 fc901551e..413d99070 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf @@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}" Failed to find staged tool package '{0}'. + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. + + \ No newline at end of file diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs b/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs index 4dc35e76b..1d141311e 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs +++ b/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs @@ -54,5 +54,17 @@ namespace Microsoft.DotNet.ToolPackage.Tests invalidCommandName, string.Join(", ", Path.GetInvalidFileNameChars().Select(c => $"'{c}'")))); } + + [Fact] + public void GivenALeadingDotAsFileNameItThrows() + { + var invalidCommandName = ".mytool"; + Action a = () => new ToolConfiguration(invalidCommandName, "my.dll"); + a.ShouldThrow() + .And.Message.Should() + .Contain(string.Format( + CommonLocalizableStrings.ToolSettingsInvalidLeadingDotCommandName, + invalidCommandName)); + } } } diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/EnvironmentPathInstructionMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/EnvironmentPathInstructionMock.cs index c07f5ad1b..33f8d04d1 100644 --- a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/EnvironmentPathInstructionMock.cs +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/EnvironmentPathInstructionMock.cs @@ -11,6 +11,7 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks private readonly string _packageExecutablePath; private readonly bool _packageExecutablePathExists; private readonly IReporter _reporter; + public const string MockInstructionText = "MOCK INSTRUCTION"; public EnvironmentPathInstructionMock( IReporter reporter, @@ -27,7 +28,7 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks { if (!PackageExecutablePathExists()) { - _reporter.WriteLine("INSTRUCTION"); + _reporter.WriteLine(MockInstructionText); } } diff --git a/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs b/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs index 15b626428..fd6094c98 100644 --- a/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs @@ -19,8 +19,9 @@ using Microsoft.Extensions.EnvironmentAbstractions; using Newtonsoft.Json; using Xunit; using Parser = Microsoft.DotNet.Cli.Parser; -using LocalizableStrings = Microsoft.DotNet.Tools.Install.Tool.LocalizableStrings; using System.Runtime.InteropServices; +using LocalizableStrings = Microsoft.DotNet.Tools.Install.Tool.LocalizableStrings; +using Microsoft.DotNet.ShellShim; namespace Microsoft.DotNet.Tests.Commands { @@ -28,7 +29,8 @@ namespace Microsoft.DotNet.Tests.Commands { private readonly IFileSystem _fileSystem; private readonly IToolPackageStore _toolPackageStore; - private readonly ShellShimRepositoryMock _shellShimRepositoryMock; + private readonly CreateShellShimRepository _createShellShimRepository; + private readonly CreateToolPackageStoreAndInstaller _createToolPackageStoreAndInstaller; private readonly EnvironmentPathInstructionMock _environmentPathInstructionMock; private readonly AppliedOption _appliedCommand; private readonly ParseResult _parseResult; @@ -43,9 +45,11 @@ namespace Microsoft.DotNet.Tests.Commands _reporter = new BufferedReporter(); _fileSystem = new FileSystemMockBuilder().Build(); _toolPackageStore = new ToolPackageStoreMock(new DirectoryPath(PathToPlacePackages), _fileSystem); - _shellShimRepositoryMock = new ShellShimRepositoryMock(new DirectoryPath(PathToPlaceShim), _fileSystem); + _createShellShimRepository = + (nonGlobalLocation) => new ShellShimRepositoryMock(new DirectoryPath(PathToPlaceShim), _fileSystem); _environmentPathInstructionMock = new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim); + _createToolPackageStoreAndInstaller = (_) => (_toolPackageStore, CreateToolPackageInstaller()); ParseResult result = Parser.Instance.Parse($"dotnet install tool -g {PackageId}"); _appliedCommand = result["dotnet"]["install"]["tool"]; @@ -58,9 +62,8 @@ namespace Microsoft.DotNet.Tests.Commands { var installToolCommand = new InstallToolCommand(_appliedCommand, _parseResult, - _toolPackageStore, - CreateToolPackageInstaller(), - _shellShimRepositoryMock, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, _environmentPathInstructionMock, _reporter); @@ -83,26 +86,28 @@ namespace Microsoft.DotNet.Tests.Commands ParseResult parseResult = Parser.Instance.ParseFrom("dotnet install", new[] { "tool", PackageId, "--source", sourcePath }); - var installToolCommand = new InstallToolCommand(appliedCommand, - parseResult, - _toolPackageStore, - CreateToolPackageInstaller( - feeds: new MockFeed[] { - new MockFeed + + var toolToolPackageInstaller = CreateToolPackageInstaller( + feeds: new MockFeed[] { + new MockFeed + { + Type = MockFeedType.Source, + Uri = sourcePath, + Packages = new List { - Type = MockFeedType.Source, - Uri = sourcePath, - Packages = new List + new MockFeedPackage { - new MockFeedPackage - { - PackageId = PackageId, - Version = PackageVersion - } + PackageId = PackageId, + Version = PackageVersion } } - }), - _shellShimRepositoryMock, + } + }); + + var installToolCommand = new InstallToolCommand(appliedCommand, + parseResult, + (_) => (_toolPackageStore, toolToolPackageInstaller), + _createShellShimRepository, _environmentPathInstructionMock, _reporter); @@ -122,27 +127,28 @@ namespace Microsoft.DotNet.Tests.Commands { var installToolCommand = new InstallToolCommand(_appliedCommand, _parseResult, - _toolPackageStore, - CreateToolPackageInstaller(), - _shellShimRepositoryMock, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, _environmentPathInstructionMock, _reporter); installToolCommand.Execute().Should().Be(0); - _reporter.Lines.First().Should().Be("INSTRUCTION"); + _reporter.Lines.First().Should().Be(EnvironmentPathInstructionMock.MockInstructionText); } [Fact] public void GivenFailedPackageInstallWhenRunWithPackageIdItShouldFail() { + var toolPackageInstaller = + CreateToolPackageInstaller( + installCallback: () => throw new ToolPackageException("Simulated error")); + var installToolCommand = new InstallToolCommand( _appliedCommand, _parseResult, - _toolPackageStore, - CreateToolPackageInstaller( - installCallback: () => throw new ToolPackageException("Simulated error")), - _shellShimRepositoryMock, + (_) => (_toolPackageStore, toolPackageInstaller), + _createShellShimRepository, _environmentPathInstructionMock, _reporter); @@ -166,9 +172,8 @@ namespace Microsoft.DotNet.Tests.Commands var installToolCommand = new InstallToolCommand( _appliedCommand, _parseResult, - _toolPackageStore, - CreateToolPackageInstaller(), - _shellShimRepositoryMock, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, _environmentPathInstructionMock, _reporter); @@ -188,13 +193,15 @@ namespace Microsoft.DotNet.Tests.Commands [Fact] public void GivenInCorrectToolConfigurationWhenRunWithPackageIdItShouldFail() { + var toolPackageInstaller = + CreateToolPackageInstaller( + installCallback: () => throw new ToolConfigurationException("Simulated error")); + var installToolCommand = new InstallToolCommand( _appliedCommand, _parseResult, - _toolPackageStore, - CreateToolPackageInstaller( - installCallback: () => throw new ToolConfigurationException("Simulated error")), - _shellShimRepositoryMock, + (_) => (_toolPackageStore, toolPackageInstaller), + _createShellShimRepository, _environmentPathInstructionMock, _reporter); @@ -216,9 +223,8 @@ namespace Microsoft.DotNet.Tests.Commands var installToolCommand = new InstallToolCommand( _appliedCommand, _parseResult, - _toolPackageStore, - CreateToolPackageInstaller(), - _shellShimRepositoryMock, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true), _reporter); @@ -244,9 +250,8 @@ namespace Microsoft.DotNet.Tests.Commands var installToolCommand = new InstallToolCommand( appliedCommand, result, - _toolPackageStore, - CreateToolPackageInstaller(), - _shellShimRepositoryMock, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true), _reporter); @@ -268,9 +273,8 @@ namespace Microsoft.DotNet.Tests.Commands var installToolCommand = new InstallToolCommand( appliedCommand, result, - _toolPackageStore, - CreateToolPackageInstaller(), - _shellShimRepositoryMock, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true), _reporter); @@ -295,9 +299,8 @@ namespace Microsoft.DotNet.Tests.Commands var installToolCommand = new InstallToolCommand( appliedCommand, result, - _toolPackageStore, - CreateToolPackageInstaller(), - _shellShimRepositoryMock, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true), _reporter); @@ -322,9 +325,8 @@ namespace Microsoft.DotNet.Tests.Commands var installToolCommand = new InstallToolCommand( appliedCommand, result, - _toolPackageStore, - CreateToolPackageInstaller(), - _shellShimRepositoryMock, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true), _reporter); @@ -348,9 +350,8 @@ namespace Microsoft.DotNet.Tests.Commands var installToolCommand = new InstallToolCommand( appliedCommand, result, - _toolPackageStore, - CreateToolPackageInstaller(), - _shellShimRepositoryMock, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true), _reporter); @@ -366,6 +367,70 @@ namespace Microsoft.DotNet.Tests.Commands PackageVersion).Green()); } + [Fact] + public void WhenRunWithBothGlobalAndToolPathShowErrorMessage() + { + var result = Parser.Instance.Parse($"dotnet install tool -g --tool-path /tmp/folder {PackageId}"); + var appliedCommand = result["dotnet"]["install"]["tool"]; + var parser = Parser.Instance; + var parseResult = parser.ParseFrom("dotnet install", new[] {"tool", PackageId}); + + var installToolCommand = new InstallToolCommand( + appliedCommand, + parseResult, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, + new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true), + _reporter); + + Action a = () => installToolCommand.Execute(); + + a.ShouldThrow().And.Message + .Should().Contain(LocalizableStrings.InstallToolCommandInvalidGlobalAndToolPath); + } + + [Fact] + public void WhenRunWithNeitherOfGlobalNorToolPathShowErrorMessage() + { + var result = Parser.Instance.Parse($"dotnet install tool {PackageId}"); + var appliedCommand = result["dotnet"]["install"]["tool"]; + var parser = Parser.Instance; + var parseResult = parser.ParseFrom("dotnet install", new[] { "tool", PackageId }); + + var installToolCommand = new InstallToolCommand( + appliedCommand, + parseResult, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, + new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true), + _reporter); + + Action a = () => installToolCommand.Execute(); + + a.ShouldThrow().And.Message + .Should().Contain(LocalizableStrings.InstallToolCommandNeedGlobalOrToolPath); + } + + [Fact] + public void WhenRunWithPackageIdAndBinPathItShouldNoteHaveEnvironmentPathInstruction() + { + var result = Parser.Instance.Parse($"dotnet install tool --tool-path /tmp/folder {PackageId}"); + var appliedCommand = result["dotnet"]["install"]["tool"]; + var parser = Parser.Instance; + var parseResult = parser.ParseFrom("dotnet install", new[] {"tool", PackageId}); + + var installToolCommand = new InstallToolCommand(appliedCommand, + parseResult, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, + new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim), + _reporter); + + installToolCommand.Execute().Should().Be(0); + + _reporter.Lines.Should().NotContain(l => l.Contains(EnvironmentPathInstructionMock.MockInstructionText)); + } + private IToolPackageInstaller CreateToolPackageInstaller( IEnumerable feeds = null, Action installCallback = null) diff --git a/test/dotnet.Tests/CommandTests/UninstallToolCommandTests.cs b/test/dotnet.Tests/CommandTests/UninstallToolCommandTests.cs index 64e11654c..6d62c9729 100644 --- a/test/dotnet.Tests/CommandTests/UninstallToolCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/UninstallToolCommandTests.cs @@ -29,7 +29,6 @@ namespace Microsoft.DotNet.Tests.Commands { private readonly BufferedReporter _reporter; private readonly IFileSystem _fileSystem; - private readonly ShellShimRepositoryMock _shellShimRepositoryMock; private readonly EnvironmentPathInstructionMock _environmentPathInstructionMock; private const string PackageId = "global.tool.console.demo"; @@ -41,7 +40,6 @@ namespace Microsoft.DotNet.Tests.Commands { _reporter = new BufferedReporter(); _fileSystem = new FileSystemMockBuilder().Build(); - _shellShimRepositoryMock = new ShellShimRepositoryMock(new DirectoryPath(ShimsDirectory), _fileSystem); _environmentPathInstructionMock = new EnvironmentPathInstructionMock(_reporter, ShimsDirectory); } @@ -62,22 +60,6 @@ namespace Microsoft.DotNet.Tests.Commands packageId).Red()); } - [Fact] - public void GivenAMissingGlobalOptionItErrors() - { - var command = CreateUninstallCommand("does.not.exist"); - - Action a = () => { - command.Execute(); - }; - - a.ShouldThrow() - .And - .Message - .Should() - .Be(LocalizableStrings.UninstallToolCommandOnlySupportsGlobal); - } - [Fact] public void GivenAPackageItUninstalls() { @@ -165,22 +147,45 @@ namespace Microsoft.DotNet.Tests.Commands _fileSystem.File.Exists(shimPath).Should().BeTrue(); } + [Fact] + public void WhenRunWithBothGlobalAndToolPathShowErrorMessage() + { + var uninstallCommand = CreateUninstallCommand($"-g --tool-path /tmp/folder {PackageId}"); + + Action a = () => uninstallCommand.Execute(); + + a.ShouldThrow().And.Message + .Should().Contain(LocalizableStrings.UninstallToolCommandInvalidGlobalAndToolPath); + } + + [Fact] + public void WhenRunWithNeitherOfGlobalNorToolPathShowErrorMessage() + { + var uninstallCommand = CreateUninstallCommand(PackageId); + + Action a = () => uninstallCommand.Execute(); + + a.ShouldThrow().And.Message + .Should().Contain(LocalizableStrings.UninstallToolCommandNeedGlobalOrToolPath); + } + private InstallToolCommand CreateInstallCommand(string options) { ParseResult result = Parser.Instance.Parse("dotnet install tool " + options); var store = new ToolPackageStoreMock(new DirectoryPath(ToolsDirectory), _fileSystem); + var packageInstallerMock = new ToolPackageInstallerMock( + _fileSystem, + store, + new ProjectRestorerMock( + _fileSystem, + _reporter)); + return new InstallToolCommand( result["dotnet"]["install"]["tool"], result, - store, - new ToolPackageInstallerMock( - _fileSystem, - store, - new ProjectRestorerMock( - _fileSystem, - _reporter)), - _shellShimRepositoryMock, + (_) => (store, packageInstallerMock), + (_) => new ShellShimRepositoryMock(new DirectoryPath(ShimsDirectory), _fileSystem), _environmentPathInstructionMock, _reporter); } @@ -192,11 +197,11 @@ namespace Microsoft.DotNet.Tests.Commands return new UninstallToolCommand( result["dotnet"]["uninstall"]["tool"], result, - new ToolPackageStoreMock( + (_) => new ToolPackageStoreMock( new DirectoryPath(ToolsDirectory), _fileSystem, uninstallCallback), - _shellShimRepositoryMock, + (_) => new ShellShimRepositoryMock(new DirectoryPath(ShimsDirectory), _fileSystem), _reporter); } } diff --git a/test/dotnet.Tests/ParserTests/InstallToolParserTests.cs b/test/dotnet.Tests/ParserTests/InstallToolParserTests.cs index 72d04d1c9..1c9b54e64 100644 --- a/test/dotnet.Tests/ParserTests/InstallToolParserTests.cs +++ b/test/dotnet.Tests/ParserTests/InstallToolParserTests.cs @@ -79,5 +79,15 @@ namespace Microsoft.DotNet.Tests.ParserTests var appliedOptions = result["dotnet"]["install"]["tool"]; appliedOptions.SingleArgumentOrDefault("verbosity").Should().Be(expectedVerbosityLevel); } + + [Fact] + public void InstallToolParserCanParseToolPathOption() + { + var result = + Parser.Instance.Parse(@"dotnet install tool --tool-path C:\TestAssetLocalNugetFeed console.test.app"); + + var appliedOptions = result["dotnet"]["install"]["tool"]; + appliedOptions.SingleArgumentOrDefault("tool-path").Should().Be(@"C:\TestAssetLocalNugetFeed"); + } } } diff --git a/test/dotnet.Tests/ParserTests/UninstallInstallToolParserTests.cs b/test/dotnet.Tests/ParserTests/UninstallInstallToolParserTests.cs new file mode 100644 index 000000000..ab1581f5d --- /dev/null +++ b/test/dotnet.Tests/ParserTests/UninstallInstallToolParserTests.cs @@ -0,0 +1,55 @@ +// 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.Linq; +using FluentAssertions; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.CommandLine; +using Xunit; +using Xunit.Abstractions; +using Parser = Microsoft.DotNet.Cli.Parser; + +namespace Microsoft.DotNet.Tests.ParserTests +{ + public class UninstallInstallToolParserTests + { + private readonly ITestOutputHelper output; + + public UninstallInstallToolParserTests(ITestOutputHelper output) + { + this.output = output; + } + + [Fact] + public void UninstallGlobaltoolParserCanGetPackageId() + { + var command = Parser.Instance; + var result = command.Parse("dotnet uninstall tool -g console.test.app"); + + var parseResult = result["dotnet"]["uninstall"]["tool"]; + + var packageId = parseResult.Arguments.Single(); + + packageId.Should().Be("console.test.app"); + } + + [Fact] + public void UninstallToolParserCanGetGlobalOption() + { + var result = Parser.Instance.Parse("dotnet uninstall tool -g console.test.app"); + + var appliedOptions = result["dotnet"]["uninstall"]["tool"]; + appliedOptions.ValueOrDefault("global").Should().Be(true); + } + + [Fact] + public void UninstallToolParserCanParseToolPathOption() + { + var result = + Parser.Instance.Parse(@"dotnet uninstall tool --tool-path C:\TestAssetLocalNugetFeed console.test.app"); + + var appliedOptions = result["dotnet"]["uninstall"]["tool"]; + appliedOptions.SingleArgumentOrDefault("tool-path").Should().Be(@"C:\TestAssetLocalNugetFeed"); + } + } +} From e2d9c2f892e3327374635f75fca6fbe8bea0092a Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Tue, 6 Mar 2018 16:15:27 -0800 Subject: [PATCH 082/103] Remove temp project path from tool install warnings and errors. This commit attempts to filter the diagnostic messages emitted during tool installation. The diagnostic messages may be prefixed with the temporary project; since this is an implementation detail that only causes confusion and clutter in the diagnostic messages, the prefix is removed if present. Fixes #8707. --- src/dotnet/ToolPackage/ToolPackageFactory.cs | 2 +- .../ToolPackage/ToolPackageInstaller.cs | 2 +- .../dotnet-install-tool/ProjectRestorer.cs | 35 ++++++++++++++++--- .../ToolPackageInstallerTests.cs | 26 ++++++++++++++ 4 files changed, 59 insertions(+), 6 deletions(-) diff --git a/src/dotnet/ToolPackage/ToolPackageFactory.cs b/src/dotnet/ToolPackage/ToolPackageFactory.cs index c619df4a3..f3349db77 100644 --- a/src/dotnet/ToolPackage/ToolPackageFactory.cs +++ b/src/dotnet/ToolPackage/ToolPackageFactory.cs @@ -16,7 +16,7 @@ namespace Microsoft.DotNet.ToolPackage IToolPackageStore toolPackageStore = CreateToolPackageStore(nonGlobalLocation); var toolPackageInstaller = new ToolPackageInstaller( toolPackageStore, - new ProjectRestorer(Reporter.Output)); + new ProjectRestorer()); return (toolPackageStore, toolPackageInstaller); } diff --git a/src/dotnet/ToolPackage/ToolPackageInstaller.cs b/src/dotnet/ToolPackage/ToolPackageInstaller.cs index cf655a301..44a51094e 100644 --- a/src/dotnet/ToolPackage/ToolPackageInstaller.cs +++ b/src/dotnet/ToolPackage/ToolPackageInstaller.cs @@ -119,7 +119,7 @@ namespace Microsoft.DotNet.ToolPackage { var tempProject = _tempProject ?? new DirectoryPath(Path.GetTempPath()) .WithSubDirectories(Path.GetRandomFileName()) - .WithFile(Path.GetRandomFileName() + ".csproj"); + .WithFile("restore.csproj"); if (Path.GetExtension(tempProject.Value) != "csproj") { 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 06cc81c38..5ba8a177b 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/ProjectRestorer.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/ProjectRestorer.cs @@ -16,10 +16,14 @@ namespace Microsoft.DotNet.Tools.Install.Tool { private const string AnyRid = "any"; private readonly IReporter _reporter; + private readonly IReporter _errorReporter; + private readonly bool _forceOutputRedirection; public ProjectRestorer(IReporter reporter = null) { - _reporter = reporter; + _reporter = reporter ?? Reporter.Output; + _errorReporter = reporter ?? Reporter.Error; + _forceOutputRedirection = reporter != null; } public void Restore( @@ -56,11 +60,11 @@ namespace Microsoft.DotNet.Tools.Install.Tool var command = new DotNetCommandFactory(alwaysRunOutOfProc: true) .Create("restore", argsToPassToRestore); - if (_reporter != null) + if (verbosity == null || _forceOutputRedirection) { command = command - .OnOutputLine((line) => _reporter.WriteLine(line)) - .OnErrorLine((line) => _reporter.WriteLine(line)); + .OnOutputLine(line => WriteLine(_reporter, line, project)) + .OnErrorLine(line => WriteLine(_errorReporter, line, project)); } var result = command.Execute(); @@ -69,5 +73,28 @@ namespace Microsoft.DotNet.Tools.Install.Tool throw new ToolPackageException(LocalizableStrings.ToolInstallationRestoreFailed); } } + + private static void WriteLine(IReporter reporter, string line, FilePath project) + { + line = line ?? ""; + + // Remove the temp project prefix if present + if (line.StartsWith($"{project.Value} : ", StringComparison.OrdinalIgnoreCase)) + { + line = line.Substring(project.Value.Length + 3); + } + + // Note: MSBuild intentionally does not localize "warning" and "error" for diagnostic messages + if (line.StartsWith("warning ", StringComparison.Ordinal)) + { + line = line.Yellow(); + } + else if (line.StartsWith("error ", StringComparison.Ordinal)) + { + line = line.Red(); + } + + reporter.WriteLine(line); + } } } diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs index 31ecb91dd..f08ca6077 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs +++ b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs @@ -498,6 +498,32 @@ namespace Microsoft.DotNet.ToolPackage.Tests package.Uninstall(); } + [Fact] + public void GivenANuGetDiagnosticMessageItShouldNotContainTheTempProject() + { + var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); + var tempProject = GetUniqueTempProjectPathEachTest(); + + var (store, installer, reporter, fileSystem) = Setup( + useMock: false, + tempProject: tempProject); + + var package = installer.InstallPackage( + packageId: TestPackageId, + versionRange: VersionRange.Parse("1.0.*"), + targetFramework: _testTargetframework, + nugetConfig: nugetConfigPath); + + reporter.Lines.Should().NotBeEmpty(); + reporter.Lines.Should().Contain(l => l.Contains("warning")); + reporter.Lines.Should().NotContain(l => l.Contains(tempProject.Value)); + reporter.Lines.Clear(); + + AssertPackageInstall(reporter, fileSystem, package, store); + + package.Uninstall(); + } + private static void AssertPackageInstall( BufferedReporter reporter, IFileSystem fileSystem, From b8685bebb9bb8a2bdd7aaf8b5f9f0bf3d26078d6 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Wed, 7 Mar 2018 09:40:06 -0800 Subject: [PATCH 083/103] Updating the dotnet --info message. --- src/dotnet/Program.cs | 8 +++----- .../GivenThatTheUserIsRunningDotNetForTheFirstTime.cs | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/dotnet/Program.cs b/src/dotnet/Program.cs index 1e83488be..f5a1ef334 100644 --- a/src/dotnet/Program.cs +++ b/src/dotnet/Program.cs @@ -260,14 +260,12 @@ namespace Microsoft.DotNet.Cli private static void PrintInfo() { - HelpCommand.PrintVersionHeader(); - DotnetVersionFile versionFile = DotnetFiles.VersionFileObject; var commitSha = versionFile.CommitSha ?? "N/A"; Reporter.Output.WriteLine(); - Reporter.Output.WriteLine("Product Information:"); - Reporter.Output.WriteLine($" Version: {Product.Version}"); - Reporter.Output.WriteLine($" Commit SHA-1 hash: {commitSha}"); + Reporter.Output.WriteLine(".NET Core SDK (reflecting any global.json):"); + Reporter.Output.WriteLine($" Version: {Product.Version}"); + Reporter.Output.WriteLine($" Commit: {commitSha}"); Reporter.Output.WriteLine(); Reporter.Output.WriteLine("Runtime Environment:"); Reporter.Output.WriteLine($" OS Name: {RuntimeEnvironment.OperatingSystem}"); diff --git a/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs b/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs index 6f2b1db8f..0563e7d63 100644 --- a/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs +++ b/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs @@ -60,7 +60,7 @@ namespace Microsoft.DotNet.Tests [Fact] public void UsingDotnetForTheFirstTimeWithNonVerbsDoesNotPrintEula() { - string firstTimeNonVerbUseMessage = Cli.Utils.LocalizableStrings.DotNetCommandLineTools; + const string firstTimeNonVerbUseMessage = $"{string.NewLine}.NET Core SDK (reflecting any global.json):"; _firstDotnetNonVerbUseCommandResult.StdOut .Should() From 9da134cad117e7c13f618113daa0a257edef9154 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Wed, 7 Mar 2018 12:39:46 -0800 Subject: [PATCH 084/103] Localizing portions of dotnet --info. --- src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.resx | 6 ++++++ .../xlf/LocalizableStrings.cs.xlf | 10 ++++++++++ .../xlf/LocalizableStrings.de.xlf | 10 ++++++++++ .../xlf/LocalizableStrings.es.xlf | 10 ++++++++++ .../xlf/LocalizableStrings.fr.xlf | 10 ++++++++++ .../xlf/LocalizableStrings.it.xlf | 10 ++++++++++ .../xlf/LocalizableStrings.ja.xlf | 10 ++++++++++ .../xlf/LocalizableStrings.ko.xlf | 10 ++++++++++ .../xlf/LocalizableStrings.pl.xlf | 10 ++++++++++ .../xlf/LocalizableStrings.pt-BR.xlf | 10 ++++++++++ .../xlf/LocalizableStrings.ru.xlf | 10 ++++++++++ .../xlf/LocalizableStrings.tr.xlf | 10 ++++++++++ .../xlf/LocalizableStrings.zh-Hans.xlf | 10 ++++++++++ .../xlf/LocalizableStrings.zh-Hant.xlf | 10 ++++++++++ src/dotnet/Program.cs | 6 +++--- .../GivenThatTheUserIsRunningDotNetForTheFirstTime.cs | 2 +- 16 files changed, 140 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.resx b/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.resx index 0fe90333b..2ebbb5fe9 100644 --- a/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.resx +++ b/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.resx @@ -241,6 +241,12 @@ .NET Command Line Tools + + .NET Core SDK (reflecting any global.json): + + + Runtime Environment: + WriteLine forwarder set previously diff --git a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.cs.xlf b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.cs.xlf index 1aaef6cd5..d97ad03f5 100644 --- a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.cs.xlf +++ b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.cs.xlf @@ -234,6 +234,16 @@ Spustitelný soubor příkazu {0} se nenašel. Projekt se nepodařilo obnovit nebo jeho obnovení nebylo úspěšné. Spusťte příkaz dotnet restore. + + .NET Core SDK (reflecting any global.json): + .NET Core SDK (reflecting any global.json): + + + + Runtime Environment: + Runtime Environment: + + \ No newline at end of file diff --git a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.de.xlf b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.de.xlf index d09a4d531..2d1b8c640 100644 --- a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.de.xlf +++ b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.de.xlf @@ -234,6 +234,16 @@ Der für "{0}" auszuführende Befehl wurde nicht gefunden. Das Projekt wurde möglicherweise nicht wiederhergestellt, oder bei der Wiederherstellung ist ein Fehler aufgetreten. Führen Sie "dotnet restore" aus. + + .NET Core SDK (reflecting any global.json): + .NET Core SDK (reflecting any global.json): + + + + Runtime Environment: + Runtime Environment: + + \ No newline at end of file diff --git a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.es.xlf b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.es.xlf index c235b3cd2..f123e30d9 100644 --- a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.es.xlf +++ b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.es.xlf @@ -234,6 +234,16 @@ No se encontró el comando ejecutable para "{0}". Puede que el proyecto no se haya restaurado o que la restauración no haya tenido éxito. Ejecute "dotnet restore" + + .NET Core SDK (reflecting any global.json): + .NET Core SDK (reflecting any global.json): + + + + Runtime Environment: + Runtime Environment: + + \ No newline at end of file diff --git a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.fr.xlf b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.fr.xlf index 507b69cec..1120da01a 100644 --- a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.fr.xlf +++ b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.fr.xlf @@ -234,6 +234,16 @@ La commande exécutable pour "{0}" est introuvable. Le projet n'a peut-être pas été restauré, ou la restauration n'a pas fonctionné - exécutez 'dotnet restore' + + .NET Core SDK (reflecting any global.json): + .NET Core SDK (reflecting any global.json): + + + + Runtime Environment: + Runtime Environment: + + \ No newline at end of file diff --git a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.it.xlf b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.it.xlf index 84efa6a29..9cd9eb799 100644 --- a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.it.xlf +++ b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.it.xlf @@ -234,6 +234,16 @@ L'eseguibile del comando per "{0}" non è stato trovato. È possibile che il progetto non sia stato ripristinato o che il ripristino non sia riuscito. Eseguire `dotnet restore` + + .NET Core SDK (reflecting any global.json): + .NET Core SDK (reflecting any global.json): + + + + Runtime Environment: + Runtime Environment: + + \ No newline at end of file diff --git a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.ja.xlf b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.ja.xlf index 88387b742..781282b5b 100644 --- a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.ja.xlf +++ b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.ja.xlf @@ -234,6 +234,16 @@ "{0}" で実行可能なコマンドが見つかりませんでした。プロジェクトが復元されていない可能性があるか、または復元に失敗しました。`dotnet restore` を実行します。 + + .NET Core SDK (reflecting any global.json): + .NET Core SDK (reflecting any global.json): + + + + Runtime Environment: + Runtime Environment: + + \ No newline at end of file diff --git a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.ko.xlf b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.ko.xlf index ff639f8e2..750cf37b3 100644 --- a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.ko.xlf +++ b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.ko.xlf @@ -234,6 +234,16 @@ "{0}"에 대해 실행 가능한 명령을 찾지 못했습니다. 프로젝트가 복원되지 않았거나 복원이 실패했을 수 있습니다. 'dotnet restore'를 실행하세요. + + .NET Core SDK (reflecting any global.json): + .NET Core SDK (reflecting any global.json): + + + + Runtime Environment: + Runtime Environment: + + \ No newline at end of file diff --git a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.pl.xlf b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.pl.xlf index a36aa643d..8e614f3e7 100644 --- a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.pl.xlf +++ b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.pl.xlf @@ -234,6 +234,16 @@ Nie znaleziono pliku wykonywalnego polecenia dla elementu „{0}”. Projekt mógł nie zostać przywrócony lub przywracanie zakończyło się niepowodzeniem — uruchom polecenie „dotnet restore” + + .NET Core SDK (reflecting any global.json): + .NET Core SDK (reflecting any global.json): + + + + Runtime Environment: + Runtime Environment: + + \ No newline at end of file diff --git a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.pt-BR.xlf b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.pt-BR.xlf index aa7c61690..9c273516d 100644 --- a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.pt-BR.xlf @@ -234,6 +234,16 @@ O comando executável para "{0}" não foi encontrado. O projeto pode não ter sido restaurado ou a restauração falhou – execute `dotnet restore` + + .NET Core SDK (reflecting any global.json): + .NET Core SDK (reflecting any global.json): + + + + Runtime Environment: + Runtime Environment: + + \ No newline at end of file diff --git a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.ru.xlf b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.ru.xlf index d4bb9fefd..4e3e0e41c 100644 --- a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.ru.xlf +++ b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.ru.xlf @@ -234,6 +234,16 @@ Исполняемый файл команды для "{0}" не найден. Возможно, проект не был восстановлен или его восстановление завершилось сбоем. Запустите команду "dotnet restore". + + .NET Core SDK (reflecting any global.json): + .NET Core SDK (reflecting any global.json): + + + + Runtime Environment: + Runtime Environment: + + \ No newline at end of file diff --git a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.tr.xlf b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.tr.xlf index f0634cf3e..5bb319c46 100644 --- a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.tr.xlf +++ b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.tr.xlf @@ -234,6 +234,16 @@ "{0}" için komut yürütülebilir dosyası bulunamadı. Proje geri yüklenmemiş veya geri yükleme başarısız olmuş olabilir - `dotnet restore` çalıştırın + + .NET Core SDK (reflecting any global.json): + .NET Core SDK (reflecting any global.json): + + + + Runtime Environment: + Runtime Environment: + + \ No newline at end of file diff --git a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.zh-Hans.xlf b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.zh-Hans.xlf index 6ae013bb9..ba1d877e6 100644 --- a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.zh-Hans.xlf @@ -234,6 +234,16 @@ 找不到可为“{0}”执行的命令。可能未还原项目或还原失败 - 运行 `dotnet restore` + + .NET Core SDK (reflecting any global.json): + .NET Core SDK (reflecting any global.json): + + + + Runtime Environment: + Runtime Environment: + + \ No newline at end of file diff --git a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.zh-Hant.xlf b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.zh-Hant.xlf index 88c9e644b..edae196da 100644 --- a/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/Microsoft.DotNet.Cli.Utils/xlf/LocalizableStrings.zh-Hant.xlf @@ -234,6 +234,16 @@ 找不到 "{0}" 的命令可執行檔。該專案可能尚未還原或還原失敗 - 請執行 `dotnet restore` + + .NET Core SDK (reflecting any global.json): + .NET Core SDK (reflecting any global.json): + + + + Runtime Environment: + Runtime Environment: + + \ No newline at end of file diff --git a/src/dotnet/Program.cs b/src/dotnet/Program.cs index f5a1ef334..4283bb96a 100644 --- a/src/dotnet/Program.cs +++ b/src/dotnet/Program.cs @@ -17,6 +17,7 @@ using Microsoft.Extensions.EnvironmentAbstractions; using NuGet.Frameworks; using Command = Microsoft.DotNet.Cli.Utils.Command; using RuntimeEnvironment = Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment; +using LocalizableStrings = Microsoft.DotNet.Cli.Utils.LocalizableStrings; namespace Microsoft.DotNet.Cli { @@ -262,12 +263,11 @@ namespace Microsoft.DotNet.Cli { DotnetVersionFile versionFile = DotnetFiles.VersionFileObject; var commitSha = versionFile.CommitSha ?? "N/A"; - Reporter.Output.WriteLine(); - Reporter.Output.WriteLine(".NET Core SDK (reflecting any global.json):"); + Reporter.Output.WriteLine($"{LocalizableStrings.DotNetSdkInfoLabel}"); Reporter.Output.WriteLine($" Version: {Product.Version}"); Reporter.Output.WriteLine($" Commit: {commitSha}"); Reporter.Output.WriteLine(); - Reporter.Output.WriteLine("Runtime Environment:"); + Reporter.Output.WriteLine($"{LocalizableStrings.DotNetRuntimeInfoLabel}"); Reporter.Output.WriteLine($" OS Name: {RuntimeEnvironment.OperatingSystem}"); Reporter.Output.WriteLine($" OS Version: {RuntimeEnvironment.OperatingSystemVersion}"); Reporter.Output.WriteLine($" OS Platform: {RuntimeEnvironment.OperatingSystemPlatform}"); diff --git a/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs b/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs index 0563e7d63..bccc3c053 100644 --- a/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs +++ b/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs @@ -60,7 +60,7 @@ namespace Microsoft.DotNet.Tests [Fact] public void UsingDotnetForTheFirstTimeWithNonVerbsDoesNotPrintEula() { - const string firstTimeNonVerbUseMessage = $"{string.NewLine}.NET Core SDK (reflecting any global.json):"; + string firstTimeNonVerbUseMessage = Cli.Utils.LocalizableStrings.DotNetSdkInfoLabel; _firstDotnetNonVerbUseCommandResult.StdOut .Should() From 2e7c5f123aee7e13d2346d04fd589f5e0dbfdfc7 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Wed, 7 Mar 2018 19:23:05 -0800 Subject: [PATCH 085/103] Update CoreSetup to preview2-26306-04 (master) (#8731) --- build/DependencyVersions.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index c2405642c..a9ae2c7e8 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -2,7 +2,7 @@ 2.1.0-preview2-30248 - 2.1.0-preview2-26306-03 + 2.1.0-preview2-26306-04 $(MicrosoftNETCoreAppPackageVersion) 15.7.0-preview-000063 $(MicrosoftBuildPackageVersion) @@ -28,8 +28,8 @@ $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) - 2.1.0-preview2-26306-03 - 2.1.0-preview2-26306-03 + 2.1.0-preview2-26306-04 + 2.1.0-preview2-26306-04 0.1.1-alpha-174 1.2.1-alpha-002133 $(MicrosoftDotNetProjectJsonMigrationPackageVersion) From 495630fe9782ae70db2547b2474ba332352cfd1d Mon Sep 17 00:00:00 2001 From: William Lee Date: Wed, 7 Mar 2018 19:46:38 -0800 Subject: [PATCH 086/103] when process has not env, but future will, show the instruction (#8739) --- .../ShellShim/WindowsEnvironmentPath.cs | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/dotnet/ShellShim/WindowsEnvironmentPath.cs b/src/dotnet/ShellShim/WindowsEnvironmentPath.cs index b530e5935..530f7c5bf 100644 --- a/src/dotnet/ShellShim/WindowsEnvironmentPath.cs +++ b/src/dotnet/ShellShim/WindowsEnvironmentPath.cs @@ -40,10 +40,19 @@ namespace Microsoft.DotNet.ShellShim } private bool PackageExecutablePathExists() + { + return PackageExecutablePathExistsForCurrentProcess() || PackageExecutablePathWillExistForFutureNewProcess(); + } + + private bool PackageExecutablePathWillExistForFutureNewProcess() { return EnvironmentVariableConatinsPackageExecutablePath(Environment.GetEnvironmentVariable(PathName, EnvironmentVariableTarget.User)) - || EnvironmentVariableConatinsPackageExecutablePath(Environment.GetEnvironmentVariable(PathName, EnvironmentVariableTarget.Machine)) - || EnvironmentVariableConatinsPackageExecutablePath(Environment.GetEnvironmentVariable(PathName, EnvironmentVariableTarget.Process)); + || EnvironmentVariableConatinsPackageExecutablePath(Environment.GetEnvironmentVariable(PathName, EnvironmentVariableTarget.Machine)); + } + + private bool PackageExecutablePathExistsForCurrentProcess() + { + return EnvironmentVariableConatinsPackageExecutablePath(Environment.GetEnvironmentVariable(PathName, EnvironmentVariableTarget.Process)); } private bool EnvironmentVariableConatinsPackageExecutablePath(string environmentVariable) @@ -58,21 +67,17 @@ namespace Microsoft.DotNet.ShellShim public void PrintAddPathInstructionIfPathDoesNotExist() { - if (!PackageExecutablePathExists()) + if (!PackageExecutablePathExistsForCurrentProcess() && PackageExecutablePathWillExistForFutureNewProcess()) { - if (Environment.GetEnvironmentVariable(PathName, EnvironmentVariableTarget.User).Split(';') - .Contains(_packageExecutablePath)) - { - _reporter.WriteLine( - CommonLocalizableStrings.EnvironmentPathWindowsNeedReopen); - } - else - { - _reporter.WriteLine( - string.Format( - CommonLocalizableStrings.EnvironmentPathWindowsManualInstructions, - _packageExecutablePath)); - } + _reporter.WriteLine( + CommonLocalizableStrings.EnvironmentPathWindowsNeedReopen); + } + else if (!PackageExecutablePathWillExistForFutureNewProcess()) + { + _reporter.WriteLine( + string.Format( + CommonLocalizableStrings.EnvironmentPathWindowsManualInstructions, + _packageExecutablePath)); } } } From af526542a2099c5b950c2c7cdb0749db29eeb62e Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Thu, 8 Mar 2018 09:18:05 -0800 Subject: [PATCH 087/103] Update CoreSetup, CoreSetup, CoreSetup, Roslyn to preview2-26308-01, preview2-26308-01, preview2-26308-01, beta2-62708-04, respectively (#8742) --- build/DependencyVersions.props | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index a9ae2c7e8..a2cb83f14 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -2,7 +2,7 @@ 2.1.0-preview2-30248 - 2.1.0-preview2-26306-04 + 2.1.0-preview2-26308-01 $(MicrosoftNETCoreAppPackageVersion) 15.7.0-preview-000063 $(MicrosoftBuildPackageVersion) @@ -10,7 +10,7 @@ $(MicrosoftBuildPackageVersion) $(MicrosoftBuildPackageVersion) 10.1.4-rtm-180213-0 - 2.8.0-beta1-62608-01 + 2.8.0-beta2-62708-04 $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) @@ -28,8 +28,8 @@ $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) - 2.1.0-preview2-26306-04 - 2.1.0-preview2-26306-04 + 2.1.0-preview2-26308-01 + 2.1.0-preview2-26308-01 0.1.1-alpha-174 1.2.1-alpha-002133 $(MicrosoftDotNetProjectJsonMigrationPackageVersion) From 52478e8947d12953119ebf6175adaa0166a7558f Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Wed, 7 Mar 2018 01:30:18 -0800 Subject: [PATCH 088/103] Stop modifying current working directory from test. This commit fixes the ToolPackageInstaller tests so that they no longer modify the current working directory. The directory being set is now being properly passed in as an argument to override the default of the current working directory. Additionally, this commit also changes the package root to a temp location rather than based off of the current working directory. --- src/dotnet/ToolPackage/IToolPackageInstaller.cs | 1 + src/dotnet/ToolPackage/ToolPackageInstaller.cs | 9 ++++++--- .../ToolPackageInstallerTests.cs | 12 ++++-------- .../ToolPackageInstallerMock.cs | 1 + 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/dotnet/ToolPackage/IToolPackageInstaller.cs b/src/dotnet/ToolPackage/IToolPackageInstaller.cs index c6ef964e1..d54de5460 100644 --- a/src/dotnet/ToolPackage/IToolPackageInstaller.cs +++ b/src/dotnet/ToolPackage/IToolPackageInstaller.cs @@ -15,6 +15,7 @@ namespace Microsoft.DotNet.ToolPackage VersionRange versionRange = null, string targetFramework = null, FilePath? nugetConfig = null, + DirectoryPath? rootConfigDirectory = null, string source = null, string verbosity = null); } diff --git a/src/dotnet/ToolPackage/ToolPackageInstaller.cs b/src/dotnet/ToolPackage/ToolPackageInstaller.cs index 44a51094e..355dabc49 100644 --- a/src/dotnet/ToolPackage/ToolPackageInstaller.cs +++ b/src/dotnet/ToolPackage/ToolPackageInstaller.cs @@ -35,6 +35,7 @@ namespace Microsoft.DotNet.ToolPackage VersionRange versionRange = null, string targetFramework = null, FilePath? nugetConfig = null, + DirectoryPath? rootConfigDirectory = null, string source = null, string verbosity = null) { @@ -53,7 +54,8 @@ namespace Microsoft.DotNet.ToolPackage packageId: packageId, versionRange: versionRange, targetFramework: targetFramework ?? BundledTargetFramework.GetTargetFrameworkMoniker(), - restoreDirectory: stageDirectory); + restoreDirectory: stageDirectory, + rootConfigDirectory: rootConfigDirectory); try { @@ -115,7 +117,8 @@ namespace Microsoft.DotNet.ToolPackage PackageId packageId, VersionRange versionRange, string targetFramework, - DirectoryPath restoreDirectory) + DirectoryPath restoreDirectory, + DirectoryPath? rootConfigDirectory) { var tempProject = _tempProject ?? new DirectoryPath(Path.GetTempPath()) .WithSubDirectories(Path.GetRandomFileName()) @@ -135,7 +138,7 @@ namespace Microsoft.DotNet.ToolPackage new XElement("TargetFramework", targetFramework), new XElement("RestorePackagesPath", restoreDirectory.Value), new XElement("RestoreProjectStyle", "DotnetToolReference"), // without it, project cannot reference tool package - new XElement("RestoreRootConfigDirectory", Directory.GetCurrentDirectory()), // config file probing start directory + new XElement("RestoreRootConfigDirectory", rootConfigDirectory?.Value ?? Directory.GetCurrentDirectory()), // config file probing start directory new XElement("DisableImplicitFrameworkReferences", "true"), // no Microsoft.NETCore.App in tool folder new XElement("RestoreFallbackFolders", "clear"), // do not use fallbackfolder, tool package need to be copied to tool folder new XElement("RestoreAdditionalProjectSources", // use fallbackfolder as feed to enable offline diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs index f08ca6077..b487c7dfb 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs +++ b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs @@ -154,21 +154,17 @@ namespace Microsoft.DotNet.ToolPackage.Tests } [Fact] - public void GivenAConfigFileInCurrentDirectoryPackageInstallSucceeds() + public void GivenAConfigFileRootDirectoryPackageInstallSucceeds() { var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); var (store, installer, reporter, fileSystem) = Setup(useMock: false); - /* - * In test, we don't want NuGet to keep look up, so we point current directory to nugetconfig. - */ - Directory.SetCurrentDirectory(nugetConfigPath.GetDirectoryPath().Value); - var package = installer.InstallPackage( packageId: TestPackageId, versionRange: VersionRange.Parse(TestPackageVersion), - targetFramework: _testTargetframework); + targetFramework: _testTargetframework, + rootConfigDirectory: nugetConfigPath.GetDirectoryPath()); AssertPackageInstall(reporter, fileSystem, package, store); @@ -641,7 +637,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests FilePath? tempProject = null, DirectoryPath? offlineFeed = null) { - var root = new DirectoryPath(Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName())); + var root = new DirectoryPath(Path.Combine(Path.GetFullPath(TempRoot.Root), Path.GetRandomFileName())); var reporter = new BufferedReporter(); IFileSystem fileSystem; diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageInstallerMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageInstallerMock.cs index 9966ddb6a..2d058d6fb 100644 --- a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageInstallerMock.cs +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageInstallerMock.cs @@ -40,6 +40,7 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks VersionRange versionRange = null, string targetFramework = null, FilePath? nugetConfig = null, + DirectoryPath? rootConfigDirectory = null, string source = null, string verbosity = null) { From 3861fc1700f91f4dc9a274fc77fbcff89a6bf6f2 Mon Sep 17 00:00:00 2001 From: William Lee Date: Thu, 8 Mar 2018 15:49:16 -0800 Subject: [PATCH 089/103] Convert to graceful exception (#8751) --- .../GracefulException.cs | 19 ++++++ src/dotnet/DotNetTopLevelCommandBase.cs | 27 +++++---- .../dotnet-install-tool/InstallToolCommand.cs | 60 +++++++++---------- .../tool/UninstallToolCommand.cs | 55 +++++++++-------- .../CommandTests/InstallToolCommandTests.cs | 51 +++++++--------- .../CommandTests/UninstallToolCommandTests.cs | 29 ++++----- 6 files changed, 127 insertions(+), 114 deletions(-) diff --git a/src/Microsoft.DotNet.Cli.Utils/GracefulException.cs b/src/Microsoft.DotNet.Cli.Utils/GracefulException.cs index 50ab33a0b..835faa373 100644 --- a/src/Microsoft.DotNet.Cli.Utils/GracefulException.cs +++ b/src/Microsoft.DotNet.Cli.Utils/GracefulException.cs @@ -2,16 +2,35 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; +using System.Collections.Generic; +using System.Linq; namespace Microsoft.DotNet.Cli.Utils { public class GracefulException : Exception { + public bool IsUserError { get; } = true; + public string VerboseMessage { get; } = string.Empty; + public GracefulException(string message) : base(message) { Data.Add(ExceptionExtensions.CLI_User_Displayed_Exception, true); } + + public GracefulException(IEnumerable messages, IEnumerable verboseMessages = null, + bool isUserError = true) + : base(string.Join(Environment.NewLine, messages)) + { + IsUserError = isUserError; + if (verboseMessages != null) + { + VerboseMessage = string.Join(Environment.NewLine, VerboseMessage); + } + + Data.Add(ExceptionExtensions.CLI_User_Displayed_Exception, true); + } + public GracefulException(string format, params string[] args) : this(string.Format(format, args)) { } diff --git a/src/dotnet/DotNetTopLevelCommandBase.cs b/src/dotnet/DotNetTopLevelCommandBase.cs index bc2fba3f3..6aea4fff6 100644 --- a/src/dotnet/DotNetTopLevelCommandBase.cs +++ b/src/dotnet/DotNetTopLevelCommandBase.cs @@ -42,19 +42,26 @@ namespace Microsoft.DotNet.Cli } catch (KeyNotFoundException) { - return ReportError(CommonLocalizableStrings.RequiredCommandNotPassed); + Reporter.Error.WriteLine(CommonLocalizableStrings.RequiredCommandNotPassed.Red()); + ParseResult.ShowHelp(); + return 1; } catch (GracefulException e) { - return ReportError(e.Message); + if (Reporter.IsVerbose) + { + Reporter.Error.WriteLine(e.VerboseMessage.Red()); + } + + Reporter.Error.WriteLine(e.Message.Red()); + + if (e.IsUserError) + { + ParseResult.ShowHelp(); + } + + return 1; } } - - private int ReportError(string errorMessage) - { - Reporter.Error.WriteLine(errorMessage.Red()); - ParseResult.ShowHelp(); - return 1; - } } -} \ No newline at end of file +} 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 43abd0bc9..a05f85b7b 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs @@ -163,43 +163,41 @@ namespace Microsoft.DotNet.Tools.Install.Tool } catch (ToolPackageException ex) { - if (Reporter.IsVerbose) - { - Reporter.Verbose.WriteLine(ex.ToString().Red()); - } - - _errorReporter.WriteLine(ex.Message.Red()); - _errorReporter.WriteLine(string.Format(LocalizableStrings.ToolInstallationFailed, _packageId).Red()); - return 1; + throw new GracefulException( + messages: new[] + { + ex.Message, + string.Format(LocalizableStrings.ToolInstallationFailed, _packageId), + }, + verboseMessages: new[] {ex.ToString()}, + isUserError: false); } catch (ToolConfigurationException ex) { - if (Reporter.IsVerbose) - { - Reporter.Verbose.WriteLine(ex.ToString().Red()); - } - - _errorReporter.WriteLine( - string.Format( - LocalizableStrings.InvalidToolConfiguration, - ex.Message).Red()); - _errorReporter.WriteLine(string.Format(LocalizableStrings.ToolInstallationFailedContactAuthor, _packageId).Red()); - return 1; + throw new GracefulException( + messages: new[] + { + string.Format( + LocalizableStrings.InvalidToolConfiguration, + ex.Message), + string.Format(LocalizableStrings.ToolInstallationFailedContactAuthor, _packageId) + }, + verboseMessages: new[] {ex.ToString()}, + isUserError: false); } catch (ShellShimException ex) { - if (Reporter.IsVerbose) - { - Reporter.Verbose.WriteLine(ex.ToString().Red()); - } - - _errorReporter.WriteLine( - string.Format( - LocalizableStrings.FailedToCreateToolShim, - _packageId, - ex.Message).Red()); - _errorReporter.WriteLine(string.Format(LocalizableStrings.ToolInstallationFailed, _packageId).Red()); - return 1; + throw new GracefulException( + messages: new[] + { + string.Format( + LocalizableStrings.FailedToCreateToolShim, + _packageId, + ex.Message), + string.Format(LocalizableStrings.ToolInstallationFailed, _packageId) + }, + verboseMessages: new[] {ex.ToString()}, + isUserError: false); } } } diff --git a/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs index 063686b21..15268bc38 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs +++ b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs @@ -74,20 +74,26 @@ namespace Microsoft.DotNet.Tools.Uninstall.Tool package = toolPackageStore.EnumeratePackageVersions(packageId).SingleOrDefault(); if (package == null) { - _errorReporter.WriteLine( - string.Format( - LocalizableStrings.ToolNotInstalled, - packageId).Red()); - return 1; + throw new GracefulException( + messages: new[] + { + string.Format( + LocalizableStrings.ToolNotInstalled, + packageId), + }, + isUserError: false); } } catch (InvalidOperationException) { - _errorReporter.WriteLine( - string.Format( + throw new GracefulException( + messages: new[] + { + string.Format( LocalizableStrings.ToolHasMultipleVersionsInstalled, - packageId).Red()); - return 1; + packageId), + }, + isUserError: false); } try @@ -115,27 +121,26 @@ namespace Microsoft.DotNet.Tools.Uninstall.Tool } catch (ToolPackageException ex) { - if (Reporter.IsVerbose) - { - Reporter.Verbose.WriteLine(ex.ToString().Red()); - } - - _errorReporter.WriteLine(ex.Message.Red()); - return 1; + throw new GracefulException( + messages: new[] + { + ex.Message + }, + verboseMessages: new[] { ex.ToString() }, + isUserError: false); } catch (Exception ex) when (ex is ToolConfigurationException || ex is ShellShimException) { - if (Reporter.IsVerbose) - { - Reporter.Verbose.WriteLine(ex.ToString().Red()); - } - - _errorReporter.WriteLine( - string.Format( + throw new GracefulException( + messages: new[] + { + string.Format( LocalizableStrings.FailedToUninstallTool, packageId, - ex.Message).Red()); - return 1; + ex.Message) + }, + verboseMessages: new[] { ex.ToString() }, + isUserError: false); } } } diff --git a/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs b/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs index fd6094c98..902c72d69 100644 --- a/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs @@ -152,14 +152,10 @@ namespace Microsoft.DotNet.Tests.Commands _environmentPathInstructionMock, _reporter); - installToolCommand.Execute().Should().Be(1); + Action a = () => installToolCommand.Execute(); - _reporter - .Lines - .Should() - .Equal( - "Simulated error".Red(), - string.Format(LocalizableStrings.ToolInstallationFailed, PackageId).Red()); + a.ShouldThrow().And.Message + .Should().Contain(string.Format(LocalizableStrings.ToolInstallationFailed, PackageId)); _fileSystem.Directory.Exists(Path.Combine(PathToPlacePackages, PackageId)).Should().BeFalse(); } @@ -177,15 +173,12 @@ namespace Microsoft.DotNet.Tests.Commands _environmentPathInstructionMock, _reporter); - installToolCommand.Execute().Should().Be(1); + Action a = () => installToolCommand.Execute(); - _reporter - .Lines[0] - .Should() - .Contain( - string.Format( - CommonLocalizableStrings.ShellShimConflict, - ProjectRestorerMock.FakeCommandName)); + a.ShouldThrow().And.Message + .Should().Contain(string.Format( + CommonLocalizableStrings.ShellShimConflict, + ProjectRestorerMock.FakeCommandName)); _fileSystem.Directory.Exists(Path.Combine(PathToPlacePackages, PackageId)).Should().BeFalse(); } @@ -205,16 +198,15 @@ namespace Microsoft.DotNet.Tests.Commands _environmentPathInstructionMock, _reporter); - installToolCommand.Execute().Should().Be(1); + Action a = () => installToolCommand.Execute(); - _reporter - .Lines - .Should() - .Equal( + a.ShouldThrow().And.Message + .Should().Contain( string.Format( LocalizableStrings.InvalidToolConfiguration, - "Simulated error").Red(), - string.Format(LocalizableStrings.ToolInstallationFailedContactAuthor, PackageId).Red()); + "Simulated error") + Environment.NewLine + + string.Format(LocalizableStrings.ToolInstallationFailedContactAuthor, PackageId) + ); } [Fact] @@ -330,15 +322,14 @@ namespace Microsoft.DotNet.Tests.Commands new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true), _reporter); - installToolCommand.Execute().Should().Be(1); + Action a = () => installToolCommand.Execute(); - _reporter - .Lines - .Should() - .Equal( - $"Error: failed to restore package {PackageId}.", // From mock implementation, not localized - LocalizableStrings.ToolInstallationRestoreFailed.Red(), - string.Format(LocalizableStrings.ToolInstallationFailed, PackageId).Red()); + a.ShouldThrow().And.Message + .Should().Contain( + LocalizableStrings.ToolInstallationRestoreFailed + + Environment.NewLine + string.Format(LocalizableStrings.ToolInstallationFailed, PackageId)); + + _fileSystem.Directory.Exists(Path.Combine(PathToPlacePackages, PackageId)).Should().BeFalse(); } [Fact] diff --git a/test/dotnet.Tests/CommandTests/UninstallToolCommandTests.cs b/test/dotnet.Tests/CommandTests/UninstallToolCommandTests.cs index 6d62c9729..813a70ec4 100644 --- a/test/dotnet.Tests/CommandTests/UninstallToolCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/UninstallToolCommandTests.cs @@ -49,15 +49,13 @@ namespace Microsoft.DotNet.Tests.Commands var packageId = "does.not.exist"; var command = CreateUninstallCommand($"-g {packageId}"); - command.Execute().Should().Be(1); - _reporter.Lines.Count.Should().Be(1); + Action a = () => command.Execute(); - _reporter - .Lines[0] - .Should() - .Be(string.Format( + a.ShouldThrow().And.Message + .Should().Contain( + string.Format( LocalizableStrings.ToolNotInstalled, - packageId).Red()); + packageId)); } [Fact] @@ -125,20 +123,15 @@ namespace Microsoft.DotNet.Tests.Commands _fileSystem.Directory.Exists(packageDirectory.Value).Should().BeTrue(); _fileSystem.File.Exists(shimPath).Should().BeTrue(); - _reporter.Lines.Clear(); - - CreateUninstallCommand( + Action a = () => CreateUninstallCommand( options: $"-g {PackageId}", uninstallCallback: () => throw new IOException("simulated error")) - .Execute() - .Should() - .Be(1); + .Execute(); - _reporter - .Lines - .Single() - .Should() - .Contain(string.Format( + a.ShouldThrow() + .And.Message + .Should().Contain( + string.Format( CommonLocalizableStrings.FailedToUninstallToolPackage, PackageId, "simulated error")); From 23e8e34bb2f71d48620c8249816991b53ff52b0f Mon Sep 17 00:00:00 2001 From: dotnet-bot Date: Fri, 9 Mar 2018 07:07:20 +0000 Subject: [PATCH 090/103] Update CoreSetup, CoreSetup, CoreSetup, Roslyn to preview2-26309-01, preview2-26309-01, preview2-26309-01, beta2-62708-11, respectively --- build/DependencyVersions.props | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index daae985e6..1a32d44c2 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -2,7 +2,7 @@ 2.1.0-preview2-30248 - 2.1.0-preview2-26308-01 + 2.1.0-preview2-26309-01 $(MicrosoftNETCoreAppPackageVersion) 15.7.0-preview-000066 $(MicrosoftBuildPackageVersion) @@ -10,7 +10,7 @@ $(MicrosoftBuildPackageVersion) $(MicrosoftBuildPackageVersion) 10.1.4-rtm-180213-0 - 2.8.0-beta2-62708-04 + 2.8.0-beta2-62708-11 $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) @@ -28,8 +28,8 @@ $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) - 2.1.0-preview2-26308-01 - 2.1.0-preview2-26308-01 + 2.1.0-preview2-26309-01 + 2.1.0-preview2-26309-01 0.1.1-alpha-174 1.2.1-alpha-002133 $(MicrosoftDotNetProjectJsonMigrationPackageVersion) From ab4aa487e2f60460cbf2435ce815083bfe86eb15 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Fri, 9 Mar 2018 10:05:56 -0800 Subject: [PATCH 091/103] Update to aspnetcore 2.1.0-preview2-30281 --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 1a32d44c2..1300eedf4 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -1,7 +1,7 @@ - 2.1.0-preview2-30248 + 2.1.0-preview2-30281 2.1.0-preview2-26309-01 $(MicrosoftNETCoreAppPackageVersion) 15.7.0-preview-000066 From 6ec1bb93ab54226102f50f67e7244a0358ee90a6 Mon Sep 17 00:00:00 2001 From: dotnet-bot Date: Sun, 11 Mar 2018 18:06:08 +0000 Subject: [PATCH 092/103] Update CoreSetup, CoreSetup, CoreSetup, Roslyn to preview2-26311-02, preview2-26311-02, preview2-26311-02, beta2-62711-03, respectively --- build/DependencyVersions.props | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 1300eedf4..a5517177f 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -2,7 +2,7 @@ 2.1.0-preview2-30281 - 2.1.0-preview2-26309-01 + 2.1.0-preview2-26311-02 $(MicrosoftNETCoreAppPackageVersion) 15.7.0-preview-000066 $(MicrosoftBuildPackageVersion) @@ -10,7 +10,7 @@ $(MicrosoftBuildPackageVersion) $(MicrosoftBuildPackageVersion) 10.1.4-rtm-180213-0 - 2.8.0-beta2-62708-11 + 2.8.0-beta2-62711-03 $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) @@ -28,8 +28,8 @@ $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) - 2.1.0-preview2-26309-01 - 2.1.0-preview2-26309-01 + 2.1.0-preview2-26311-02 + 2.1.0-preview2-26311-02 0.1.1-alpha-174 1.2.1-alpha-002133 $(MicrosoftDotNetProjectJsonMigrationPackageVersion) From b0e57e171202ff20919a7f067f80678a66e1fa46 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Mon, 12 Mar 2018 13:16:45 -0700 Subject: [PATCH 093/103] Re-activate templating test. --- test/dotnet-new.Tests/GivenThatIWantANewApp.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/dotnet-new.Tests/GivenThatIWantANewApp.cs b/test/dotnet-new.Tests/GivenThatIWantANewApp.cs index b195d55bb..bb2c148f5 100644 --- a/test/dotnet-new.Tests/GivenThatIWantANewApp.cs +++ b/test/dotnet-new.Tests/GivenThatIWantANewApp.cs @@ -77,7 +77,7 @@ namespace Microsoft.DotNet.New.Tests [Theory] [InlineData("console", "microsoft.netcore.app")] // re-enable when this bug is resolved: https://github.com/dotnet/cli/issues/7574 - //[InlineData("classlib", "netstandard.library")] + [InlineData("classlib", "netstandard.library")] public void NewProjectRestoresCorrectPackageVersion(string type, string packageName) { var rootPath = TestAssets.CreateTestDirectory(identifier: $"_{type}").FullName; From a6db27bdd7c586da448edbf7c3baf08ef3ddb2c3 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Mon, 12 Mar 2018 15:06:25 -0700 Subject: [PATCH 094/103] Re-activating the net461 tests for the Resolver in the hopes that the failures fixed themselves. --- .../Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj b/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj index 4ef6f641c..3a0fbb977 100644 --- a/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj +++ b/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj @@ -1,7 +1,8 @@  - $(CliTargetFramework) + net461;$(CliTargetFramework) + $(CliTargetFramework) $(MicrosoftNETCoreAppPackageVersion) Exe ../../tools/Key.snk From 70f2b13256ed1693dfc63a644dcc0162d1b1269f Mon Sep 17 00:00:00 2001 From: dotnet-bot Date: Tue, 13 Mar 2018 05:39:24 +0000 Subject: [PATCH 095/103] Update CoreSetup, CoreSetup, CoreSetup, Roslyn to preview2-26313-01, preview2-26313-01, preview2-26313-01, beta2-62713-01, respectively --- build/DependencyVersions.props | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index a5517177f..7a13c76bb 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -2,7 +2,7 @@ 2.1.0-preview2-30281 - 2.1.0-preview2-26311-02 + 2.1.0-preview2-26313-01 $(MicrosoftNETCoreAppPackageVersion) 15.7.0-preview-000066 $(MicrosoftBuildPackageVersion) @@ -10,7 +10,7 @@ $(MicrosoftBuildPackageVersion) $(MicrosoftBuildPackageVersion) 10.1.4-rtm-180213-0 - 2.8.0-beta2-62711-03 + 2.8.0-beta2-62713-01 $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) @@ -28,8 +28,8 @@ $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) - 2.1.0-preview2-26311-02 - 2.1.0-preview2-26311-02 + 2.1.0-preview2-26313-01 + 2.1.0-preview2-26313-01 0.1.1-alpha-174 1.2.1-alpha-002133 $(MicrosoftDotNetProjectJsonMigrationPackageVersion) From 782354acf95783d1fc86bd46a42989f0ca9c4985 Mon Sep 17 00:00:00 2001 From: Livar Date: Tue, 13 Mar 2018 10:19:44 -0700 Subject: [PATCH 096/103] Removing left over comment. --- .../Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj b/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj index 3a0fbb977..c4b59fb35 100644 --- a/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj +++ b/test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj @@ -1,6 +1,5 @@  - net461;$(CliTargetFramework) $(CliTargetFramework) $(MicrosoftNETCoreAppPackageVersion) From c257087ca69149f3d5bdbc45f8197897175ef6a3 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 14 Mar 2018 16:47:53 -0700 Subject: [PATCH 097/103] Upgrade to aspnetcore 2.1.0-preview2-30331 and pull aspnetcore for Alpine Linux --- build/BundledRuntimes.props | 1 - build/DependencyVersions.props | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/build/BundledRuntimes.props b/build/BundledRuntimes.props index 9738b731e..6dd03ff83 100644 --- a/build/BundledRuntimes.props +++ b/build/BundledRuntimes.props @@ -29,7 +29,6 @@ dotnet-runtime-$(MicrosoftNETCoreAppPackageVersion)-$(SharedFrameworkRid)$(ArchiveExtension) $(SharedFrameworkRid) - linux-x64 linux-x64 $(AspNetCoreSharedFxInstallerRid) x64 diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 7a13c76bb..1f6eb3c2b 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -1,7 +1,7 @@ - 2.1.0-preview2-30281 + 2.1.0-preview2-30331 2.1.0-preview2-26313-01 $(MicrosoftNETCoreAppPackageVersion) 15.7.0-preview-000066 From a54f0ffb81ba42108f02adc260650625d55060ac Mon Sep 17 00:00:00 2001 From: John Beisner Date: Wed, 14 Mar 2018 19:04:25 -0700 Subject: [PATCH 098/103] Enable 'arm' builds in the CLI (#8791) * First draft enablement of Win-arm and Linux-arm builds for the CLI. * Fixing a typo * Disable tests for arm; enable badges and FinalizeBuild for arm. * Remove the 'Win-arm' leg. * Update the README * Update the README [2] * Update netci.groovy * Fixing a hard-coded Architecture: 'linux-x64'; removing the LZMA for 'arm'. --- README.md | 13 ++++++++++--- build/BackwardsCompatibilityRuntimes.props | 8 ++++---- build/BuildDefaults.props | 1 + build/BuildInfo.targets | 8 +++----- build/BundledRuntimes.props | 16 ++++++++-------- build/Package.targets | 19 ++++++++++++++----- build/Publish.targets | 2 +- build/Test.targets | 2 +- build/publish/Badge.targets | 2 +- build/publish/RuntimeCoherence.targets | 1 + .../CheckIfAllBuildsHavePublished.cs | 3 ++- netci.groovy | 9 +++++++-- run-build.ps1 | 13 ++++++++++--- run-build.sh | 13 ++++++++++--- src/redist/redist.csproj | 2 +- 15 files changed, 74 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index b13340fd9..c8601e119 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,9 @@ This project has adopted the code of conduct defined by the [Contributor Covenan Build Status ------------ -|Windows x64|Windows x86|macOS|Linux x64 Archive|Linux Native Installers|RHEL 6 Archive|Alpine 3.6 Archive| -|:------:|:------:|:------:|:------:|:------:|:------:|:------:| -|[![][win-x64-build-badge]][win-x64-build]|[![][win-x86-build-badge]][win-x86-build]|[![][osx-build-badge]][osx-build]|[![][linux-build-badge]][linux-build]|[![][linuxnative-build-badge]][linuxnative-build]|[![][rhel6-build-badge]][rhel6-build]|[![][alpine3.6-build-badge]][alpine3.6-build]| +|Windows x64|Windows x86|macOS|Linux x64 Archive|Linux arm Archive|Linux Native Installers|RHEL 6 Archive|Alpine 3.6 Archive| +|:------:|:------:|:------:|:------:|:------:|:------:|:------:|:------:| +|[![][win-x64-build-badge]][win-x64-build]|[![][win-x86-build-badge]][win-x86-build]|[![][osx-build-badge]][osx-build]|[![][linux-build-badge]][linux-build]|[![][linux-arm-build-badge]][linux-arm-build]|[![][linuxnative-build-badge]][linuxnative-build]|[![][rhel6-build-badge]][rhel6-build]|[![][alpine3.6-build-badge]][alpine3.6-build]| [win-x64-build-badge]: https://devdiv.visualstudio.com/_apis/public/build/definitions/0bdbc590-a062-4c3f-b0f6-9383f67865ee/6902/badge [win-x64-build]: https://devdiv.visualstudio.com/DevDiv/_build?_a=completed&definitionId=6902 @@ -39,6 +39,9 @@ Build Status [linux-build-badge]: https://devdiv.visualstudio.com/_apis/public/build/definitions/0bdbc590-a062-4c3f-b0f6-9383f67865ee/6899/badge [linux-build]: https://devdiv.visualstudio.com/DevDiv/_build?_a=completed&definitionId=6899 +[linux-arm-build-badge]: https://devdiv.visualstudio.com/_apis/public/build/definitions/0bdbc590-a062-4c3f-b0f6-9383f67865ee/8721/badge +[linux-arm-build]: https://devdiv.visualstudio.com/DevDiv/_build?_a=completed&definitionId=8721 + [linuxnative-build-badge]: https://devdiv.visualstudio.com/_apis/public/build/definitions/0bdbc590-a062-4c3f-b0f6-9383f67865ee/7254/badge [linuxnative-build]: https://devdiv.visualstudio.com/DevDiv/_build?_a=completed&definitionId=7254 @@ -65,6 +68,7 @@ To download the .NET Core runtime **without** the SDK, visit https://github.com/ | **Windows x86** | [Installer][win-x86-installer] - [Checksum][win-x86-installer-checksum]
[zip][win-x86-zip] - [Checksum][win-x86-zip-checksum] | | **macOS** | [Installer][osx-installer] - [Checksum][osx-installer-checksum]
[tar.gz][osx-targz] - [Checksum][osx-targz-checksum] | | **Linux x64** | [DEB Installer][linux-DEB-installer] - [Checksum][linux-DEB-installer-checksum]
[RPM Installer][linux-RPM-installer] - [Checksum][linux-RPM-installer-checksum]
_see installer note below_1
[tar.gz][linux-targz] - [Checksum][linux-targz-checksum] | +| **Linux arm** | [tar.gz][linux-arm-targz] - [Checksum][linux-arm-targz-checksum] | | **RHEL 6** | [tar.gz][rhel-6-targz] - [Checksum][rhel-6-targz-checksum] | | **Alpine 3.6** | [tar.gz][alpine-3.6-targz] - [Checksum][alpine-3.6-targz-checksum] | @@ -100,6 +104,9 @@ Reference notes: [linux-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-linux-x64.tar.gz [linux-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-linux-x64.tar.gz.sha +[linux-arm-targz]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-linux-arm.tar.gz +[linux-arm-targz-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-linux-arm.tar.gz.sha + [linux-DEB-installer]: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-x64.deb [linux-DEB-installer-checksum]: https://dotnetclichecksums.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-x64.deb.sha diff --git a/build/BackwardsCompatibilityRuntimes.props b/build/BackwardsCompatibilityRuntimes.props index 789b0a2cd..6f612ac1f 100644 --- a/build/BackwardsCompatibilityRuntimes.props +++ b/build/BackwardsCompatibilityRuntimes.props @@ -25,7 +25,7 @@ <_DownloadAndExtractItem Include="BackwardsCompatibility110CombinedSharedHostAndFrameworkArchive" - Condition="!Exists('$(BackwardsCompatibility110CombinedSharedHostAndFrameworkArchive)')"> + Condition="!Exists('$(BackwardsCompatibility110CombinedSharedHostAndFrameworkArchive)') And !$(Architecture.StartsWith('arm'))"> $(BackwardsCompatibility110SharedFrameworkArchiveBlobRootUrl)/$(BackwardsCompatibility110CombinedFrameworkHostCompressedFileName)$(CoreSetupBlobAccessTokenParam) $(BackwardsCompatibility110CombinedSharedHostAndFrameworkArchive) $(BackwardsCompatibleSharedFrameworksPublishDirectory) @@ -34,21 +34,21 @@ <_DownloadAndExtractItem Include="BackwardsCompatibility110DownloadedSharedFrameworkInstallerFile" - Condition="!Exists('$(BackwardsCompatibility110DownloadedSharedFrameworkInstallerFile)') And '$(OSName)' != 'linux'"> + Condition="!Exists('$(BackwardsCompatibility110DownloadedSharedFrameworkInstallerFile)') And '$(OSName)' != 'linux' And !$(Architecture.StartsWith('arm'))"> $(BackwardsCompatibility110CoreSetupInstallerBlobRootUrl)/$(BackwardsCompatibility110SharedFrameworkVersion)/$(BackwardsCompatibility110DownloadedSharedFrameworkInstallerFileName)$(CoreSetupBlobAccessTokenParam) $(BackwardsCompatibility110DownloadedSharedFrameworkInstallerFile) <_DownloadAndExtractItem Include="BackwardsCompatibility110DownloadedSharedHostInstallerFile" - Condition="!Exists('$(BackwardsCompatibility110DownloadedSharedHostInstallerFile)') And '$(OSName)' != 'linux'"> + Condition="!Exists('$(BackwardsCompatibility110DownloadedSharedHostInstallerFile)') And '$(OSName)' != 'linux' And !$(Architecture.StartsWith('arm'))"> $(BackwardsCompatibility110CoreSetupInstallerBlobRootUrl)/$(BackwardsCompatibility110SharedHostVersion)/$(BackwardsCompatibility110DownloadedSharedHostInstallerFileName)$(CoreSetupBlobAccessTokenParam) $(BackwardsCompatibility110DownloadedSharedHostInstallerFile) <_DownloadAndExtractItem Include="BackwardsCompatibility110DownloadedHostFxrInstallerFile" - Condition="!Exists('$(BackwardsCompatibility110DownloadedHostFxrInstallerFile)') And '$(OSName)' != 'linux'"> + Condition="!Exists('$(BackwardsCompatibility110DownloadedHostFxrInstallerFile)') And '$(OSName)' != 'linux' And !$(Architecture.StartsWith('arm'))"> $(BackwardsCompatibility110CoreSetupInstallerBlobRootUrl)/$(BackwardsCompatibility110HostFxrVersion)/$(BackwardsCompatibility110DownloadedHostFxrInstallerFileName)$(CoreSetupBlobAccessTokenParam) $(BackwardsCompatibility110DownloadedHostFxrInstallerFile) diff --git a/build/BuildDefaults.props b/build/BuildDefaults.props index 6f3109c4f..87b1a3a5d 100644 --- a/build/BuildDefaults.props +++ b/build/BuildDefaults.props @@ -2,6 +2,7 @@ Prepare;Compile;Test;Package;Publish Debug + false true true false diff --git a/build/BuildInfo.targets b/build/BuildInfo.targets index 6abd51fa9..039dc3bc1 100644 --- a/build/BuildInfo.targets +++ b/build/BuildInfo.targets @@ -10,16 +10,14 @@ True - $(HostRid) - x64 $(HostOSName) $(HostOSPlatform) - - linux-x64 - x64 linux linux + x64 + $(OSName)-$(Architecture) + <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> diff --git a/build/BundledRuntimes.props b/build/BundledRuntimes.props index 9738b731e..b875d9776 100644 --- a/build/BundledRuntimes.props +++ b/build/BundledRuntimes.props @@ -25,7 +25,7 @@ $(CoreSetupRid) - linux-x64 + linux-$(Architecture) dotnet-runtime-$(MicrosoftNETCoreAppPackageVersion)-$(SharedFrameworkRid)$(ArchiveExtension) $(SharedFrameworkRid) @@ -56,7 +56,7 @@ <_DownloadAndExtractItem Include="AspNetCoreSharedFxArchiveFile" - Condition="!Exists('$(AspNetCoreSharedFxArchiveFile)')"> + Condition="!Exists('$(AspNetCoreSharedFxArchiveFile)') And !$(Architecture.StartsWith('arm'))"> $(AspNetCoreSharedFxRootUrl)$(AspNetCoreVersion)/$(AspNetCoreSharedFxArchiveFileName)$(CoreSetupBlobAccessTokenParam) $(AspNetCoreSharedFxArchiveFile) $(AspNetCoreSharedFxPublishDirectory) @@ -70,42 +70,42 @@ <_DownloadAndExtractItem Include="DownloadedRuntimeDepsInstallerFile" - Condition="('$(IsDebianBaseDistro)' == 'true' OR '$(IsRPMBasedDistro)' == 'true') And '$(SkipBuildingInstallers)' != 'true' And !Exists('$(DownloadedRuntimeDepsInstallerFile)') And '$(InstallerExtension)' != ''"> + Condition="('$(IsDebianBaseDistro)' == 'true' OR '$(IsRPMBasedDistro)' == 'true') And '$(SkipBuildingInstallers)' != 'true' And !Exists('$(DownloadedRuntimeDepsInstallerFile)') And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))"> $(CoreSetupRootUrl)$(MicrosoftNETCoreAppPackageVersion)/$(DownloadedRuntimeDepsInstallerFileName)$(CoreSetupBlobAccessTokenParam) $(DownloadedRuntimeDepsInstallerFile) <_DownloadAndExtractItem Include="DownloadedSharedFrameworkInstallerFile" - Condition="'$(SkipBuildingInstallers)' != 'true' And !Exists('$(DownloadedSharedFrameworkInstallerFile)') And '$(InstallerExtension)' != ''"> + Condition="'$(SkipBuildingInstallers)' != 'true' And !Exists('$(DownloadedSharedFrameworkInstallerFile)') And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))"> $(CoreSetupRootUrl)$(MicrosoftNETCoreAppPackageVersion)/$(DownloadedSharedFrameworkInstallerFileName)$(CoreSetupBlobAccessTokenParam) $(DownloadedSharedFrameworkInstallerFile) <_DownloadAndExtractItem Include="DownloadedSharedHostInstallerFile" - Condition="'$(SkipBuildingInstallers)' != 'true' And !Exists('$(DownloadedSharedHostInstallerFile)') And '$(InstallerExtension)' != ''"> + Condition="'$(SkipBuildingInstallers)' != 'true' And !Exists('$(DownloadedSharedHostInstallerFile)') And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))"> $(CoreSetupRootUrl)$(SharedHostVersion)/$(DownloadedSharedHostInstallerFileName)$(CoreSetupBlobAccessTokenParam) $(DownloadedSharedHostInstallerFile) <_DownloadAndExtractItem Include="DownloadedHostFxrInstallerFile" - Condition="'$(SkipBuildingInstallers)' != 'true' And !Exists('$(DownloadedHostFxrInstallerFile)') And '$(InstallerExtension)' != ''"> + Condition="'$(SkipBuildingInstallers)' != 'true' And !Exists('$(DownloadedHostFxrInstallerFile)') And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))"> $(CoreSetupRootUrl)$(HostFxrVersion)/$(DownloadedHostFxrInstallerFileName)$(CoreSetupBlobAccessTokenParam) $(DownloadedHostFxrInstallerFile) <_DownloadAndExtractItem Include="DownloadedAspNetCoreSharedFxInstallerFile" - Condition="'$(SkipBuildingInstallers)' != 'true' AND '$(DownloadedAspNetCoreSharedFxInstallerFile)' != '' AND !Exists($(DownloadedAspNetCoreSharedFxInstallerFile)) And '$(InstallerExtension)' != ''"> + Condition="'$(SkipBuildingInstallers)' != 'true' AND '$(DownloadedAspNetCoreSharedFxInstallerFile)' != '' AND !Exists($(DownloadedAspNetCoreSharedFxInstallerFile)) And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))"> $(AspNetCoreSharedFxRootUrl)$(AspNetCoreVersion)/$(DownloadedAspNetCoreSharedFxInstallerFileName)$(CoreSetupBlobAccessTokenParam) $(DownloadedAspNetCoreSharedFxInstallerFile) <_DownloadAndExtractItem Include="AspNetCoreSharedFxBaseRuntimeVersionFile" - Condition="!Exists('$(AspNetCoreSharedFxBaseRuntimeVersionFile)')"> + Condition="!Exists('$(AspNetCoreSharedFxBaseRuntimeVersionFile)') And !$(Architecture.StartsWith('arm'))"> $(AspNetCoreSharedFxRootUrl)$(AspNetCoreVersion)/$(AspNetCoreSharedFxBaseRuntimeVersionFileName)$(CoreSetupBlobAccessTokenParam) $(AspNetCoreSharedFxBaseRuntimeVersionFile) diff --git a/build/Package.targets b/build/Package.targets index eef514f56..be69f3ada 100644 --- a/build/Package.targets +++ b/build/Package.targets @@ -10,8 +10,13 @@ + Condition=" '$(SkipBuildingInstallers)' != 'true' And !$(Architecture.StartsWith('arm')) " + DependsOnTargets="Prepare; + Layout; + GeneratePkgs; + GenerateDebs; + GenerateMsis; + GenerateRpms" /> + GenerateInstallers" /> + DependsOnTargets="SandBoxPrepare; + Layout; + GenerateDebs; + GenerateRpms; + CopySandBoxPackageOut" /> -
\ No newline at end of file +
diff --git a/build/Publish.targets b/build/Publish.targets index d64388410..ebdddf1fc 100644 --- a/build/Publish.targets +++ b/build/Publish.targets @@ -66,7 +66,7 @@ + Condition=" '$(Coherent)' == 'true' And !$(Architecture.StartsWith('arm')) " /> diff --git a/build/Test.targets b/build/Test.targets index 388a2e1fe..52b74f97a 100644 --- a/build/Test.targets +++ b/build/Test.targets @@ -13,7 +13,7 @@
diff --git a/build/publish/Badge.targets b/build/publish/Badge.targets index 1e110eb65..343244687 100644 --- a/build/publish/Badge.targets +++ b/build/publish/Badge.targets @@ -17,7 +17,7 @@ + Condition=" '$(Coherent)' == 'true' And !$(Architecture.StartsWith('arm')) "> diff --git a/build_projects/dotnet-cli-build/CheckIfAllBuildsHavePublished.cs b/build_projects/dotnet-cli-build/CheckIfAllBuildsHavePublished.cs index 8b0df65ed..f6045cbd1 100644 --- a/build_projects/dotnet-cli-build/CheckIfAllBuildsHavePublished.cs +++ b/build_projects/dotnet-cli-build/CheckIfAllBuildsHavePublished.cs @@ -55,7 +55,8 @@ namespace Microsoft.DotNet.Cli.Build { "linux_x64", false }, { "rhel.6_x64", false }, { "alpine.3.6_x64", false }, - { "all_linux_distros_native_installer", false} + { "all_linux_distros_native_installer", false}, + { "linux_arm", false} }; if (!badges.ContainsKey(VersionBadgeMoniker)) diff --git a/netci.groovy b/netci.groovy index d8cec3967..74da785c4 100644 --- a/netci.groovy +++ b/netci.groovy @@ -9,7 +9,7 @@ def project = GithubProject def branch = GithubBranchName def isPR = true -def platformList = ['Linux:x64:Release', 'Debian8.2:x64:Debug', 'Ubuntu:x64:Release', 'Ubuntu16.04:x64:Debug', 'OSX10.12:x64:Release', 'Windows_NT:x64:Release', 'Windows_NT:x86:Debug', 'Windows_NT_ES:x64:Debug', 'RHEL7.2:x64:Release', 'CentOS7.1:x64:Debug', 'RHEL6:x64:Debug', 'Alpine3.6:x64:Debug'] +def platformList = ['Linux:x64:Release', 'Debian8.2:x64:Debug', 'Ubuntu:x64:Release', 'Ubuntu16.04:x64:Debug', 'OSX10.12:x64:Release', 'Windows_NT:x64:Release', 'Windows_NT:x86:Debug', 'Windows_NT_ES:x64:Debug', 'RHEL7.2:x64:Release', 'CentOS7.1:x64:Debug', 'RHEL6:x64:Debug', 'Alpine3.6:x64:Debug', 'Linux:arm:Debug'] def static getBuildJobName(def configuration, def os, def architecture) { return configuration.toLowerCase() + '_' + os.toLowerCase() + '_' + architecture.toLowerCase() @@ -44,7 +44,12 @@ set DOTNET_CLI_UI_LANGUAGE=es } else if (os == 'Linux') { osUsedForMachineAffinity = 'Ubuntu16.04'; - buildCommand = "./build.sh --linux-portable --skip-prereqs --configuration ${configuration} --targets Default" + if (architecture == 'arm') { + buildCommand = "./build.sh --linux-portable --skip-prereqs --architecture ${architecture} --configuration ${configuration} --targets Default /p:CLIBUILD_SKIP_TESTS=true" + } + else { + buildCommand = "./build.sh --linux-portable --skip-prereqs --configuration ${configuration} --targets Default" + } } else if (os == 'RHEL6') { osUsedForMachineAffinity = 'Ubuntu16.04'; diff --git a/run-build.ps1 b/run-build.ps1 index c92b91b6d..5698721dc 100644 --- a/run-build.ps1 +++ b/run-build.ps1 @@ -20,7 +20,7 @@ if($Help) Write-Output "" Write-Output "Options:" Write-Output " -Configuration Build the specified Configuration (Debug or Release, default: Debug)" - Write-Output " -Architecture Build the specified architecture (x64 or x86 (supported only on Windows), default: x64)" + Write-Output " -Architecture Build the specified architecture (x64, x86, or arm , default: x64)" Write-Output " -NoPackage Skip packaging targets" Write-Output " -NoBuild Skip building the product" Write-Output " -Help Display this help message" @@ -82,8 +82,15 @@ $env:VSTEST_TRACE_BUILD=1 # install a stage0 $dotnetInstallPath = Join-Path $RepoRoot "scripts\obtain\dotnet-install.ps1" -Write-Output "$dotnetInstallPath -version ""2.2.0-preview1-007799"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" -Invoke-Expression "$dotnetInstallPath -version ""2.2.0-preview1-007799"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" +$InstallArchitecture = $Architecture +if($Architecture.StartsWith("arm", [StringComparison]::OrdinalIgnoreCase)) +{ + $InstallArchitecture = "x64" +} + +Write-Output "$dotnetInstallPath -version ""2.2.0-preview1-007799"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$InstallArchitecture""" +Invoke-Expression "$dotnetInstallPath -version ""2.2.0-preview1-007799"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$InstallArchitecture""" + if ($LastExitCode -ne 0) { Write-Output "The .NET CLI installation failed with exit code $LastExitCode" diff --git a/run-build.sh b/run-build.sh index 7d383f86f..9ebba823b 100755 --- a/run-build.sh +++ b/run-build.sh @@ -96,7 +96,7 @@ while [[ $# > 0 ]]; do ;; --linux-portable) LINUX_PORTABLE_INSTALL_ARGS="--runtime-id linux-x64" - CUSTOM_BUILD_ARGS="/p:Rid=\"linux-x64\" /p:OSName=\"linux\" /p:IslinuxPortable=\"true\"" + CUSTOM_BUILD_ARGS="/p:OSName=\"linux\" /p:IslinuxPortable=\"true\"" ;; --stage0) STAGE0_SOURCE_DIR=$2 @@ -107,7 +107,7 @@ while [[ $# > 0 ]]; do echo "" echo "Options:" echo " --configuration Build the specified Configuration (Debug or Release, default: Debug)" - echo " --architecture Build the specified architecture (x64 or x86 (supported only on Windows), default: x64)" + echo " --architecture Build the specified architecture (x64 or arm , default: x64)" echo " --skip-prereqs Skip checks for pre-reqs in dotnet_install" echo " --nopackage Skip packaging targets" echo " --nobuild Skip building, showing the command that would be used to build" @@ -140,6 +140,7 @@ done [ -z "$DOTNET_INSTALL_DIR" ] && export DOTNET_INSTALL_DIR=$REPOROOT/.dotnet_stage0/$ARCHITECTURE [ -d "$DOTNET_INSTALL_DIR" ] || mkdir -p $DOTNET_INSTALL_DIR +# Disable first run since we want to control all package sources export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 # Enable verbose VS Test Console logging @@ -151,8 +152,14 @@ export VSTEST_TRACE_BUILD=1 export DOTNET_MULTILEVEL_LOOKUP=0 # Install a stage 0 +INSTALL_ARCHITECTURE=$ARCHITECTURE +archlower="$(echo $ARCHITECTURE | awk '{print tolower($0)}')" +if [[ $archlower == 'arm'* ]]; then + INSTALL_ARCHITECTURE="x64" +fi + if [ "$STAGE0_SOURCE_DIR" == "" ]; then - (set -x ; "$REPOROOT/scripts/obtain/dotnet-install.sh" --version "2.2.0-preview1-007799" --install-dir "$DOTNET_INSTALL_DIR" --architecture "$ARCHITECTURE" $LINUX_PORTABLE_INSTALL_ARGS) + (set -x ; "$REPOROOT/scripts/obtain/dotnet-install.sh" --version "2.2.0-preview1-007799" --install-dir "$DOTNET_INSTALL_DIR" --architecture "$INSTALL_ARCHITECTURE" $LINUX_PORTABLE_INSTALL_ARGS) else echo "Copying bootstrap cli from $STAGE0_SOURCE_DIR" cp -r $STAGE0_SOURCE_DIR/* "$DOTNET_INSTALL_DIR" diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index b86cde0d6..e0da5bd6a 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -218,7 +218,7 @@ From 123df7f3869d429a05432f0c9da9cb4c01565d73 Mon Sep 17 00:00:00 2001 From: John Beisner Date: Thu, 15 Mar 2018 12:30:11 -0700 Subject: [PATCH 099/103] Follow-up PR for Linux-arm; CLI:master (#8797) * Fix the badge for Linux-arm. * Add comment for the LZMA; turn off displaying of test results for arm* --- build/BuildDefaults.props | 2 ++ build/publish/Badge.targets | 2 +- netci.groovy | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build/BuildDefaults.props b/build/BuildDefaults.props index 87b1a3a5d..1c4460790 100644 --- a/build/BuildDefaults.props +++ b/build/BuildDefaults.props @@ -2,6 +2,8 @@ Prepare;Compile;Test;Package;Publish Debug + + false true true diff --git a/build/publish/Badge.targets b/build/publish/Badge.targets index 343244687..ec3a0905d 100644 --- a/build/publish/Badge.targets +++ b/build/publish/Badge.targets @@ -32,7 +32,7 @@ $(OSName)_$(Architecture) rhel.6_x64 alpine.3.6_x64 - linux_x64 + linux_$(Architecture) all_linux_distros_native_installer $(BaseOutputDirectory)/$(VersionBadgeMoniker)_$(Configuration)_version_badge.svg diff --git a/netci.groovy b/netci.groovy index 74da785c4..89de34fee 100644 --- a/netci.groovy +++ b/netci.groovy @@ -80,7 +80,10 @@ set DOTNET_CLI_UI_LANGUAGE=es Utilities.setMachineAffinity(newJob, osUsedForMachineAffinity, 'latest-or-auto') Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}") - Utilities.addMSTestResults(newJob, '**/*.trx') + // ARM CI runs are build only. + if (architecture != 'arm') { + Utilities.addMSTestResults(newJob, '**/*.trx') + } Utilities.addGithubPRTriggerForBranch(newJob, branch, "${os} ${architecture} ${configuration} Build") } From d5894edefa02dccbacabe8be2571c3d84e404ef2 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 15 Mar 2018 16:20:14 -0700 Subject: [PATCH 100/103] Update AspNetCore package versions to 2.1.0-preview2-30338 --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 29edc7707..f6977fb45 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -1,7 +1,7 @@ - 2.1.0-preview2-30331 + 2.1.0-preview2-30338 2.1.0-preview2-26313-01 $(MicrosoftNETCoreAppPackageVersion) 15.7.0-preview-000066 From 3d13658f97cc8079ab1dffecd1af8c721bea269b Mon Sep 17 00:00:00 2001 From: William Lee Date: Thu, 15 Mar 2018 18:36:48 -0700 Subject: [PATCH 101/103] Update SDK to2.1.300-preview2-62715-07 (#8808) --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 29edc7707..61ce5fffd 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -14,7 +14,7 @@ $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) - 2.1.300-preview2-62628-06 + 2.1.300-preview2-62715-07 $(MicrosoftNETSdkPackageVersion) $(MicrosoftAspNetCoreAppPackageVersion) 2.1.300-preview2-20180306-1448279 From fb093499f0ce80c7986ca495cb52a9d980fd2eaf Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Thu, 15 Mar 2018 18:37:39 -0700 Subject: [PATCH 102/103] Update dotnet/sdk to latest Includes fast ResolvePackageAssets --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 61ce5fffd..666c7e3ba 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -14,7 +14,7 @@ $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) - 2.1.300-preview2-62715-07 + 2.1.300-preview2-62716-01 $(MicrosoftNETSdkPackageVersion) $(MicrosoftAspNetCoreAppPackageVersion) 2.1.300-preview2-20180306-1448279 From 3f09a889d93a45269dfa31f4d468818c7e01c926 Mon Sep 17 00:00:00 2001 From: William Lee Date: Thu, 15 Mar 2018 19:45:11 -0700 Subject: [PATCH 103/103] Update tool (#8794) --- src/dotnet/BuiltInCommandsCatalog.cs | 5 + src/dotnet/Parser.cs | 1 + .../commands/dotnet-help/HelpUsageText.cs | 1 + .../dotnet-help/LocalizableStrings.resx | 3 + .../dotnet-help/xlf/LocalizableStrings.cs.xlf | 5 + .../dotnet-help/xlf/LocalizableStrings.de.xlf | 5 + .../dotnet-help/xlf/LocalizableStrings.es.xlf | 5 + .../dotnet-help/xlf/LocalizableStrings.fr.xlf | 5 + .../dotnet-help/xlf/LocalizableStrings.it.xlf | 5 + .../dotnet-help/xlf/LocalizableStrings.ja.xlf | 5 + .../dotnet-help/xlf/LocalizableStrings.ko.xlf | 5 + .../dotnet-help/xlf/LocalizableStrings.pl.xlf | 5 + .../xlf/LocalizableStrings.pt-BR.xlf | 5 + .../dotnet-help/xlf/LocalizableStrings.ru.xlf | 5 + .../dotnet-help/xlf/LocalizableStrings.tr.xlf | 5 + .../xlf/LocalizableStrings.zh-Hans.xlf | 5 + .../xlf/LocalizableStrings.zh-Hant.xlf | 5 + .../dotnet-install/LocalizableStrings.resx | 2 +- .../dotnet-install-tool/InstallToolCommand.cs | 35 +-- ...nstallToolCommandLowLevelErrorConverter.cs | 56 ++++ .../tool/UninstallToolCommand.cs | 23 +- ...nstallToolCommandLowLevelErrorConverter.cs | 44 ++++ .../dotnet-update/LocalizableStrings.resx | 129 +++++++++ .../commands/dotnet-update/UpdateCommand.cs | 30 +++ .../dotnet-update/UpdateCommandParser.cs | 20 ++ .../tool/LocalizableStrings.resx | 180 +++++++++++++ .../dotnet-update/tool/UpdateToolCommand.cs | 246 ++++++++++++++++++ .../tool/UpdateToolCommandParser.cs | 43 +++ .../tool/xlf/LocalizableStrings.cs.xlf | 107 ++++++++ .../tool/xlf/LocalizableStrings.de.xlf | 107 ++++++++ .../tool/xlf/LocalizableStrings.es.xlf | 107 ++++++++ .../tool/xlf/LocalizableStrings.fr.xlf | 107 ++++++++ .../tool/xlf/LocalizableStrings.it.xlf | 107 ++++++++ .../tool/xlf/LocalizableStrings.ja.xlf | 107 ++++++++ .../tool/xlf/LocalizableStrings.ko.xlf | 107 ++++++++ .../tool/xlf/LocalizableStrings.pl.xlf | 107 ++++++++ .../tool/xlf/LocalizableStrings.pt-BR.xlf | 107 ++++++++ .../tool/xlf/LocalizableStrings.ru.xlf | 107 ++++++++ .../tool/xlf/LocalizableStrings.tr.xlf | 107 ++++++++ .../tool/xlf/LocalizableStrings.zh-Hans.xlf | 107 ++++++++ .../tool/xlf/LocalizableStrings.zh-Hant.xlf | 107 ++++++++ .../xlf/LocalizableStrings.cs.xlf | 22 ++ .../xlf/LocalizableStrings.de.xlf | 22 ++ .../xlf/LocalizableStrings.es.xlf | 22 ++ .../xlf/LocalizableStrings.fr.xlf | 22 ++ .../xlf/LocalizableStrings.it.xlf | 22 ++ .../xlf/LocalizableStrings.ja.xlf | 22 ++ .../xlf/LocalizableStrings.ko.xlf | 22 ++ .../xlf/LocalizableStrings.pl.xlf | 22 ++ .../xlf/LocalizableStrings.pt-BR.xlf | 22 ++ .../xlf/LocalizableStrings.ru.xlf | 22 ++ .../xlf/LocalizableStrings.tr.xlf | 22 ++ .../xlf/LocalizableStrings.zh-Hans.xlf | 22 ++ .../xlf/LocalizableStrings.zh-Hant.xlf | 22 ++ src/dotnet/dotnet.csproj | 2 + .../ProjectRestorerMock.cs | 9 +- ...ivenThatIWantToShowHelpForDotnetCommand.cs | 1 + .../CommandTests/InstallToolCommandTests.cs | 4 +- .../CommandTests/UpdateToolCommandTests.cs | 243 +++++++++++++++++ .../ParserTests/UpdateToolParserTests.cs | 93 +++++++ 60 files changed, 2855 insertions(+), 57 deletions(-) create mode 100644 src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommandLowLevelErrorConverter.cs create mode 100644 src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommandLowLevelErrorConverter.cs create mode 100644 src/dotnet/commands/dotnet-update/LocalizableStrings.resx create mode 100644 src/dotnet/commands/dotnet-update/UpdateCommand.cs create mode 100644 src/dotnet/commands/dotnet-update/UpdateCommandParser.cs create mode 100644 src/dotnet/commands/dotnet-update/tool/LocalizableStrings.resx create mode 100644 src/dotnet/commands/dotnet-update/tool/UpdateToolCommand.cs create mode 100644 src/dotnet/commands/dotnet-update/tool/UpdateToolCommandParser.cs create mode 100644 src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.cs.xlf create mode 100644 src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.de.xlf create mode 100644 src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.es.xlf create mode 100644 src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.fr.xlf create mode 100644 src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.it.xlf create mode 100644 src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.ja.xlf create mode 100644 src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.ko.xlf create mode 100644 src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.pl.xlf create mode 100644 src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.pt-BR.xlf create mode 100644 src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.ru.xlf create mode 100644 src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.tr.xlf create mode 100644 src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.zh-Hans.xlf create mode 100644 src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.zh-Hant.xlf create mode 100644 src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.cs.xlf create mode 100644 src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.de.xlf create mode 100644 src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.es.xlf create mode 100644 src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.fr.xlf create mode 100644 src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.it.xlf create mode 100644 src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.ja.xlf create mode 100644 src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.ko.xlf create mode 100644 src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.pl.xlf create mode 100644 src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.pt-BR.xlf create mode 100644 src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.ru.xlf create mode 100644 src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.tr.xlf create mode 100644 src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.zh-Hans.xlf create mode 100644 src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.zh-Hant.xlf create mode 100644 test/dotnet.Tests/CommandTests/UpdateToolCommandTests.cs create mode 100644 test/dotnet.Tests/ParserTests/UpdateToolParserTests.cs diff --git a/src/dotnet/BuiltInCommandsCatalog.cs b/src/dotnet/BuiltInCommandsCatalog.cs index b3b1c1824..75666ea65 100644 --- a/src/dotnet/BuiltInCommandsCatalog.cs +++ b/src/dotnet/BuiltInCommandsCatalog.cs @@ -22,6 +22,7 @@ using Microsoft.DotNet.Tools.Uninstall; using Microsoft.DotNet.Tools.VSTest; using System.Collections.Generic; using Microsoft.DotNet.Tools.Install; +using Microsoft.DotNet.Tools.Update; namespace Microsoft.DotNet.Cli { @@ -154,6 +155,10 @@ namespace Microsoft.DotNet.Cli { Command = UninstallCommand.Run }, + ["update"] = new BuiltInCommandMetadata + { + Command = UpdateCommand.Run + }, ["internal-reportinstallsuccess"] = new BuiltInCommandMetadata { Command = InternalReportinstallsuccess.Run diff --git a/src/dotnet/Parser.cs b/src/dotnet/Parser.cs index 076aeb9f3..29f39f9bc 100644 --- a/src/dotnet/Parser.cs +++ b/src/dotnet/Parser.cs @@ -57,6 +57,7 @@ namespace Microsoft.DotNet.Cli InternalReportinstallsuccessCommandParser.InternalReportinstallsuccess(), InstallCommandParser.Install(), UninstallCommandParser.Uninstall(), + UpdateCommandParser.Update(), CommonOptions.HelpOption(), Create.Option("--info", ""), Create.Option("-d", ""), diff --git a/src/dotnet/commands/dotnet-help/HelpUsageText.cs b/src/dotnet/commands/dotnet-help/HelpUsageText.cs index 1dc376171..e8875c7f8 100644 --- a/src/dotnet/commands/dotnet-help/HelpUsageText.cs +++ b/src/dotnet/commands/dotnet-help/HelpUsageText.cs @@ -30,6 +30,7 @@ path-to-application: store {LocalizableStrings.StoreDefinition} install {LocalizableStrings.InstallDefinition} uninstall {LocalizableStrings.UninstallDefinition} + update {LocalizableStrings.UpdateDefinition} help {LocalizableStrings.HelpDefinition} {LocalizableStrings.CommonOptions}: diff --git a/src/dotnet/commands/dotnet-help/LocalizableStrings.resx b/src/dotnet/commands/dotnet-help/LocalizableStrings.resx index 5c4f125dc..1c3ad318d 100644 --- a/src/dotnet/commands/dotnet-help/LocalizableStrings.resx +++ b/src/dotnet/commands/dotnet-help/LocalizableStrings.resx @@ -273,4 +273,7 @@ Uninstalls an item from the development environment. + + Updates an item in the development environment. + diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf index 2075f923e..c2cd7df30 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.cs.xlf @@ -262,6 +262,11 @@ Uninstalls an item from the development environment. + + Updates an item in the development environment. + Updates an item in the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf index b5105534b..3e7614d85 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.de.xlf @@ -262,6 +262,11 @@ Uninstalls an item from the development environment. + + Updates an item in the development environment. + Updates an item in the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf index 2c4f24649..45dcc6151 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.es.xlf @@ -262,6 +262,11 @@ Uninstalls an item from the development environment. + + Updates an item in the development environment. + Updates an item in the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf index 4b69ddc7f..08376a558 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.fr.xlf @@ -262,6 +262,11 @@ Uninstalls an item from the development environment. + + Updates an item in the development environment. + Updates an item in the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf index 737a25340..32bc0fdbd 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.it.xlf @@ -262,6 +262,11 @@ Uninstalls an item from the development environment. + + Updates an item in the development environment. + Updates an item in the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf index a7ed545eb..d63dc94c9 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ja.xlf @@ -262,6 +262,11 @@ Uninstalls an item from the development environment. + + Updates an item in the development environment. + Updates an item in the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf index d89150949..8d5af754a 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ko.xlf @@ -262,6 +262,11 @@ Uninstalls an item from the development environment. + + Updates an item in the development environment. + Updates an item in the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf index 4e39e715c..fa12272e7 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pl.xlf @@ -262,6 +262,11 @@ Uninstalls an item from the development environment. + + Updates an item in the development environment. + Updates an item in the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf index 320d69e59..2da572e4d 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.pt-BR.xlf @@ -262,6 +262,11 @@ Uninstalls an item from the development environment. + + Updates an item in the development environment. + Updates an item in the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf index bb7487a5e..d2c19e629 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.ru.xlf @@ -262,6 +262,11 @@ Uninstalls an item from the development environment. + + Updates an item in the development environment. + Updates an item in the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf index b192fb32a..3feabf584 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.tr.xlf @@ -262,6 +262,11 @@ Uninstalls an item from the development environment. + + Updates an item in the development environment. + Updates an item in the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf index c3bb4684f..cef10bb34 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hans.xlf @@ -262,6 +262,11 @@ Uninstalls an item from the development environment. + + Updates an item in the development environment. + Updates an item in the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf index 6247cdae5..18172bbf3 100644 --- a/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/commands/dotnet-help/xlf/LocalizableStrings.zh-Hant.xlf @@ -262,6 +262,11 @@ Uninstalls an item from the development environment. + + Updates an item in the development environment. + Updates an item in the development environment. + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-install/LocalizableStrings.resx b/src/dotnet/commands/dotnet-install/LocalizableStrings.resx index f2b812cd0..75be146a8 100644 --- a/src/dotnet/commands/dotnet-install/LocalizableStrings.resx +++ b/src/dotnet/commands/dotnet-install/LocalizableStrings.resx @@ -123,4 +123,4 @@ Installs an item into the development environment. - \ No newline at end of file + 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 a05f85b7b..f0fec0a1d 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs @@ -161,41 +161,10 @@ namespace Microsoft.DotNet.Tools.Install.Tool package.Version.ToNormalizedString()).Green()); return 0; } - catch (ToolPackageException ex) + catch (Exception ex) when (InstallToolCommandLowLevelErrorConverter.ShouldConvertToUserFacingError(ex)) { throw new GracefulException( - messages: new[] - { - ex.Message, - string.Format(LocalizableStrings.ToolInstallationFailed, _packageId), - }, - verboseMessages: new[] {ex.ToString()}, - isUserError: false); - } - catch (ToolConfigurationException ex) - { - throw new GracefulException( - messages: new[] - { - string.Format( - LocalizableStrings.InvalidToolConfiguration, - ex.Message), - string.Format(LocalizableStrings.ToolInstallationFailedContactAuthor, _packageId) - }, - verboseMessages: new[] {ex.ToString()}, - isUserError: false); - } - catch (ShellShimException ex) - { - throw new GracefulException( - messages: new[] - { - string.Format( - LocalizableStrings.FailedToCreateToolShim, - _packageId, - ex.Message), - string.Format(LocalizableStrings.ToolInstallationFailed, _packageId) - }, + messages: InstallToolCommandLowLevelErrorConverter.GetUserFacingMessages(ex, _packageId), verboseMessages: new[] {ex.ToString()}, isUserError: false); } diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommandLowLevelErrorConverter.cs b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommandLowLevelErrorConverter.cs new file mode 100644 index 000000000..ba3910003 --- /dev/null +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommandLowLevelErrorConverter.cs @@ -0,0 +1,56 @@ +// 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 System.Collections.Generic; +using Microsoft.DotNet.ShellShim; +using Microsoft.DotNet.ToolPackage; + +namespace Microsoft.DotNet.Tools.Install.Tool +{ + internal static class InstallToolCommandLowLevelErrorConverter + { + public static IEnumerable GetUserFacingMessages(Exception ex, PackageId packageId) + { + string[] userFacingMessages = null; + if (ex is ToolPackageException) + { + userFacingMessages = new[] + { + ex.Message, + string.Format(LocalizableStrings.ToolInstallationFailed, packageId), + }; + } + else if (ex is ToolConfigurationException) + { + userFacingMessages = new[] + { + string.Format( + LocalizableStrings.InvalidToolConfiguration, + ex.Message), + string.Format(LocalizableStrings.ToolInstallationFailedContactAuthor, packageId) + }; + } + else if (ex is ShellShimException) + { + userFacingMessages = new[] + { + string.Format( + LocalizableStrings.FailedToCreateToolShim, + packageId, + ex.Message), + string.Format(LocalizableStrings.ToolInstallationFailed, packageId) + }; + } + + return userFacingMessages; + } + + public static bool ShouldConvertToUserFacingError(Exception ex) + { + return ex is ToolPackageException + || ex is ToolConfigurationException + || ex is ShellShimException; + } + } +} diff --git a/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs index 15268bc38..11cd9dd98 100644 --- a/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs +++ b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.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 System.Transactions; @@ -119,27 +120,11 @@ namespace Microsoft.DotNet.Tools.Uninstall.Tool package.Version.ToNormalizedString()).Green()); return 0; } - catch (ToolPackageException ex) + catch (Exception ex) when (UninstallToolCommandLowLevelErrorConverter.ShouldConvertToUserFacingError(ex)) { throw new GracefulException( - messages: new[] - { - ex.Message - }, - verboseMessages: new[] { ex.ToString() }, - isUserError: false); - } - catch (Exception ex) when (ex is ToolConfigurationException || ex is ShellShimException) - { - throw new GracefulException( - messages: new[] - { - string.Format( - LocalizableStrings.FailedToUninstallTool, - packageId, - ex.Message) - }, - verboseMessages: new[] { ex.ToString() }, + messages: UninstallToolCommandLowLevelErrorConverter.GetUserFacingMessages(ex, packageId), + verboseMessages: new[] {ex.ToString()}, isUserError: false); } } diff --git a/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommandLowLevelErrorConverter.cs b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommandLowLevelErrorConverter.cs new file mode 100644 index 000000000..8169e5171 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommandLowLevelErrorConverter.cs @@ -0,0 +1,44 @@ +// 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 System.Collections.Generic; +using Microsoft.DotNet.ShellShim; +using Microsoft.DotNet.ToolPackage; + +namespace Microsoft.DotNet.Tools.Uninstall.Tool +{ + internal static class UninstallToolCommandLowLevelErrorConverter + { + public static IEnumerable GetUserFacingMessages(Exception ex, PackageId packageId) + { + string[] userFacingMessages = null; + if (ex is ToolPackageException) + { + userFacingMessages = new[] + { + ex.Message + }; + } + else if (ex is ToolConfigurationException || ex is ShellShimException) + { + userFacingMessages = new[] + { + String.Format( + LocalizableStrings.FailedToUninstallTool, + packageId, + ex.Message) + }; + } + + return userFacingMessages; + } + + public static bool ShouldConvertToUserFacingError(Exception ex) + { + return ex is ToolPackageException + || ex is ToolConfigurationException + || ex is ShellShimException; + } + } +} diff --git a/src/dotnet/commands/dotnet-update/LocalizableStrings.resx b/src/dotnet/commands/dotnet-update/LocalizableStrings.resx new file mode 100644 index 000000000..b2c5e6d30 --- /dev/null +++ b/src/dotnet/commands/dotnet-update/LocalizableStrings.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + .NET Update Command + + + Updates an item in the development environment. + + + The NuGet package identifier of the tool to update. + + diff --git a/src/dotnet/commands/dotnet-update/UpdateCommand.cs b/src/dotnet/commands/dotnet-update/UpdateCommand.cs new file mode 100644 index 000000000..2a37ffd1a --- /dev/null +++ b/src/dotnet/commands/dotnet-update/UpdateCommand.cs @@ -0,0 +1,30 @@ +// 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 System.Collections.Generic; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.CommandLine; +using Microsoft.DotNet.Cli.Utils; + +namespace Microsoft.DotNet.Tools.Update +{ + public class UpdateCommand : DotNetTopLevelCommandBase + { + protected override string CommandName => "update"; + protected override string FullCommandNameLocalized => LocalizableStrings.UpdateFullCommandName; + protected override string ArgumentName => Constants.ToolPackageArgumentName; + protected override string ArgumentDescriptionLocalized => LocalizableStrings.UpdateArgumentDescription; + + internal override Dictionary> SubCommands => + new Dictionary> + { + ["tool"] = options => new Tool.UpdateToolCommand(options["tool"], ParseResult) + }; + + public static int Run(string[] args) + { + return new UpdateCommand().RunCommand(args); + } + } +} diff --git a/src/dotnet/commands/dotnet-update/UpdateCommandParser.cs b/src/dotnet/commands/dotnet-update/UpdateCommandParser.cs new file mode 100644 index 000000000..17c1adfe1 --- /dev/null +++ b/src/dotnet/commands/dotnet-update/UpdateCommandParser.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.CommandLine; + +namespace Microsoft.DotNet.Cli +{ + internal static class UpdateCommandParser + { + public static Command Update() + { + return Create.Command( + "update", + Tools.Update.LocalizableStrings.CommandDescription, + Accept.NoArguments(), + CommonOptions.HelpOption(), + UpdateToolCommandParser.Update()); + } + } +} diff --git a/src/dotnet/commands/dotnet-update/tool/LocalizableStrings.resx b/src/dotnet/commands/dotnet-update/tool/LocalizableStrings.resx new file mode 100644 index 000000000..73612c265 --- /dev/null +++ b/src/dotnet/commands/dotnet-update/tool/LocalizableStrings.resx @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + PACKAGE_ID + + + NuGet Package Id of the tool to update. + + + Please specify one tool Package Id to update. + + + Version of the tool package in NuGet. + + + Specifies a NuGet package source to use during update. + + + SOURCE + + + Updates a tool to the latest stable version for use. + + + The NuGet configuration file to use. + + + The target framework to update the tool for. + + + NuGet configuration file '{0}' does not exist. + + + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + + + Update user wide. + + + .NET update Command + + + Please specify either the global option (--global) or the tool path option (--tool-path). + + + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + + + Location where the tool will be installed. + + + Tool '{0}' has multiple versions installed and cannot be updated. + + + Tool '{0}' is not currently installed. + + + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + + + Tool '{0}' failed to update due to the following: + + diff --git a/src/dotnet/commands/dotnet-update/tool/UpdateToolCommand.cs b/src/dotnet/commands/dotnet-update/tool/UpdateToolCommand.cs new file mode 100644 index 000000000..d17ba3b2c --- /dev/null +++ b/src/dotnet/commands/dotnet-update/tool/UpdateToolCommand.cs @@ -0,0 +1,246 @@ +// 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 System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Transactions; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.CommandLine; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.ShellShim; +using Microsoft.DotNet.ToolPackage; +using Microsoft.DotNet.Tools.Install.Tool; +using Microsoft.DotNet.Tools.Uninstall.Tool; +using Microsoft.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.Tools.Update.Tool +{ + internal delegate IShellShimRepository CreateShellShimRepository(DirectoryPath? nonGlobalLocation = null); + + internal delegate (IToolPackageStore, IToolPackageInstaller) CreateToolPackageStoreAndInstaller( + DirectoryPath? nonGlobalLocation = null); + + internal class UpdateToolCommand : CommandBase + { + private readonly IReporter _reporter; + private readonly IReporter _errorReporter; + private readonly CreateShellShimRepository _createShellShimRepository; + private readonly CreateToolPackageStoreAndInstaller _createToolPackageStoreAndInstaller; + + private readonly PackageId _packageId; + private readonly string _configFilePath; + private readonly string _framework; + private readonly string _source; + private readonly bool _global; + private readonly string _verbosity; + private readonly string _toolPath; + + public UpdateToolCommand(AppliedOption appliedCommand, + ParseResult parseResult, + CreateToolPackageStoreAndInstaller createToolPackageStoreAndInstaller = null, + CreateShellShimRepository createShellShimRepository = null, + IReporter reporter = null) + : base(parseResult) + { + if (appliedCommand == null) + { + throw new ArgumentNullException(nameof(appliedCommand)); + } + + _packageId = new PackageId(appliedCommand.Arguments.Single()); + _configFilePath = appliedCommand.ValueOrDefault("configfile"); + _framework = appliedCommand.ValueOrDefault("framework"); + _source = appliedCommand.ValueOrDefault("source"); + _global = appliedCommand.ValueOrDefault("global"); + _verbosity = appliedCommand.SingleArgumentOrDefault("verbosity"); + _toolPath = appliedCommand.SingleArgumentOrDefault("tool-path"); + + _createToolPackageStoreAndInstaller = createToolPackageStoreAndInstaller ?? + ToolPackageFactory.CreateToolPackageStoreAndInstaller; + + _createShellShimRepository = + createShellShimRepository ?? ShellShimRepositoryFactory.CreateShellShimRepository; + + _reporter = (reporter ?? Reporter.Output); + _errorReporter = (reporter ?? Reporter.Error); + } + + public override int Execute() + { + ValidateArguments(); + + DirectoryPath? toolPath = null; + if (_toolPath != null) + { + toolPath = new DirectoryPath(_toolPath); + } + + (IToolPackageStore toolPackageStore, IToolPackageInstaller toolPackageInstaller) = + _createToolPackageStoreAndInstaller(toolPath); + IShellShimRepository shellShimRepository = _createShellShimRepository(toolPath); + + + IToolPackage oldPackage; + try + { + oldPackage = toolPackageStore.EnumeratePackageVersions(_packageId).SingleOrDefault(); + if (oldPackage == null) + { + throw new GracefulException( + messages: new[] + { + string.Format( + LocalizableStrings.ToolNotInstalled, + _packageId), + }, + isUserError: false); + } + } + catch (InvalidOperationException) + { + throw new GracefulException( + messages: new[] + { + string.Format( + LocalizableStrings.ToolHasMultipleVersionsInstalled, + _packageId), + }, + isUserError: false); + } + + FilePath? configFile = null; + if (_configFilePath != null) + { + configFile = new FilePath(_configFilePath); + } + + using (var scope = new TransactionScope( + TransactionScopeOption.Required, + TimeSpan.Zero)) + { + RunWithHandlingUninstallError(() => + { + foreach (CommandSettings command in oldPackage.Commands) + { + shellShimRepository.RemoveShim(command.Name); + } + + oldPackage.Uninstall(); + }); + + RunWithHandlingInstallError(() => + { + IToolPackage newInstalledPackage = toolPackageInstaller.InstallPackage( + packageId: _packageId, + targetFramework: _framework, + nugetConfig: configFile, + source: _source, + verbosity: _verbosity); + + foreach (CommandSettings command in newInstalledPackage.Commands) + { + shellShimRepository.CreateShim(command.Executable, command.Name); + } + + PrintSuccessMessage(oldPackage, newInstalledPackage); + }); + + scope.Complete(); + } + + return 0; + } + + private void ValidateArguments() + { + if (string.IsNullOrWhiteSpace(_toolPath) && !_global) + { + throw new GracefulException( + LocalizableStrings.UpdateToolCommandNeedGlobalOrToolPath); + } + + if (!string.IsNullOrWhiteSpace(_toolPath) && _global) + { + throw new GracefulException( + LocalizableStrings.UpdateToolCommandInvalidGlobalAndToolPath); + } + + if (_configFilePath != null && !File.Exists(_configFilePath)) + { + throw new GracefulException( + string.Format( + LocalizableStrings.NuGetConfigurationFileDoesNotExist, + Path.GetFullPath(_configFilePath))); + } + } + + private void RunWithHandlingInstallError(Action installAction) + { + try + { + installAction(); + } + catch (Exception ex) + when (InstallToolCommandLowLevelErrorConverter.ShouldConvertToUserFacingError(ex)) + { + var message = new List + { + string.Format(LocalizableStrings.UpdateToolFailed, _packageId) + }; + message.AddRange( + InstallToolCommandLowLevelErrorConverter.GetUserFacingMessages(ex, _packageId)); + + + throw new GracefulException( + messages: message, + verboseMessages: new[] { ex.ToString() }, + isUserError: false); + } + } + + private void RunWithHandlingUninstallError(Action uninstallAction) + { + try + { + uninstallAction(); + } + catch (Exception ex) + when (UninstallToolCommandLowLevelErrorConverter.ShouldConvertToUserFacingError(ex)) + { + var message = new List + { + string.Format(LocalizableStrings.UpdateToolFailed, _packageId) + }; + message.AddRange( + UninstallToolCommandLowLevelErrorConverter.GetUserFacingMessages(ex, _packageId)); + + throw new GracefulException( + messages: message, + verboseMessages: new[] { ex.ToString() }, + isUserError: false); + } + } + + private void PrintSuccessMessage(IToolPackage oldPackage, IToolPackage newInstalledPackage) + { + if (oldPackage.Version != newInstalledPackage.Version) + { + _reporter.WriteLine( + string.Format( + LocalizableStrings.UpdateSucceeded, + newInstalledPackage.Id, + oldPackage.Version.ToNormalizedString(), + newInstalledPackage.Version.ToNormalizedString()).Green()); + } + else + { + _reporter.WriteLine( + string.Format( + LocalizableStrings.UpdateSucceededVersionNoChange, + newInstalledPackage.Id, newInstalledPackage.Version).Green()); + } + } + } +} diff --git a/src/dotnet/commands/dotnet-update/tool/UpdateToolCommandParser.cs b/src/dotnet/commands/dotnet-update/tool/UpdateToolCommandParser.cs new file mode 100644 index 000000000..b54157c22 --- /dev/null +++ b/src/dotnet/commands/dotnet-update/tool/UpdateToolCommandParser.cs @@ -0,0 +1,43 @@ +// 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.CommandLine; +using LocalizableStrings = Microsoft.DotNet.Tools.Update.Tool.LocalizableStrings; + +namespace Microsoft.DotNet.Cli +{ + internal static class UpdateToolCommandParser + { + public static Command Update() + { + return Create.Command("tool", + LocalizableStrings.CommandDescription, + Accept.ExactlyOneArgument(errorMessage: o => LocalizableStrings.SpecifyExactlyOnePackageId) + .With(name: LocalizableStrings.PackageIdArgumentName, + description: LocalizableStrings.PackageIdArgumentDescription), + Create.Option( + "-g|--global", + LocalizableStrings.GlobalOptionDescription, + Accept.NoArguments()), + Create.Option( + "--tool-path", + LocalizableStrings.ToolPathDescription, + Accept.ExactlyOneArgument()), + Create.Option( + "--configfile", + LocalizableStrings.ConfigFileOptionDescription, + Accept.ExactlyOneArgument()), + Create.Option( + "--source", + LocalizableStrings.SourceOptionDescription, + Accept.ExactlyOneArgument() + .With(name: LocalizableStrings.SourceOptionName)), + Create.Option( + "-f|--framework", + LocalizableStrings.FrameworkOptionDescription, + Accept.ExactlyOneArgument()), + CommonOptions.HelpOption(), + CommonOptions.VerbosityOption()); + } + } +} diff --git a/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.cs.xlf new file mode 100644 index 000000000..dce83fccb --- /dev/null +++ b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.cs.xlf @@ -0,0 +1,107 @@ + + + + + + PACKAGE_ID + PACKAGE_ID + + + + NuGet Package Id of the tool to update. + NuGet Package Id of the tool to update. + + + + Please specify one tool Package Id to update. + Please specify one tool Package Id to update. + + + + Version of the tool package in NuGet. + Version of the tool package in NuGet. + + + + Specifies a NuGet package source to use during update. + Specifies a NuGet package source to use during update. + + + + SOURCE + SOURCE + + + + Updates a tool to the latest stable version for use. + Updates a tool to the latest stable version for use. + + + + The NuGet configuration file to use. + The NuGet configuration file to use. + + + + The target framework to update the tool for. + The target framework to update the tool for. + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + + + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + + + + Update user wide. + Update user wide. + + + + .NET update Command + .NET update Command + + + + Please specify either the global option (--global) or the tool path option (--tool-path). + Please specify either the global option (--global) or the tool path option (--tool-path). + + + + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + + + + Location where the tool will be installed. + Location where the tool will be installed. + + + + Tool '{0}' has multiple versions installed and cannot be updated. + Tool '{0}' has multiple versions installed and cannot be updated. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + + + + Tool '{0}' failed to update due to the following: + Tool '{0}' failed to update due to the following: + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.de.xlf new file mode 100644 index 000000000..2ebfc47ae --- /dev/null +++ b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.de.xlf @@ -0,0 +1,107 @@ + + + + + + PACKAGE_ID + PACKAGE_ID + + + + NuGet Package Id of the tool to update. + NuGet Package Id of the tool to update. + + + + Please specify one tool Package Id to update. + Please specify one tool Package Id to update. + + + + Version of the tool package in NuGet. + Version of the tool package in NuGet. + + + + Specifies a NuGet package source to use during update. + Specifies a NuGet package source to use during update. + + + + SOURCE + SOURCE + + + + Updates a tool to the latest stable version for use. + Updates a tool to the latest stable version for use. + + + + The NuGet configuration file to use. + The NuGet configuration file to use. + + + + The target framework to update the tool for. + The target framework to update the tool for. + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + + + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + + + + Update user wide. + Update user wide. + + + + .NET update Command + .NET update Command + + + + Please specify either the global option (--global) or the tool path option (--tool-path). + Please specify either the global option (--global) or the tool path option (--tool-path). + + + + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + + + + Location where the tool will be installed. + Location where the tool will be installed. + + + + Tool '{0}' has multiple versions installed and cannot be updated. + Tool '{0}' has multiple versions installed and cannot be updated. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + + + + Tool '{0}' failed to update due to the following: + Tool '{0}' failed to update due to the following: + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.es.xlf new file mode 100644 index 000000000..cf2a1d069 --- /dev/null +++ b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.es.xlf @@ -0,0 +1,107 @@ + + + + + + PACKAGE_ID + PACKAGE_ID + + + + NuGet Package Id of the tool to update. + NuGet Package Id of the tool to update. + + + + Please specify one tool Package Id to update. + Please specify one tool Package Id to update. + + + + Version of the tool package in NuGet. + Version of the tool package in NuGet. + + + + Specifies a NuGet package source to use during update. + Specifies a NuGet package source to use during update. + + + + SOURCE + SOURCE + + + + Updates a tool to the latest stable version for use. + Updates a tool to the latest stable version for use. + + + + The NuGet configuration file to use. + The NuGet configuration file to use. + + + + The target framework to update the tool for. + The target framework to update the tool for. + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + + + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + + + + Update user wide. + Update user wide. + + + + .NET update Command + .NET update Command + + + + Please specify either the global option (--global) or the tool path option (--tool-path). + Please specify either the global option (--global) or the tool path option (--tool-path). + + + + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + + + + Location where the tool will be installed. + Location where the tool will be installed. + + + + Tool '{0}' has multiple versions installed and cannot be updated. + Tool '{0}' has multiple versions installed and cannot be updated. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + + + + Tool '{0}' failed to update due to the following: + Tool '{0}' failed to update due to the following: + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.fr.xlf new file mode 100644 index 000000000..39f023539 --- /dev/null +++ b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.fr.xlf @@ -0,0 +1,107 @@ + + + + + + PACKAGE_ID + PACKAGE_ID + + + + NuGet Package Id of the tool to update. + NuGet Package Id of the tool to update. + + + + Please specify one tool Package Id to update. + Please specify one tool Package Id to update. + + + + Version of the tool package in NuGet. + Version of the tool package in NuGet. + + + + Specifies a NuGet package source to use during update. + Specifies a NuGet package source to use during update. + + + + SOURCE + SOURCE + + + + Updates a tool to the latest stable version for use. + Updates a tool to the latest stable version for use. + + + + The NuGet configuration file to use. + The NuGet configuration file to use. + + + + The target framework to update the tool for. + The target framework to update the tool for. + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + + + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + + + + Update user wide. + Update user wide. + + + + .NET update Command + .NET update Command + + + + Please specify either the global option (--global) or the tool path option (--tool-path). + Please specify either the global option (--global) or the tool path option (--tool-path). + + + + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + + + + Location where the tool will be installed. + Location where the tool will be installed. + + + + Tool '{0}' has multiple versions installed and cannot be updated. + Tool '{0}' has multiple versions installed and cannot be updated. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + + + + Tool '{0}' failed to update due to the following: + Tool '{0}' failed to update due to the following: + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.it.xlf new file mode 100644 index 000000000..d4ac17afe --- /dev/null +++ b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.it.xlf @@ -0,0 +1,107 @@ + + + + + + PACKAGE_ID + PACKAGE_ID + + + + NuGet Package Id of the tool to update. + NuGet Package Id of the tool to update. + + + + Please specify one tool Package Id to update. + Please specify one tool Package Id to update. + + + + Version of the tool package in NuGet. + Version of the tool package in NuGet. + + + + Specifies a NuGet package source to use during update. + Specifies a NuGet package source to use during update. + + + + SOURCE + SOURCE + + + + Updates a tool to the latest stable version for use. + Updates a tool to the latest stable version for use. + + + + The NuGet configuration file to use. + The NuGet configuration file to use. + + + + The target framework to update the tool for. + The target framework to update the tool for. + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + + + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + + + + Update user wide. + Update user wide. + + + + .NET update Command + .NET update Command + + + + Please specify either the global option (--global) or the tool path option (--tool-path). + Please specify either the global option (--global) or the tool path option (--tool-path). + + + + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + + + + Location where the tool will be installed. + Location where the tool will be installed. + + + + Tool '{0}' has multiple versions installed and cannot be updated. + Tool '{0}' has multiple versions installed and cannot be updated. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + + + + Tool '{0}' failed to update due to the following: + Tool '{0}' failed to update due to the following: + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.ja.xlf new file mode 100644 index 000000000..8f8ed7a69 --- /dev/null +++ b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.ja.xlf @@ -0,0 +1,107 @@ + + + + + + PACKAGE_ID + PACKAGE_ID + + + + NuGet Package Id of the tool to update. + NuGet Package Id of the tool to update. + + + + Please specify one tool Package Id to update. + Please specify one tool Package Id to update. + + + + Version of the tool package in NuGet. + Version of the tool package in NuGet. + + + + Specifies a NuGet package source to use during update. + Specifies a NuGet package source to use during update. + + + + SOURCE + SOURCE + + + + Updates a tool to the latest stable version for use. + Updates a tool to the latest stable version for use. + + + + The NuGet configuration file to use. + The NuGet configuration file to use. + + + + The target framework to update the tool for. + The target framework to update the tool for. + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + + + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + + + + Update user wide. + Update user wide. + + + + .NET update Command + .NET update Command + + + + Please specify either the global option (--global) or the tool path option (--tool-path). + Please specify either the global option (--global) or the tool path option (--tool-path). + + + + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + + + + Location where the tool will be installed. + Location where the tool will be installed. + + + + Tool '{0}' has multiple versions installed and cannot be updated. + Tool '{0}' has multiple versions installed and cannot be updated. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + + + + Tool '{0}' failed to update due to the following: + Tool '{0}' failed to update due to the following: + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.ko.xlf new file mode 100644 index 000000000..a26b131ee --- /dev/null +++ b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.ko.xlf @@ -0,0 +1,107 @@ + + + + + + PACKAGE_ID + PACKAGE_ID + + + + NuGet Package Id of the tool to update. + NuGet Package Id of the tool to update. + + + + Please specify one tool Package Id to update. + Please specify one tool Package Id to update. + + + + Version of the tool package in NuGet. + Version of the tool package in NuGet. + + + + Specifies a NuGet package source to use during update. + Specifies a NuGet package source to use during update. + + + + SOURCE + SOURCE + + + + Updates a tool to the latest stable version for use. + Updates a tool to the latest stable version for use. + + + + The NuGet configuration file to use. + The NuGet configuration file to use. + + + + The target framework to update the tool for. + The target framework to update the tool for. + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + + + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + + + + Update user wide. + Update user wide. + + + + .NET update Command + .NET update Command + + + + Please specify either the global option (--global) or the tool path option (--tool-path). + Please specify either the global option (--global) or the tool path option (--tool-path). + + + + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + + + + Location where the tool will be installed. + Location where the tool will be installed. + + + + Tool '{0}' has multiple versions installed and cannot be updated. + Tool '{0}' has multiple versions installed and cannot be updated. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + + + + Tool '{0}' failed to update due to the following: + Tool '{0}' failed to update due to the following: + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.pl.xlf new file mode 100644 index 000000000..acc3e3ea5 --- /dev/null +++ b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.pl.xlf @@ -0,0 +1,107 @@ + + + + + + PACKAGE_ID + PACKAGE_ID + + + + NuGet Package Id of the tool to update. + NuGet Package Id of the tool to update. + + + + Please specify one tool Package Id to update. + Please specify one tool Package Id to update. + + + + Version of the tool package in NuGet. + Version of the tool package in NuGet. + + + + Specifies a NuGet package source to use during update. + Specifies a NuGet package source to use during update. + + + + SOURCE + SOURCE + + + + Updates a tool to the latest stable version for use. + Updates a tool to the latest stable version for use. + + + + The NuGet configuration file to use. + The NuGet configuration file to use. + + + + The target framework to update the tool for. + The target framework to update the tool for. + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + + + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + + + + Update user wide. + Update user wide. + + + + .NET update Command + .NET update Command + + + + Please specify either the global option (--global) or the tool path option (--tool-path). + Please specify either the global option (--global) or the tool path option (--tool-path). + + + + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + + + + Location where the tool will be installed. + Location where the tool will be installed. + + + + Tool '{0}' has multiple versions installed and cannot be updated. + Tool '{0}' has multiple versions installed and cannot be updated. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + + + + Tool '{0}' failed to update due to the following: + Tool '{0}' failed to update due to the following: + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.pt-BR.xlf new file mode 100644 index 000000000..85d3a25cf --- /dev/null +++ b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.pt-BR.xlf @@ -0,0 +1,107 @@ + + + + + + PACKAGE_ID + PACKAGE_ID + + + + NuGet Package Id of the tool to update. + NuGet Package Id of the tool to update. + + + + Please specify one tool Package Id to update. + Please specify one tool Package Id to update. + + + + Version of the tool package in NuGet. + Version of the tool package in NuGet. + + + + Specifies a NuGet package source to use during update. + Specifies a NuGet package source to use during update. + + + + SOURCE + SOURCE + + + + Updates a tool to the latest stable version for use. + Updates a tool to the latest stable version for use. + + + + The NuGet configuration file to use. + The NuGet configuration file to use. + + + + The target framework to update the tool for. + The target framework to update the tool for. + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + + + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + + + + Update user wide. + Update user wide. + + + + .NET update Command + .NET update Command + + + + Please specify either the global option (--global) or the tool path option (--tool-path). + Please specify either the global option (--global) or the tool path option (--tool-path). + + + + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + + + + Location where the tool will be installed. + Location where the tool will be installed. + + + + Tool '{0}' has multiple versions installed and cannot be updated. + Tool '{0}' has multiple versions installed and cannot be updated. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + + + + Tool '{0}' failed to update due to the following: + Tool '{0}' failed to update due to the following: + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.ru.xlf new file mode 100644 index 000000000..3863fd8bf --- /dev/null +++ b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.ru.xlf @@ -0,0 +1,107 @@ + + + + + + PACKAGE_ID + PACKAGE_ID + + + + NuGet Package Id of the tool to update. + NuGet Package Id of the tool to update. + + + + Please specify one tool Package Id to update. + Please specify one tool Package Id to update. + + + + Version of the tool package in NuGet. + Version of the tool package in NuGet. + + + + Specifies a NuGet package source to use during update. + Specifies a NuGet package source to use during update. + + + + SOURCE + SOURCE + + + + Updates a tool to the latest stable version for use. + Updates a tool to the latest stable version for use. + + + + The NuGet configuration file to use. + The NuGet configuration file to use. + + + + The target framework to update the tool for. + The target framework to update the tool for. + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + + + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + + + + Update user wide. + Update user wide. + + + + .NET update Command + .NET update Command + + + + Please specify either the global option (--global) or the tool path option (--tool-path). + Please specify either the global option (--global) or the tool path option (--tool-path). + + + + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + + + + Location where the tool will be installed. + Location where the tool will be installed. + + + + Tool '{0}' has multiple versions installed and cannot be updated. + Tool '{0}' has multiple versions installed and cannot be updated. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + + + + Tool '{0}' failed to update due to the following: + Tool '{0}' failed to update due to the following: + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.tr.xlf new file mode 100644 index 000000000..b2425f5df --- /dev/null +++ b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.tr.xlf @@ -0,0 +1,107 @@ + + + + + + PACKAGE_ID + PACKAGE_ID + + + + NuGet Package Id of the tool to update. + NuGet Package Id of the tool to update. + + + + Please specify one tool Package Id to update. + Please specify one tool Package Id to update. + + + + Version of the tool package in NuGet. + Version of the tool package in NuGet. + + + + Specifies a NuGet package source to use during update. + Specifies a NuGet package source to use during update. + + + + SOURCE + SOURCE + + + + Updates a tool to the latest stable version for use. + Updates a tool to the latest stable version for use. + + + + The NuGet configuration file to use. + The NuGet configuration file to use. + + + + The target framework to update the tool for. + The target framework to update the tool for. + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + + + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + + + + Update user wide. + Update user wide. + + + + .NET update Command + .NET update Command + + + + Please specify either the global option (--global) or the tool path option (--tool-path). + Please specify either the global option (--global) or the tool path option (--tool-path). + + + + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + + + + Location where the tool will be installed. + Location where the tool will be installed. + + + + Tool '{0}' has multiple versions installed and cannot be updated. + Tool '{0}' has multiple versions installed and cannot be updated. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + + + + Tool '{0}' failed to update due to the following: + Tool '{0}' failed to update due to the following: + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.zh-Hans.xlf new file mode 100644 index 000000000..8f413823a --- /dev/null +++ b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.zh-Hans.xlf @@ -0,0 +1,107 @@ + + + + + + PACKAGE_ID + PACKAGE_ID + + + + NuGet Package Id of the tool to update. + NuGet Package Id of the tool to update. + + + + Please specify one tool Package Id to update. + Please specify one tool Package Id to update. + + + + Version of the tool package in NuGet. + Version of the tool package in NuGet. + + + + Specifies a NuGet package source to use during update. + Specifies a NuGet package source to use during update. + + + + SOURCE + SOURCE + + + + Updates a tool to the latest stable version for use. + Updates a tool to the latest stable version for use. + + + + The NuGet configuration file to use. + The NuGet configuration file to use. + + + + The target framework to update the tool for. + The target framework to update the tool for. + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + + + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + + + + Update user wide. + Update user wide. + + + + .NET update Command + .NET update Command + + + + Please specify either the global option (--global) or the tool path option (--tool-path). + Please specify either the global option (--global) or the tool path option (--tool-path). + + + + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + + + + Location where the tool will be installed. + Location where the tool will be installed. + + + + Tool '{0}' has multiple versions installed and cannot be updated. + Tool '{0}' has multiple versions installed and cannot be updated. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + + + + Tool '{0}' failed to update due to the following: + Tool '{0}' failed to update due to the following: + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.zh-Hant.xlf new file mode 100644 index 000000000..a64e6a4ab --- /dev/null +++ b/src/dotnet/commands/dotnet-update/tool/xlf/LocalizableStrings.zh-Hant.xlf @@ -0,0 +1,107 @@ + + + + + + PACKAGE_ID + PACKAGE_ID + + + + NuGet Package Id of the tool to update. + NuGet Package Id of the tool to update. + + + + Please specify one tool Package Id to update. + Please specify one tool Package Id to update. + + + + Version of the tool package in NuGet. + Version of the tool package in NuGet. + + + + Specifies a NuGet package source to use during update. + Specifies a NuGet package source to use during update. + + + + SOURCE + SOURCE + + + + Updates a tool to the latest stable version for use. + Updates a tool to the latest stable version for use. + + + + The NuGet configuration file to use. + The NuGet configuration file to use. + + + + The target framework to update the tool for. + The target framework to update the tool for. + + + + NuGet configuration file '{0}' does not exist. + NuGet configuration file '{0}' does not exist. + + + + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + Tool '{0}' was successfully updated from version '{1}' to version '{2}'. + + + + Update user wide. + Update user wide. + + + + .NET update Command + .NET update Command + + + + Please specify either the global option (--global) or the tool path option (--tool-path). + Please specify either the global option (--global) or the tool path option (--tool-path). + + + + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + (--global) conflicts with the tool path option (--tool-path). Please specify only one of the options. + + + + Location where the tool will be installed. + Location where the tool will be installed. + + + + Tool '{0}' has multiple versions installed and cannot be updated. + Tool '{0}' has multiple versions installed and cannot be updated. + + + + Tool '{0}' is not currently installed. + Tool '{0}' is not currently installed. + + + + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + Tool '{0}' was reinstalled with the latest stable version (version '{1}'). + + + + Tool '{0}' failed to update due to the following: + Tool '{0}' failed to update due to the following: + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.cs.xlf new file mode 100644 index 000000000..ece6d54c0 --- /dev/null +++ b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.cs.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Update Command + .NET Update Command + + + + Updates an item in the development environment. + Updates an item in the development environment. + + + + The NuGet package identifier of the tool to update. + The NuGet package identifier of the tool to update. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.de.xlf new file mode 100644 index 000000000..1d7936f5d --- /dev/null +++ b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.de.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Update Command + .NET Update Command + + + + Updates an item in the development environment. + Updates an item in the development environment. + + + + The NuGet package identifier of the tool to update. + The NuGet package identifier of the tool to update. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.es.xlf new file mode 100644 index 000000000..ead4dc655 --- /dev/null +++ b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.es.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Update Command + .NET Update Command + + + + Updates an item in the development environment. + Updates an item in the development environment. + + + + The NuGet package identifier of the tool to update. + The NuGet package identifier of the tool to update. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.fr.xlf new file mode 100644 index 000000000..cef466edd --- /dev/null +++ b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.fr.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Update Command + .NET Update Command + + + + Updates an item in the development environment. + Updates an item in the development environment. + + + + The NuGet package identifier of the tool to update. + The NuGet package identifier of the tool to update. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.it.xlf new file mode 100644 index 000000000..790f68c1d --- /dev/null +++ b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.it.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Update Command + .NET Update Command + + + + Updates an item in the development environment. + Updates an item in the development environment. + + + + The NuGet package identifier of the tool to update. + The NuGet package identifier of the tool to update. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.ja.xlf new file mode 100644 index 000000000..1832a8731 --- /dev/null +++ b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.ja.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Update Command + .NET Update Command + + + + Updates an item in the development environment. + Updates an item in the development environment. + + + + The NuGet package identifier of the tool to update. + The NuGet package identifier of the tool to update. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.ko.xlf new file mode 100644 index 000000000..aa24da83b --- /dev/null +++ b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.ko.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Update Command + .NET Update Command + + + + Updates an item in the development environment. + Updates an item in the development environment. + + + + The NuGet package identifier of the tool to update. + The NuGet package identifier of the tool to update. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.pl.xlf new file mode 100644 index 000000000..9094f057e --- /dev/null +++ b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.pl.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Update Command + .NET Update Command + + + + Updates an item in the development environment. + Updates an item in the development environment. + + + + The NuGet package identifier of the tool to update. + The NuGet package identifier of the tool to update. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.pt-BR.xlf new file mode 100644 index 000000000..1247ed8e7 --- /dev/null +++ b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.pt-BR.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Update Command + .NET Update Command + + + + Updates an item in the development environment. + Updates an item in the development environment. + + + + The NuGet package identifier of the tool to update. + The NuGet package identifier of the tool to update. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.ru.xlf new file mode 100644 index 000000000..c0de3f963 --- /dev/null +++ b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.ru.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Update Command + .NET Update Command + + + + Updates an item in the development environment. + Updates an item in the development environment. + + + + The NuGet package identifier of the tool to update. + The NuGet package identifier of the tool to update. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.tr.xlf new file mode 100644 index 000000000..2053d884a --- /dev/null +++ b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.tr.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Update Command + .NET Update Command + + + + Updates an item in the development environment. + Updates an item in the development environment. + + + + The NuGet package identifier of the tool to update. + The NuGet package identifier of the tool to update. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.zh-Hans.xlf new file mode 100644 index 000000000..650ec901e --- /dev/null +++ b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.zh-Hans.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Update Command + .NET Update Command + + + + Updates an item in the development environment. + Updates an item in the development environment. + + + + The NuGet package identifier of the tool to update. + The NuGet package identifier of the tool to update. + + + + + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.zh-Hant.xlf new file mode 100644 index 000000000..f4067e882 --- /dev/null +++ b/src/dotnet/commands/dotnet-update/xlf/LocalizableStrings.zh-Hant.xlf @@ -0,0 +1,22 @@ + + + + + + .NET Update Command + .NET Update Command + + + + Updates an item in the development environment. + Updates an item in the development environment. + + + + The NuGet package identifier of the tool to update. + The NuGet package identifier of the tool to update. + + + + + \ No newline at end of file diff --git a/src/dotnet/dotnet.csproj b/src/dotnet/dotnet.csproj index d294220e1..af0e16264 100644 --- a/src/dotnet/dotnet.csproj +++ b/src/dotnet/dotnet.csproj @@ -41,6 +41,8 @@ + + diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ProjectRestorerMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ProjectRestorerMock.cs index f4f280df5..7161dafb6 100644 --- a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ProjectRestorerMock.cs +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ProjectRestorerMock.cs @@ -121,7 +121,7 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks FilePath? nugetConfig = null, string source = null) { - var package = _feeds + var allPackages = _feeds .Where(f => { if (nugetConfig != null) { @@ -134,8 +134,11 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks return true; }) .SelectMany(f => f.Packages) - .Where(p => MatchPackage(p, packageId, versionRange)).OrderByDescending(p => p.Version) - .FirstOrDefault(); + .Where(f => f.PackageId == packageId); + + var bestVersion = versionRange.FindBestMatch(allPackages.Select(p => NuGetVersion.Parse(p.Version))); + + var package = allPackages.Where(p => NuGetVersion.Parse(p.Version).Equals(bestVersion)).FirstOrDefault(); if (package == null) { diff --git a/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs b/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs index 6ed105cbf..46d5303a0 100644 --- a/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs +++ b/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs @@ -41,6 +41,7 @@ SDK commands: store Stores the specified assemblies in the runtime store. install Installs an item into the development environment. uninstall Uninstalls an item from the development environment. + update Updates an item in the development environment. help Show help. Common options: diff --git a/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs b/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs index 902c72d69..a09ad4afa 100644 --- a/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs @@ -155,7 +155,9 @@ namespace Microsoft.DotNet.Tests.Commands Action a = () => installToolCommand.Execute(); a.ShouldThrow().And.Message - .Should().Contain(string.Format(LocalizableStrings.ToolInstallationFailed, PackageId)); + .Should().Contain( + "Simulated error" + Environment.NewLine + + string.Format(LocalizableStrings.ToolInstallationFailed, PackageId)); _fileSystem.Directory.Exists(Path.Combine(PathToPlacePackages, PackageId)).Should().BeFalse(); } diff --git a/test/dotnet.Tests/CommandTests/UpdateToolCommandTests.cs b/test/dotnet.Tests/CommandTests/UpdateToolCommandTests.cs new file mode 100644 index 000000000..9d2c6e59b --- /dev/null +++ b/test/dotnet.Tests/CommandTests/UpdateToolCommandTests.cs @@ -0,0 +1,243 @@ +// 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 System.Collections.Generic; +using System.Linq; +using FluentAssertions; +using Microsoft.DotNet.Cli.CommandLine; +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.DotNet.Tools.Update.Tool; +using Microsoft.Extensions.DependencyModel.Tests; +using Microsoft.Extensions.EnvironmentAbstractions; +using Xunit; +using Parser = Microsoft.DotNet.Cli.Parser; +using LocalizableStrings = Microsoft.DotNet.Tools.Update.Tool.LocalizableStrings; + +namespace Microsoft.DotNet.Tests.Commands +{ + public class UpdateToolCommandTests + { + private readonly BufferedReporter _reporter; + private readonly IFileSystem _fileSystem; + private readonly EnvironmentPathInstructionMock _environmentPathInstructionMock; + private readonly ToolPackageStoreMock _store; + private readonly PackageId _packageId = new PackageId("global.tool.console.demo"); + private readonly List _mockFeeds; + private const string LowerPackageVersion = "1.0.4"; + private const string HigherPackageVersion = "1.0.5"; + private const string ShimsDirectory = "shims"; + private const string ToolsDirectory = "tools"; + + public UpdateToolCommandTests() + { + _reporter = new BufferedReporter(); + _fileSystem = new FileSystemMockBuilder().Build(); + _environmentPathInstructionMock = new EnvironmentPathInstructionMock(_reporter, ShimsDirectory); + _store = new ToolPackageStoreMock(new DirectoryPath(ToolsDirectory), _fileSystem); + _mockFeeds = new List + { + new MockFeed + { + Type = MockFeedType.FeedFromLookUpNugetConfig, + Packages = new List + { + new MockFeedPackage + { + PackageId = _packageId.ToString(), + Version = LowerPackageVersion + }, + new MockFeedPackage + { + PackageId = _packageId.ToString(), + Version = HigherPackageVersion + } + } + } + }; + } + + [Fact] + public void GivenANonExistentPackageItErrors() + { + var packageId = "does.not.exist"; + var command = CreateUpdateCommand($"-g {packageId}"); + + Action a = () => command.Execute(); + + a.ShouldThrow().And.Message + .Should().Contain( + string.Format( + LocalizableStrings.ToolNotInstalled, + packageId)); + } + + [Fact] + public void GivenAnExistedLowerversionInstallationWhenCallItCanUpdateThePackageVersion() + { + CreateInstallCommand($"-g {_packageId} --version {LowerPackageVersion}").Execute(); + + var command = CreateUpdateCommand($"-g {_packageId}"); + + command.Execute(); + + _store.EnumeratePackageVersions(_packageId).Single().Version.ToFullString().Should() + .Be(HigherPackageVersion); + } + + [Fact] + public void GivenAnExistedLowerversionInstallationWhenCallItCanPrintSucessMessage() + { + CreateInstallCommand($"-g {_packageId} --version {LowerPackageVersion}").Execute(); + _reporter.Lines.Clear(); + + var command = CreateUpdateCommand($"-g {_packageId}"); + + command.Execute(); + + _reporter.Lines.First().Should().Contain(string.Format( + LocalizableStrings.UpdateSucceeded, + _packageId, LowerPackageVersion, HigherPackageVersion)); + } + + [Fact] + public void GivenAnExistedSameVersionInstallationWhenCallItCanPrintSucessMessage() + { + CreateInstallCommand($"-g {_packageId} --version {HigherPackageVersion}").Execute(); + _reporter.Lines.Clear(); + + var command = CreateUpdateCommand($"-g {_packageId}"); + + command.Execute(); + + _reporter.Lines.First().Should().Contain(string.Format( + LocalizableStrings.UpdateSucceededVersionNoChange, + _packageId, HigherPackageVersion)); + } + + [Fact] + public void GivenAnExistedLowerversionWhenReinstallThrowsIthasTheFirstLineIndicateUpdateFailure() + { + CreateInstallCommand($"-g {_packageId} --version {LowerPackageVersion}").Execute(); + _reporter.Lines.Clear(); + + ParseResult result = Parser.Instance.Parse("dotnet update tool " + $"-g {_packageId}"); + var command = new UpdateToolCommand( + result["dotnet"]["update"]["tool"], + result, + _ => (_store, + new ToolPackageInstallerMock( + _fileSystem, + _store, + new ProjectRestorerMock( + _fileSystem, + _reporter, + _mockFeeds + ), + installCallback: () => throw new ToolConfigurationException("Simulated error"))), + _ => new ShellShimRepositoryMock(new DirectoryPath(ShimsDirectory), _fileSystem), + _reporter); + + Action a = () => command.Execute(); + a.ShouldThrow().And.Message.Should().Contain( + string.Format(LocalizableStrings.UpdateToolFailed, _packageId) + Environment.NewLine + + string.Format(Tools.Install.Tool.LocalizableStrings.InvalidToolConfiguration, "Simulated error")); + } + + [Fact] + public void GivenAnExistedLowerversionWhenReinstallThrowsItRollsBack() + { + CreateInstallCommand($"-g {_packageId} --version {LowerPackageVersion}").Execute(); + _reporter.Lines.Clear(); + + ParseResult result = Parser.Instance.Parse("dotnet update tool " + $"-g {_packageId}"); + var command = new UpdateToolCommand( + result["dotnet"]["update"]["tool"], + result, + _ => (_store, + new ToolPackageInstallerMock( + _fileSystem, + _store, + new ProjectRestorerMock( + _fileSystem, + _reporter, + _mockFeeds + ), + installCallback: () => throw new ToolConfigurationException("Simulated error"))), + _ => new ShellShimRepositoryMock(new DirectoryPath(ShimsDirectory), _fileSystem), + _reporter); + + Action a = () => command.Execute(); + + _store.EnumeratePackageVersions(_packageId).Single().Version.ToFullString().Should() + .Be(LowerPackageVersion); + } + + [Fact] + public void WhenRunWithBothGlobalAndToolPathShowErrorMessage() + { + var command = CreateUpdateCommand($"-g --tool-path /tmp/folder {_packageId}"); + + Action a = () => command.Execute(); + + a.ShouldThrow().And.Message + .Should().Contain( + LocalizableStrings.UpdateToolCommandInvalidGlobalAndToolPath); + } + + [Fact] + public void WhenRunWithNeitherOfGlobalNorToolPathShowErrorMessage() + { + var command = CreateUpdateCommand($"{_packageId}"); + + Action a = () => command.Execute(); + + a.ShouldThrow().And.Message + .Should().Contain( + LocalizableStrings.UpdateToolCommandNeedGlobalOrToolPath); + } + + private InstallToolCommand CreateInstallCommand(string options) + { + ParseResult result = Parser.Instance.Parse("dotnet install tool " + options); + + return new InstallToolCommand( + result["dotnet"]["install"]["tool"], + result, + (_) => (_store, new ToolPackageInstallerMock( + _fileSystem, + _store, + new ProjectRestorerMock( + _fileSystem, + _reporter, + _mockFeeds + ))), + (_) => new ShellShimRepositoryMock(new DirectoryPath(ShimsDirectory), _fileSystem), + _environmentPathInstructionMock, + _reporter); + } + + private UpdateToolCommand CreateUpdateCommand(string options) + { + ParseResult result = Parser.Instance.Parse("dotnet update tool " + options); + + return new UpdateToolCommand( + result["dotnet"]["update"]["tool"], + result, + (_) => (_store, new ToolPackageInstallerMock( + _fileSystem, + _store, + new ProjectRestorerMock( + _fileSystem, + _reporter, + _mockFeeds + ))), + (_) => new ShellShimRepositoryMock(new DirectoryPath(ShimsDirectory), _fileSystem), + _reporter); + } + } +} diff --git a/test/dotnet.Tests/ParserTests/UpdateToolParserTests.cs b/test/dotnet.Tests/ParserTests/UpdateToolParserTests.cs new file mode 100644 index 000000000..ce870ff5c --- /dev/null +++ b/test/dotnet.Tests/ParserTests/UpdateToolParserTests.cs @@ -0,0 +1,93 @@ +// 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.Linq; +using FluentAssertions; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.CommandLine; +using Xunit; +using Xunit.Abstractions; +using Parser = Microsoft.DotNet.Cli.Parser; + +namespace Microsoft.DotNet.Tests.ParserTests +{ + public class UpdateInstallToolParserTests + { + private readonly ITestOutputHelper _output; + + public UpdateInstallToolParserTests(ITestOutputHelper output) + { + _output = output; + } + + [Fact] + public void UpdateGlobaltoolParserCanGetPackageId() + { + var command = Parser.Instance; + var result = command.Parse("dotnet update tool -g console.test.app"); + + var parseResult = result["dotnet"]["update"]["tool"]; + + var packageId = parseResult.Arguments.Single(); + + packageId.Should().Be("console.test.app"); + } + + [Fact] + public void UpdateToolParserCanGetGlobalOption() + { + var result = Parser.Instance.Parse("dotnet update tool -g console.test.app"); + + var appliedOptions = result["dotnet"]["update"]["tool"]; + appliedOptions.ValueOrDefault("global").Should().Be(true); + } + + [Fact] + public void UpdateToolParserCanGetFollowingArguments() + { + var command = Parser.Instance; + var result = + command.Parse( + @"dotnet update tool -g console.test.app --version 1.0.1 --framework netcoreapp2.0 --configfile C:\TestAssetLocalNugetFeed"); + + var parseResult = result["dotnet"]["update"]["tool"]; + + parseResult.ValueOrDefault("configfile").Should().Be(@"C:\TestAssetLocalNugetFeed"); + parseResult.ValueOrDefault("framework").Should().Be("netcoreapp2.0"); + } + + [Fact] + public void UpdateToolParserCanParseSourceOption() + { + const string expectedSourceValue = "TestSourceValue"; + + var result = + Parser.Instance.Parse($"dotnet update tool -g --source {expectedSourceValue} console.test.app"); + + var appliedOptions = result["dotnet"]["update"]["tool"]; + appliedOptions.ValueOrDefault("source").Should().Be(expectedSourceValue); + } + + [Fact] + public void UpdateToolParserCanParseVerbosityOption() + { + const string expectedVerbosityLevel = "diag"; + + var result = + Parser.Instance.Parse($"dotnet update tool -g --verbosity:{expectedVerbosityLevel} console.test.app"); + + var appliedOptions = result["dotnet"]["update"]["tool"]; + appliedOptions.SingleArgumentOrDefault("verbosity").Should().Be(expectedVerbosityLevel); + } + + [Fact] + public void UpdateToolParserCanParseToolPathOption() + { + var result = + Parser.Instance.Parse(@"dotnet update tool --tool-path C:\TestAssetLocalNugetFeed console.test.app"); + + var appliedOptions = result["dotnet"]["update"]["tool"]; + appliedOptions.SingleArgumentOrDefault("tool-path").Should().Be(@"C:\TestAssetLocalNugetFeed"); + } + } +}