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/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/Microsoft.DotNet.Cli.sln b/Microsoft.DotNet.Cli.sln index 0748db81a..855541357 100644 --- a/Microsoft.DotNet.Cli.sln +++ b/Microsoft.DotNet.Cli.sln @@ -1,3 +1,4 @@ + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27130.2020 @@ -232,8 +233,14 @@ 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 +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 Debug|Any CPU = Debug|Any CPU @@ -1642,6 +1649,30 @@ 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 + {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 {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 @@ -1666,6 +1697,54 @@ 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 + {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 + {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 @@ -1739,7 +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} + {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/README.md b/README.md index b82995678..c8601e119 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? @@ -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 @@ -59,17 +62,17 @@ 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] | | **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] | +| **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] | -| Latest Coherent Build2
*release/2.1.3xx* | +| Latest Coherent Build2
*master* | |:------:| | [![][coherent-version-badge]][coherent-version] | @@ -77,42 +80,44 @@ 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-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/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 +[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/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 +[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/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 +[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 -[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 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/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/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 diff --git a/build/Branding.props b/build/Branding.props index b34946abf..282dae5b7 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 diff --git a/build/BuildDefaults.props b/build/BuildDefaults.props index 6f3109c4f..1c4460790 100644 --- a/build/BuildDefaults.props +++ b/build/BuildDefaults.props @@ -2,6 +2,9 @@ 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/BundledDotnetTools.proj b/build/BundledDotnetTools.proj new file mode 100644 index 000000000..3c07a51f0 --- /dev/null +++ b/build/BundledDotnetTools.proj @@ -0,0 +1,28 @@ + + + + + + + + + + + + + --runtime any + $(DotnetToolsRestoreAdditionalParameters) /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..e64552ab0 --- /dev/null +++ b/build/BundledDotnetTools.props @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/build/BundledRuntimes.props b/build/BundledRuntimes.props index aeeaf373d..1bf1db059 100644 --- a/build/BundledRuntimes.props +++ b/build/BundledRuntimes.props @@ -12,7 +12,7 @@ $(CoreSetupRid) - x64 + x64 dotnet-host$(InstallerStartSuffix)-$(SharedHostVersion)-$(SharedFrameworkInstallerFileRid)$(InstallerExtension) $(PackagesDirectory)/$(DownloadedSharedHostInstallerFileName) @@ -25,11 +25,10 @@ $(CoreSetupRid) - linux-x64 + linux-$(Architecture) dotnet-runtime-$(MicrosoftNETCoreAppPackageVersion)-$(SharedFrameworkRid)$(ArchiveExtension) $(SharedFrameworkRid) - linux-x64 linux-x64 $(AspNetCoreSharedFxInstallerRid) x64 @@ -56,7 +55,7 @@ <_DownloadAndExtractItem Include="AspNetCoreSharedFxArchiveFile" - Condition="!Exists('$(AspNetCoreSharedFxArchiveFile)')"> + Condition="!Exists('$(AspNetCoreSharedFxArchiveFile)') And !$(Architecture.StartsWith('arm'))"> $(AspNetCoreSharedFxRootUrl)$(AspNetCoreVersion)/$(AspNetCoreSharedFxArchiveFileName)$(CoreSetupBlobAccessTokenParam) $(AspNetCoreSharedFxArchiveFile) $(AspNetCoreSharedFxPublishDirectory) @@ -70,42 +69,42 @@ <_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)' != '' 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/BundledSdks.props b/build/BundledSdks.props index d665ef7f3..b23f247e3 100644 --- a/build/BundledSdks.props +++ b/build/BundledSdks.props @@ -2,9 +2,11 @@ + + 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/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 diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 52379a740..f4fd69fc0 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -1,23 +1,23 @@ - 2.1.0-preview1-28275 - 2.1.0-preview1-26116-04 + 2.1.0-preview2-30338 + 2.1.0-preview2-26313-01 $(MicrosoftNETCoreAppPackageVersion) - 15.6.82 + 15.7.0-preview-000066 $(MicrosoftBuildPackageVersion) $(MicrosoftBuildPackageVersion) $(MicrosoftBuildPackageVersion) $(MicrosoftBuildPackageVersion) 10.1.4-rtm-180213-0 - 2.7.0-beta3-62615-05 - $(MicrosoftCodeAnalysisCSharpPackageVersion) + 2.8.0-beta2-62713-01 $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) - 2.1.300-preview1-62608-07 + 2.1.300-preview2-62716-01 $(MicrosoftNETSdkPackageVersion) - 2.1.0-release21-20180126-1326543 + $(MicrosoftAspNetCoreAppPackageVersion) + 2.1.300-preview2-20180306-1448279 $(MicrosoftNETSdkWebPackageVersion) $(MicrosoftNETSdkWebPackageVersion) 1.0.1-beta3-20180104-1263555 @@ -28,12 +28,12 @@ $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) $(MicrosoftTemplateEngineCliPackageVersion) - 2.1.0-preview1-26116-04 - 2.1.0-preview1-26116-04 + 2.1.0-preview2-26313-01 + 2.1.0-preview2-26313-01 0.1.1-alpha-174 1.2.1-alpha-002133 $(MicrosoftDotNetProjectJsonMigrationPackageVersion) - 0.2.0-beta-000059 + 0.2.0-beta-62628-01 1.6.0-beta2-25304 4.7.0-preview1-4927 $(NuGetBuildTasksPackageVersion) 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/MSBuildExtensions.targets b/build/MSBuildExtensions.targets index f1afbe3cb..c6ce9ae6b 100644 --- a/build/MSBuildExtensions.targets +++ b/build/MSBuildExtensions.targets @@ -97,23 +97,27 @@ 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]) + + <_NETCoreSdkIsPreview Condition=" '$(DropSuffix)' == '' ">true $(_NETCoreAppTargetFrameworkVersion) $(_NETCoreAppPackageVersion) $(_NETStandardTargetFrameworkVersion) - $(_NETStandardPackageVersion) - $(_NETCorePlatformsImplicitPackageVersion) + $(_NETStandardLibraryPackageVersion) + $(_NETCorePlatformsPackageVersion) + $(SdkVersion) + <_NETCoreSdkIsPreview>$(_NETCoreSdkIsPreview) ]]> diff --git a/build/NugetConfigFile.targets b/build/NugetConfigFile.targets index ae70bac8f..01752b66d 100644 --- a/build/NugetConfigFile.targets +++ b/build/NugetConfigFile.targets @@ -20,7 +20,7 @@ - + @@ -29,6 +29,8 @@ + + ]]> diff --git a/build/Package.targets b/build/Package.targets index c9c391839..77ea2aa33 100644 --- a/build/Package.targets +++ b/build/Package.targets @@ -11,8 +11,13 @@ + Condition=" '$(SkipBuildingInstallers)' != 'true' And !$(Architecture.StartsWith('arm')) " + DependsOnTargets="Prepare; + Layout; + GeneratePkgs; + GenerateDebs; + GenerateMsis; + GenerateRpms" /> + GenerateInstallers" /> + DependsOnTargets="SandBoxPrepare; + Layout; + GenerateDebs; + GenerateRpms; + CopySandBoxPackageOut" /> diff --git a/build/Publish.targets b/build/Publish.targets index 053aaebfb..70819a6b1 100644 --- a/build/Publish.targets +++ b/build/Publish.targets @@ -71,7 +71,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/Version.props b/build/Version.props index 7c3c70205..99f4241a6 100644 --- a/build/Version.props +++ b/build/Version.props @@ -3,7 +3,7 @@ 2 1 300 - preview1 + preview2 $(VersionMajor).$(VersionMinor).$(VersionPatch)-$(ReleaseSuffix) $(VersionMajor).$(VersionMinor).$(VersionPatch).$(CommitCount) 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 @@ + diff --git a/build/publish/Badge.targets b/build/publish/Badge.targets index 1e110eb65..ec3a0905d 100644 --- a/build/publish/Badge.targets +++ b/build/publish/Badge.targets @@ -17,7 +17,7 @@ + Condition=" '$(Coherent)' == 'true' And !$(Architecture.StartsWith('arm')) "> $(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/build/publish/RuntimeCoherence.targets b/build/publish/RuntimeCoherence.targets index 474c20656..4fb8f4d4e 100644 --- a/build/publish/RuntimeCoherence.targets +++ b/build/publish/RuntimeCoherence.targets @@ -1,6 +1,7 @@ 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 @@ + 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/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/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/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..89de34fee 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'; @@ -75,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") } 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/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/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/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.Cli.Utils/FileNameSuffixes.cs b/src/Microsoft.DotNet.Cli.Utils/FileNameSuffixes.cs index 5bb3fc795..48c149c74 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,8 @@ namespace Microsoft.DotNet.Cli.Utils StaticLib = ".a" }; + public static PlatformFileNameSuffixes FreeBSD { get; } = Linux; + public struct PlatformFileNameSuffixes { public string DynamicLib { get; internal set; } 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/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/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.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 03af407f7..2d1b8c640 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}). @@ -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/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/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.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.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..fa1e01cf1 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/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/Microsoft.DotNet.InternalAbstractions/DirectoryWrapper.cs b/src/Microsoft.DotNet.InternalAbstractions/DirectoryWrapper.cs index d0c26bd70..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) @@ -47,5 +52,15 @@ namespace Microsoft.Extensions.EnvironmentAbstractions { Directory.CreateDirectory(path); } + + public void Delete(string path, bool recursive) + { + 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 385c2deb8..512037f33 100644 --- a/src/Microsoft.DotNet.InternalAbstractions/FileWrapper.cs +++ b/src/Microsoft.DotNet.InternalAbstractions/FileWrapper.cs @@ -45,5 +45,15 @@ 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 8590bab5a..1660bcfa4 100644 --- a/src/Microsoft.DotNet.InternalAbstractions/IDirectory.cs +++ b/src/Microsoft.DotNet.InternalAbstractions/IDirectory.cs @@ -11,10 +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 1feb4b481..a04f70dcd 100644 --- a/src/Microsoft.DotNet.InternalAbstractions/IFile.cs +++ b/src/Microsoft.DotNet.InternalAbstractions/IFile.cs @@ -24,5 +24,9 @@ namespace Microsoft.Extensions.EnvironmentAbstractions void CreateEmptyFile(string path); void WriteAllText(string path, string content); + + void Move(string source, string destination); + + void Delete(string path); } } diff --git a/src/Microsoft.DotNet.InternalAbstractions/Microsoft.DotNet.InternalAbstractions.csproj b/src/Microsoft.DotNet.InternalAbstractions/Microsoft.DotNet.InternalAbstractions.csproj index 27ae6e2cb..d1f1a7e1c 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.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/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/BuiltInCommandsCatalog.cs b/src/dotnet/BuiltInCommandsCatalog.cs index dd2c242d6..75666ea65 100644 --- a/src/dotnet/BuiltInCommandsCatalog.cs +++ b/src/dotnet/BuiltInCommandsCatalog.cs @@ -18,9 +18,11 @@ 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; +using Microsoft.DotNet.Tools.Update; namespace Microsoft.DotNet.Cli { @@ -149,6 +151,14 @@ namespace Microsoft.DotNet.Cli { Command = InstallCommand.Run }, + ["uninstall"] = new BuiltInCommandMetadata + { + Command = UninstallCommand.Run + }, + ["update"] = new BuiltInCommandMetadata + { + Command = UpdateCommand.Run + }, ["internal-reportinstallsuccess"] = new BuiltInCommandMetadata { Command = InternalReportinstallsuccess.Run diff --git a/src/dotnet/CommonLocalizableStrings.resx b/src/dotnet/CommonLocalizableStrings.resx index 8a236f571..ad40ada4d 100644 --- a/src/dotnet/CommonLocalizableStrings.resx +++ b/src/dotnet/CommonLocalizableStrings.resx @@ -520,74 +520,112 @@ 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} - - 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: + + 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}'." + + + 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} - - Package '{0}' is missing entry point file {1}. + + Failed to set user executable permissions for shell shim: {0} - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + Failed to install tool package '{0}': {1} - \ No newline at end of file + + Failed to uninstall tool package '{0}': {1} + + + Entry point file '{0}' for command '{1}' was not found in the package. + + + Settings file 'DotnetToolSettings.xml' was not found in the package. + + + Tool '{0}' (version '{1}') is already installed. + + + Failed to find staged tool package '{0}'. + + + Column maximum width must be greater than zero. + + + Command '{0}' has a leading dot. + + 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/Parser.cs b/src/dotnet/Parser.cs index 07639b3ab..29f39f9bc 100644 --- a/src/dotnet/Parser.cs +++ b/src/dotnet/Parser.cs @@ -56,6 +56,8 @@ namespace Microsoft.DotNet.Cli CompleteCommandParser.Complete(), InternalReportinstallsuccessCommandParser.InternalReportinstallsuccess(), InstallCommandParser.Install(), + UninstallCommandParser.Uninstall(), + UpdateCommandParser.Update(), CommonOptions.HelpOption(), Create.Option("--info", ""), Create.Option("-d", ""), 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/Program.cs b/src/dotnet/Program.cs index 1e83488be..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 { @@ -260,16 +261,13 @@ namespace Microsoft.DotNet.Cli private static void PrintInfo() { - HelpCommand.PrintVersionHeader(); - DotnetVersionFile versionFile = DotnetFiles.VersionFileObject; var commitSha = versionFile.CommitSha ?? "N/A"; + Reporter.Output.WriteLine($"{LocalizableStrings.DotNetSdkInfoLabel}"); + Reporter.Output.WriteLine($" Version: {Product.Version}"); + Reporter.Output.WriteLine($" Commit: {commitSha}"); 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(); - 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/src/dotnet/Properties/AssemblyInfo.cs b/src/dotnet/Properties/AssemblyInfo.cs index 249576dc2..b5f0b8fe0 100644 --- a/src/dotnet/Properties/AssemblyInfo.cs +++ b/src/dotnet/Properties/AssemblyInfo.cs @@ -17,5 +17,8 @@ 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")] +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] 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/ToolPackage/IPackageToProjectFileAdder.cs b/src/dotnet/ShellShim/IShellShimRepository.cs similarity index 55% rename from src/dotnet/ToolPackage/IPackageToProjectFileAdder.cs rename to src/dotnet/ShellShim/IShellShimRepository.cs index cdde79c06..737b548df 100644 --- a/src/dotnet/ToolPackage/IPackageToProjectFileAdder.cs +++ b/src/dotnet/ShellShim/IShellShimRepository.cs @@ -1,12 +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.ToolPackage +namespace Microsoft.DotNet.ShellShim { - internal interface IPackageToProjectFileAdder + internal interface IShellShimRepository { - void Add(FilePath projectPath, string packageId); + 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 fe435ac0c..000000000 --- a/src/dotnet/ShellShim/ShellShimMaker.cs +++ /dev/null @@ -1,120 +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.IO; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Xml.Linq; -using Microsoft.DotNet.Cli.Utils; -using Microsoft.DotNet.Tools; -using Microsoft.Extensions.EnvironmentAbstractions; - -namespace Microsoft.DotNet.ShellShim -{ - public class ShellShimMaker - { - 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(string packageExecutablePath, string shellCommandName) - { - FilePath shimPath = GetShimPath(shellCommandName); - - if (!Directory.Exists(shimPath.GetDirectoryPath().Value)) - { - Directory.CreateDirectory(shimPath.GetDirectoryPath().Value); - } - - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - CreateConfigFile(shimPath.Value + ".config", entryPoint: packageExecutablePath, runner: "dotnet"); - using (var shim = File.Create(shimPath.Value)) - using (var exe = typeof(ShellShimMaker).Assembly.GetManifestResourceStream(LauncherExeResourceName)) - { - exe.CopyTo(shim); - } - } - else - { - var packageExecutable = new FilePath(packageExecutablePath); - - var script = new StringBuilder(); - script.AppendLine("#!/bin/sh"); - script.AppendLine($"dotnet {packageExecutable.ToQuotedString()} \"$@\""); - - File.WriteAllText(shimPath.Value, script.ToString()); - - SetUserExecutionPermissionToShimFile(shimPath); - } - } - - public void EnsureCommandNameUniqueness(string shellCommandName) - { - if (File.Exists(Path.Combine(_pathToPlaceShim, shellCommandName))) - { - throw new GracefulException( - string.Format(CommonLocalizableStrings.FailInstallToolSameName, - shellCommandName)); - } - } - - internal void CreateConfigFile(string outputPath, string 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))); - appSettings.Add(new XElement("add", new XAttribute("key", "runner"), new XAttribute("value", runner ?? string.Empty))); - config.Save(outputPath); - } - - public void Remove(string shellCommandName) - { - 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 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/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/ShellShim/WindowsEnvironmentPath.cs b/src/dotnet/ShellShim/WindowsEnvironmentPath.cs index 3ad46b55e..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.EnvironmentPathWindowsManualInstruction, - _packageExecutablePath, _packageExecutablePath)); - } + _reporter.WriteLine( + CommonLocalizableStrings.EnvironmentPathWindowsNeedReopen); + } + else if (!PackageExecutablePathWillExistForFutureNewProcess()) + { + _reporter.WriteLine( + string.Format( + CommonLocalizableStrings.EnvironmentPathWindowsManualInstructions, + _packageExecutablePath)); } } } 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/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 a20a2c18f..86aa06e57 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 @@ -8,9 +9,10 @@ namespace Microsoft.DotNet.ToolPackage internal interface IProjectRestorer { void Restore( - FilePath projectPath, - DirectoryPath assetJsonOutput, - FilePath? nugetconfig, - string source); + 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..c769b002d --- /dev/null +++ b/src/dotnet/ToolPackage/IToolPackage.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 System; +using System.Collections.Generic; +using Microsoft.Extensions.EnvironmentAbstractions; +using NuGet.Versioning; + +namespace Microsoft.DotNet.ToolPackage +{ + internal interface IToolPackage + { + PackageId Id { get; } + + NuGetVersion Version { get; } + + DirectoryPath PackageDirectory { get; } + + IReadOnlyList Commands { get; } + + void Uninstall(); + } +} diff --git a/src/dotnet/ToolPackage/IToolPackageInstaller.cs b/src/dotnet/ToolPackage/IToolPackageInstaller.cs new file mode 100644 index 000000000..d54de5460 --- /dev/null +++ b/src/dotnet/ToolPackage/IToolPackageInstaller.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; +using NuGet.Versioning; + +namespace Microsoft.DotNet.ToolPackage +{ + internal interface IToolPackageInstaller + { + IToolPackage InstallPackage( + PackageId packageId, + VersionRange versionRange = null, + string targetFramework = null, + FilePath? nugetConfig = null, + DirectoryPath? rootConfigDirectory = 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..4e3e88c65 --- /dev/null +++ b/src/dotnet/ToolPackage/IToolPackageStore.cs @@ -0,0 +1,29 @@ +// 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; +using NuGet.Versioning; + +namespace Microsoft.DotNet.ToolPackage +{ + internal interface IToolPackageStore + { + DirectoryPath Root { get; } + + 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/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/ToolConfiguration.cs b/src/dotnet/ToolPackage/ToolConfiguration.cs index 83862c38b..fe6eeb2a9 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,32 +16,47 @@ 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)); } + EnsureNoLeadingDot(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}'")))); } } + 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/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 4938111f2..7d943c36e 100644 --- a/src/dotnet/ToolPackage/ToolConfigurationDeserializer.cs +++ b/src/dotnet/ToolPackage/ToolConfigurationDeserializer.cs @@ -18,46 +18,48 @@ 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) { - 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/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/ToolPackageFactory.cs b/src/dotnet/ToolPackage/ToolPackageFactory.cs new file mode 100644 index 000000000..f3349db77 --- /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()); + + 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/ToolPackage/ToolPackageInstaller.cs b/src/dotnet/ToolPackage/ToolPackageInstaller.cs new file mode 100644 index 000000000..355dabc49 --- /dev/null +++ b/src/dotnet/ToolPackage/ToolPackageInstaller.cs @@ -0,0 +1,161 @@ +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; +using NuGet.Versioning; + +namespace Microsoft.DotNet.ToolPackage +{ + internal class ToolPackageInstaller : IToolPackageInstaller + { + 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( + PackageId packageId, + VersionRange versionRange = null, + string targetFramework = null, + FilePath? nugetConfig = null, + DirectoryPath? rootConfigDirectory = null, + string source = null, + string verbosity = null) + { + var packageRootDirectory = _store.GetRootPackageDirectory(packageId); + string rollbackDirectory = null; + + return TransactionalAction.Run( + action: () => { + try + { + var stageDirectory = _store.GetRandomStagingDirectory(); + Directory.CreateDirectory(stageDirectory.Value); + rollbackDirectory = stageDirectory.Value; + + var tempProject = CreateTempProject( + packageId: packageId, + versionRange: versionRange, + targetFramework: targetFramework ?? BundledTargetFramework.GetTargetFrameworkMoniker(), + restoreDirectory: stageDirectory, + rootConfigDirectory: rootConfigDirectory); + + try + { + _projectRestorer.Restore( + tempProject, + stageDirectory, + nugetConfig, + source, + verbosity); + } + finally + { + File.Delete(tempProject.Value); + } + + 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, + version.ToNormalizedString())); + } + + Directory.CreateDirectory(packageRootDirectory.Value); + Directory.Move(stageDirectory.Value, packageDirectory.Value); + rollbackDirectory = packageDirectory.Value; + + return new ToolPackageInstance(_store, packageId, version, 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( + PackageId packageId, + VersionRange versionRange, + string targetFramework, + DirectoryPath restoreDirectory, + DirectoryPath? rootConfigDirectory) + { + var tempProject = _tempProject ?? new DirectoryPath(Path.GetTempPath()) + .WithSubDirectories(Path.GetRandomFileName()) + .WithFile("restore.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", 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 + 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.ToString()), + new XAttribute("Version", + versionRange?.ToString("S", new VersionRangeFormatter()) ?? "*") // nuget will restore latest stable for * + )) + )); + + 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..74b092109 --- /dev/null +++ b/src/dotnet/ToolPackage/ToolPackageInstance.cs @@ -0,0 +1,170 @@ +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; +using NuGet.Versioning; + +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, + PackageId id, + NuGetVersion version, + DirectoryPath packageDirectory) + { + _store = store ?? throw new ArgumentNullException(nameof(store)); + _commands = new Lazy>(GetCommands); + + Id = id; + Version = version ?? throw new ArgumentNullException(nameof(version)); + PackageDirectory = packageDirectory; + } + + public PackageId Id { get; private set; } + + public NuGetVersion Version { 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 staging directory for uninstall + // This prevents cross-device moves when temp is mounted to a different device + var tempPath = _store.GetRandomStagingDirectory().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, + Id, + 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 ToolConfigurationException( + CommonLocalizableStrings.MissingToolSettingsFile); + } + + var toolConfigurationPath = + PackageDirectory + .WithSubDirectories( + Id.ToString(), + library.Version.ToNormalizedString()) + .WithFile(dotnetToolSettings.Path); + + var configuration = ToolConfigurationDeserializer.Deserialize(toolConfigurationPath.Value); + + var entryPointFromLockFile = FindItemInTargetLibrary(library, configuration.ToolAssemblyEntryPoint); + if (entryPointFromLockFile == null) + { + throw new ToolConfigurationException( + string.Format( + CommonLocalizableStrings.MissingToolEntryPointFile, + configuration.ToolAssemblyEntryPoint, + configuration.CommandName)); + } + + // Currently only "dotnet" commands are supported + commands.Add(new CommandSettings( + configuration.CommandName, + "dotnet", + PackageDirectory + .WithSubDirectories( + Id.ToString(), + library.Version.ToNormalizedString()) + .WithFile(entryPointFromLockFile.Path))); + + return commands; + } + catch (Exception ex) when (ex is UnauthorizedAccessException || ex is IOException) + { + throw new ToolConfigurationException( + string.Format( + CommonLocalizableStrings.FailedToRetrieveToolConfiguration, + ex.Message), + ex); + } + } + + private LockFileTargetLibrary FindLibraryInLockFile(LockFile lockFile) + { + return lockFile + ?.Targets?.SingleOrDefault(t => t.RuntimeIdentifier != null) + ?.Libraries?.SingleOrDefault(l => + string.Compare(l.Name, Id.ToString(), StringComparison.CurrentCultureIgnoreCase) == 0); + } + + private static LockFileItem FindItemInTargetLibrary(LockFileTargetLibrary library, string targetRelativeFilePath) + { + return library + ?.ToolsAssemblies + ?.SingleOrDefault(t => LockFileMatcher.MatchesFile(t, targetRelativeFilePath)); + } + } +} diff --git a/src/dotnet/ToolPackage/ToolPackageObtainer.cs b/src/dotnet/ToolPackage/ToolPackageObtainer.cs deleted file mode 100644 index 151fe83e7..000000000 --- a/src/dotnet/ToolPackage/ToolPackageObtainer.cs +++ /dev/null @@ -1,242 +0,0 @@ -using System; -using System.IO; -using System.Linq; -using System.Xml.Linq; -using Microsoft.DotNet.Tools; -using Microsoft.DotNet.Cli.Utils; -using Microsoft.DotNet.Configurer; -using Microsoft.Extensions.EnvironmentAbstractions; -using NuGet.ProjectModel; - -namespace Microsoft.DotNet.ToolPackage -{ - internal class ToolPackageObtainer - { - private readonly Lazy _bundledTargetFrameworkMoniker; - private readonly Func _getTempProjectPath; - private readonly IPackageToProjectFileAdder _packageToProjectFileAdder; - private readonly IProjectRestorer _projectRestorer; - private readonly DirectoryPath _toolsPath; - private readonly DirectoryPath _offlineFeedPath; - - public ToolPackageObtainer( - DirectoryPath toolsPath, - 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; - } - - public ToolConfigurationAndExecutablePath ObtainAndReturnExecutablePath( - string packageId, - string packageVersion = null, - FilePath? nugetconfig = null, - string targetframework = null, - string source = 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 toolDirectory = - CreateIndividualToolVersionDirectory(packageId, packageVersionOrPlaceHolder); - - FilePath tempProjectPath = CreateTempProject( - packageId, - packageVersionOrPlaceHolder, - targetframework, - toolDirectory); - - if (packageVersionOrPlaceHolder.IsPlaceholder) - { - InvokeAddPackageRestore( - nugetconfig, - tempProjectPath, - packageId); - } - - _projectRestorer.Restore(tempProjectPath, toolDirectory, nugetconfig, source); - - if (packageVersionOrPlaceHolder.IsPlaceholder) - { - var concreteVersion = - new DirectoryInfo( - Directory.GetDirectories( - toolDirectory.WithSubDirectories(packageId).Value).Single()).Name; - DirectoryPath versioned = - toolDirectory.GetParentPath().WithSubDirectories(concreteVersion); - - MoveToVersionedDirectory(versioned, toolDirectory); - - toolDirectory = versioned; - packageVersion = concreteVersion; - } - - LockFile lockFile = new LockFileFormat() - .ReadWithLock(toolDirectory.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 = - toolDirectory - .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, - toolDirectory.WithSubDirectories( - 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 - ), - packageVersion.IsConcreteValue - ? new XElement("ItemGroup", - new XElement("PackageReference", - new XAttribute("Include", packageId), - new XAttribute("Version", packageVersion.Value) - )) - : null)); - - File.WriteAllText(tempProjectPath.Value, - tempProjectContent.ToString()); - - 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) - { - DirectoryPath individualTool = _toolsPath.WithSubDirectories(packageId); - DirectoryPath individualToolVersion = individualTool.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..f424b6062 --- /dev/null +++ b/src/dotnet/ToolPackage/ToolPackageStore.cs @@ -0,0 +1,118 @@ +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; + } + + public DirectoryPath Root { get; private set; } + + public DirectoryPath GetRandomStagingDirectory() + { + return Root.WithSubDirectories(StagingDirectory, Path.GetRandomFileName()); + } + + 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)) + { + yield break; + } + + foreach (var subdirectory in Directory.EnumerateDirectories(Root.Value)) + { + 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; + } + + foreach (var package in EnumeratePackageVersions(packageId)) + { + yield return package; + } + } + } + + public IEnumerable EnumeratePackageVersions(PackageId packageId) + { + var packageRootDirectory = Root.WithSubDirectories(packageId.ToString()); + if (!Directory.Exists(packageRootDirectory.Value)) + { + yield break; + } + + foreach (var subdirectory in Directory.EnumerateDirectories(packageRootDirectory.Value)) + { + yield return new ToolPackageInstance( + this, + packageId, + 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/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-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-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/src/dotnet/commands/dotnet-help/HelpUsageText.cs b/src/dotnet/commands/dotnet-help/HelpUsageText.cs index 51688af71..e8875c7f8 100644 --- a/src/dotnet/commands/dotnet-help/HelpUsageText.cs +++ b/src/dotnet/commands/dotnet-help/HelpUsageText.cs @@ -29,6 +29,8 @@ path-to-application: vstest {LocalizableStrings.VsTestDefinition} 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 a8fded7b1..1c3ad318d 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 @@ -270,4 +270,10 @@ Installs an item into the development environment. + + 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 1fb918e20..c2cd7df30 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. @@ -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. @@ -254,7 +254,17 @@ Installs an item into the development environment. - Installs an item into the development environment. + Nainstaluje položku do vývojového prostředí. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + Updates an item in the development environment. + Updates an item in 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 abe8ca5e0..3e7614d85 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). @@ -153,8 +153,8 @@ - List reference in the project. - Verweis im Projekt auflisten. + List project references or installed tools. + Verweis im Projekt auflisten. @@ -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,12 +249,22 @@ Stores the specified assemblies in the runtime store. - Speichert die angegebenen Assemblys im Laufzeitspeicher. + Speichert die angegebenen Assemblys im Runtimespeicher. Installs an item into the development environment. - Installs an item into the development environment. + Installiert ein Element in der Entwicklungsumgebung. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + Updates an item in the development environment. + Updates an item in 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 4e2c38024..45dcc6151 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. @@ -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. @@ -254,7 +254,17 @@ Installs an item into the development environment. - Installs an item into the development environment. + Instala un elemento en el entorno de desarrollo. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + Updates an item in the development environment. + Updates an item in 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 02402ccd8..08376a558 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. @@ -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. @@ -254,7 +254,17 @@ Installs an item into the development environment. - Installs an item into the development environment. + Installe un élément dans l'environnement de développement. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + Updates an item in the development environment. + Updates an item in 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 637855a3b..32bc0fdbd 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. @@ -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. @@ -254,7 +254,17 @@ Installs an item into the development environment. - Installs an item into the development environment. + Installa un elemento nell'ambiente di sviluppo. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + Updates an item in the development environment. + Updates an item in 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 00024f552..d63dc94c9 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. + プロジェクト内の参照を一覧表示します。 @@ -199,12 +199,12 @@ Display the installed SDKs. - Display the installed SDKs. + インストール済み SDK を表示します。 Display the installed runtimes. - Display the installed runtimes. + インストール済みランタイムを表示します。 @@ -254,7 +254,17 @@ Installs an item into the development environment. - Installs an item into the development environment. + 項目を開発環境にインストールします。 + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + Updates an item in the development environment. + Updates an item in 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 ee370d0a4..8d5af754a 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. + 프로젝트의 참조를 나열합니다. @@ -199,12 +199,12 @@ Display the installed SDKs. - Display the installed SDKs. + 설치된 SDK를 표시합니다. Display the installed runtimes. - Display the installed runtimes. + 설치된 런타임을 표시합니다. @@ -254,7 +254,17 @@ Installs an item into the development environment. - Installs an item into the development environment. + 개발 환경에 항목을 설치합니다. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + Updates an item in the development environment. + Updates an item in 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 a1e190326..fa12272e7 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. @@ -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. @@ -254,7 +254,17 @@ Installs an item into the development environment. - Installs an item into the development environment. + Instaluje element w środowisku deweloperskim. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + Updates an item in the development environment. + Updates an item in 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 07da2c572..2da572e4d 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. @@ -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. @@ -254,7 +254,17 @@ Installs an item into the development environment. - Installs an item into the development environment. + Instala um item no ambiente de desenvolvimento. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + Updates an item in the development environment. + Updates an item in 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 7bca9053d..d2c19e629 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. + Список ссылок в проекте. @@ -199,12 +199,12 @@ Display the installed SDKs. - Display the installed SDKs. + Отображение установленных пакетов SDK. Display the installed runtimes. - Display the installed runtimes. + Отображение установленных сред выполнения. @@ -254,7 +254,17 @@ Installs an item into the development environment. - Installs an item into the development environment. + Устанавливает элемент в среде разработки. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + Updates an item in the development environment. + Updates an item in 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 7cf185f5d..3feabf584 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. @@ -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. @@ -254,7 +254,17 @@ Installs an item into the development environment. - Installs an item into the development environment. + Bir öğeyi geliştirme ortamına yükler. + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + Updates an item in the development environment. + Updates an item in 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 e42cfcaec..cef10bb34 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. + 列出项目中的引用。 @@ -199,12 +199,12 @@ Display the installed SDKs. - Display the installed SDKs. + 显示安装的 SDK。 Display the installed runtimes. - Display the installed runtimes. + 显示安装的运行时。 @@ -254,7 +254,17 @@ Installs an item into the development environment. - Installs an item into the development environment. + 将项目安装到开发环境中。 + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + Updates an item in the development environment. + Updates an item in 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 37c8943cf..18172bbf3 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. + 列出專案中的參考。 @@ -199,12 +199,12 @@ Display the installed SDKs. - Display the installed SDKs. + 顯示已安裝的 SDK。 Display the installed runtimes. - Display the installed runtimes. + 顯示已安裝的執行階段。 @@ -254,7 +254,17 @@ Installs an item into the development environment. - Installs an item into the development environment. + 將項目安裝至部署環境。 + + + + Uninstalls an item from the development environment. + Uninstalls an item from the development environment. + + + + Updates an item in the development environment. + Updates an item in the development environment. 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 7a689f9f1..f0fec0a1d 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs @@ -2,8 +2,10 @@ // 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; @@ -11,21 +13,37 @@ 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 { - public class InstallToolCommand : CommandBase + internal delegate IShellShimRepository CreateShellShimRepository(DirectoryPath? nonGlobalLocation = null); + internal delegate (IToolPackageStore, IToolPackageInstaller) CreateToolPackageStoreAndInstaller(DirectoryPath? nonGlobalLocation = null); + + 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 IEnvironmentPathInstruction _environmentPathInstruction; + private readonly IReporter _reporter; + private readonly IReporter _errorReporter; + private CreateShellShimRepository _createShellShimRepository; + private CreateToolPackageStoreAndInstaller _createToolPackageStoreAndInstaller; + + private readonly PackageId _packageId; + private readonly string _packageVersion; + 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 InstallToolCommand( AppliedOption appliedCommand, - ParseResult parseResult) + ParseResult parseResult, + CreateToolPackageStoreAndInstaller createToolPackageStoreAndInstaller = null, + CreateShellShimRepository createShellShimRepository = null, + IEnvironmentPathInstruction environmentPathInstruction = null, + IReporter reporter = null) : base(parseResult) { if (appliedCommand == null) @@ -33,93 +51,122 @@ 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"); _source = appliedCommand.ValueOrDefault("source"); _global = appliedCommand.ValueOrDefault("global"); + _verbosity = appliedCommand.SingleArgumentOrDefault("verbosity"); + _toolPath = appliedCommand.SingleArgumentOrDefault("tool-path"); + + var cliFolderPathCalculator = new CliFolderPathCalculator(); + + _createToolPackageStoreAndInstaller = createToolPackageStoreAndInstaller ?? ToolPackageFactory.CreateToolPackageStoreAndInstaller; + + _environmentPathInstruction = environmentPathInstruction + ?? EnvironmentPathFactory.CreateEnvironmentPathInstruction(); + _createShellShimRepository = createShellShimRepository ?? ShellShimRepositoryFactory.CreateShellShimRepository; + + _reporter = (reporter ?? Reporter.Output); + _errorReporter = (reporter ?? Reporter.Error); } public override int Execute() { - if (!_global) + if (string.IsNullOrWhiteSpace(_toolPath) && !_global) { - throw new GracefulException(LocalizableStrings.InstallToolCommandOnlySupportGlobal); + throw new GracefulException(LocalizableStrings.InstallToolCommandNeedGlobalOrToolPath); } - var cliFolderPathCalculator = new CliFolderPathCalculator(); - var offlineFeedPath = new DirectoryPath(cliFolderPathCalculator.CliFallbackFolderPath); + if (!string.IsNullOrWhiteSpace(_toolPath) && _global) + { + throw new GracefulException(LocalizableStrings.InstallToolCommandInvalidGlobalAndToolPath); + } - var toolConfigurationAndExecutablePath = ObtainPackage( - executablePackagePath: new DirectoryPath(cliFolderPathCalculator.ToolsPackagePath), - offlineFeedPath: offlineFeedPath); + if (_configFilePath != null && !File.Exists(_configFilePath)) + { + throw new GracefulException( + string.Format( + LocalizableStrings.NuGetConfigurationFileDoesNotExist, + Path.GetFullPath(_configFilePath))); + } - var shellShimMaker = new ShellShimMaker(cliFolderPathCalculator.ToolsShimPath); - var commandName = toolConfigurationAndExecutablePath.Configuration.CommandName; - shellShimMaker.EnsureCommandNameUniqueness(commandName); - shellShimMaker.CreateShim( - toolConfigurationAndExecutablePath.Executable.Value, - commandName); + VersionRange versionRange = null; + if (!string.IsNullOrEmpty(_packageVersion) && !VersionRange.TryParse(_packageVersion, out versionRange)) + { + throw new GracefulException( + string.Format( + LocalizableStrings.InvalidNuGetVersionRange, + _packageVersion)); + } - EnvironmentPathFactory - .CreateEnvironmentPathInstruction() - .PrintAddPathInstructionIfPathDoesNotExist(); + DirectoryPath? toolPath = null; + if (_toolPath != null) + { + toolPath = new DirectoryPath(_toolPath); + } - Reporter.Output.WriteLine( - string.Format(LocalizableStrings.InstallationSucceeded, commandName)); + (IToolPackageStore toolPackageStore, IToolPackageInstaller toolPackageInstaller) = + _createToolPackageStoreAndInstaller(toolPath); + IShellShimRepository shellShimRepository = _createShellShimRepository(toolPath); - return 0; - } + // 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; + } + + FilePath? configFile = null; + if (_configFilePath != null) + { + configFile = new FilePath(_configFilePath); + } - private static ToolConfigurationAndExecutablePath ObtainPackage( - DirectoryPath executablePackagePath, - DirectoryPath offlineFeedPath) - { try { - FilePath? configFile = null; - if (_configFilePath != null) + IToolPackage package = null; + using (var scope = new TransactionScope( + TransactionScopeOption.Required, + TimeSpan.Zero)) { - configFile = new FilePath(_configFilePath); + package = toolPackageInstaller.InstallPackage( + packageId: _packageId, + versionRange: versionRange, + targetFramework: _framework, + nugetConfig: configFile, + source: _source, + verbosity: _verbosity); + + foreach (var command in package.Commands) + { + shellShimRepository.CreateShim(command.Executable, command.Name); + } + + scope.Complete(); } - 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()); + if (_global) + { + _environmentPathInstruction.PrintAddPathInstructionIfPathDoesNotExist(); + } - return toolPackageObtainer.ObtainAndReturnExecutablePath( - packageId: _packageId, - packageVersion: _packageVersion, - nugetconfig: configFile, - targetframework: _framework, - source: _source); - } - - catch (PackageObtainException ex) - { - throw new GracefulException( - message: - string.Format(LocalizableStrings.InstallFailedNuget, - ex.Message), - innerException: ex); - } - catch (ToolConfigurationException ex) - { - throw new GracefulException( - message: + _reporter.WriteLine( string.Format( - LocalizableStrings.InstallFailedPackage, - ex.Message), - innerException: ex); + LocalizableStrings.InstallationSucceeded, + string.Join(", ", package.Commands.Select(c => c.Name)), + package.Id, + package.Version.ToNormalizedString()).Green()); + return 0; + } + catch (Exception ex) when (InstallToolCommandLowLevelErrorConverter.ShouldConvertToUserFacingError(ex)) + { + throw new GracefulException( + 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-install/dotnet-install-tool/InstallToolCommandParser.cs b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommandParser.cs index 6422517d9..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, @@ -36,7 +40,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..a6f6cc58c 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/LocalizableStrings.resx +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/LocalizableStrings.resx @@ -144,33 +144,12 @@ The target framework to install the tool for. - - Failed to add 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. 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 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. @@ -178,7 +157,34 @@ The installation succeeded. If there are no further instructions, you can type t .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} - \ No newline at end of file + + Tool '{0}' failed to install. + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + + + The tool package could not be restored. + + + Tool '{0}' is already installed. + + + Failed to create shell shim for tool '{0}': {1} + + + Specified version '{0}' is not a valid NuGet version range. + + + 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/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/src/dotnet/commands/dotnet-install/dotnet-install-tool/ProjectRestorer.cs b/src/dotnet/commands/dotnet-install/dotnet-install-tool/ProjectRestorer.cs index 1419e0e38..5ba8a177b 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/ProjectRestorer.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/ProjectRestorer.cs @@ -14,19 +14,32 @@ namespace Microsoft.DotNet.Tools.Install.Tool { internal class ProjectRestorer : IProjectRestorer { + 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.Output; + _errorReporter = reporter ?? Reporter.Error; + _forceOutputRedirection = reporter != null; + } + public void Restore( - FilePath projectPath, + FilePath project, DirectoryPath assetJsonOutput, - FilePath? nugetconfig, - string source = null) + 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) @@ -38,35 +51,50 @@ namespace Microsoft.DotNet.Tools.Install.Tool argsToPassToRestore.AddRange(new List { "--runtime", - GetRuntimeIdentifierWithMacOsHighSierraFallback(), - $"/p:BaseIntermediateOutputPath={assetJsonOutput.ToQuotedString()}" + AnyRid, + $"/p:BaseIntermediateOutputPath={assetJsonOutput.ToXmlEncodeString()}" }); + argsToPassToRestore.Add($"/verbosity:{verbosity ?? "quiet"}"); + var command = new DotNetCommandFactory(alwaysRunOutOfProc: true) - .Create("restore", argsToPassToRestore) - .CaptureStdOut() - .CaptureStdErr(); + .Create("restore", argsToPassToRestore); + + if (verbosity == null || _forceOutputRedirection) + { + command = command + .OnOutputLine(line => WriteLine(_reporter, line, project)) + .OnErrorLine(line => WriteLine(_errorReporter, line, project)); + } 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 ToolPackageException(LocalizableStrings.ToolInstallationRestoreFailed); } } - // walk around for https://github.com/dotnet/corefx/issues/26488 - // fallback osx.10.13 to osx - private static string GetRuntimeIdentifierWithMacOsHighSierraFallback() + private static void WriteLine(IReporter reporter, string line, FilePath project) { - if (RuntimeEnvironment.GetRuntimeIdentifier() == "osx.10.13-x64") + line = line ?? ""; + + // Remove the temp project prefix if present + if (line.StartsWith($"{project.Value} : ", StringComparison.OrdinalIgnoreCase)) { - return "osx-x64"; + line = line.Substring(project.Value.Length + 3); } - return RuntimeEnvironment.GetRuntimeIdentifier(); + // 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/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..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 @@ -4,113 +4,119 @@ 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} - - - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -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} + 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} 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. + + 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. + Nástroj {0} se nepodařilo nainstalovat. + + + + 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. + + + + 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. + 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. + + + + 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 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..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 @@ -4,113 +4,119 @@ 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} - - - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -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} + 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} 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. + + 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. + Fehler bei der Installation des Tools "{0}". + + + + 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. + + + + 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. + 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. + + + + 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 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..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 @@ -4,113 +4,119 @@ 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} - - - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -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} + 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} 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. + + 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. + No se pudo instalar la herramienta “{0}”. + + + + 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. + + + + 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. + 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. + + + + 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 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..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 @@ -4,113 +4,119 @@ 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} - - - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -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} + 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} 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. + + 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. + Impossible d'installer l'outil '{0}'. + + + + 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. + + + + 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. + 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. + + + + 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 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..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 @@ -4,113 +4,119 @@ 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} - - - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -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} + 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} 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. + + 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. + Non è stato possibile installare lo strumento '{0}'. + + + + 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. + + + + 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. + 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. + + + + 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 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..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 @@ -4,113 +4,119 @@ 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} - - - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -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} + 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} 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. + + The settings file in the tool's NuGet package is invalid: {0} + ツールの NuGet パッケージ内の設定ファイルが無効です: {0} + + + + Tool '{0}' failed to install. + ツール '{0}' をインストールできませんでした。 + + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + ツール '{0}' をインストールできませんでした。ツールの作成者にお問い合わせください。 + + + + 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. + ツール パッケージを復元できませんでした。 + + + + Specified version '{0}' is not a valid NuGet version range. + 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 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..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 @@ -4,113 +4,119 @@ 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} - - - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -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} + 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}을(를) 호출할 수 있습니다. 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. + + The settings file in the tool's NuGet package is invalid: {0} + 도구의 NuGet 패키지에 있는 설정 파일이 잘못되었습니다. {0} + + + + Tool '{0}' failed to install. + '{0}' 도구를 설치하지 못했습니다. + + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + '{0}' 도구를 설치하지 못했습니다. 도구 작성자에게 문의하세요. + + + + 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. + 도구 패키지를 복원할 수 없습니다. + + + + Specified version '{0}' is not a valid NuGet version range. + 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 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..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 @@ -4,113 +4,119 @@ 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} - - - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -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} + 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} 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. + + 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. + Zainstalowanie narzędzia „{0}” nie powiodło się. + + + + 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. + + + + 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. + 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. + + + + 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 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..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 @@ -4,113 +4,119 @@ 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} - - - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -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} + 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} 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. + + 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. + Não foi possível instalar a ferramenta '{0}'. + + + + 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. + + + + 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. + 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. + + + + 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 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..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 @@ -4,113 +4,119 @@ 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} - - - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -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} + 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}. 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. + + The settings file in the tool's NuGet package is invalid: {0} + Недопустимый файл параметров в пакете NuGet инструмента: {0} + + + + Tool '{0}' failed to install. + Не удалось установить инструмент "{0}". + + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + Не удалось установить инструмент "{0}". Обратитесь за помощью к его разработчику. + + + + 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. + Не удалось восстановить пакет инструмента. + + + + Specified version '{0}' is not a valid NuGet version range. + 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 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..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 @@ -4,113 +4,119 @@ 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} - - - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -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} + 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} 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. + + 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. + '{0}' aracı yüklenemedi. + + + + 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. + + + + 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. + 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. + + + + 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 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..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 @@ -4,113 +4,119 @@ 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} - - - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -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} + 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} 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. + + The settings file in the tool's NuGet package is invalid: {0} + 工具的 NuGet 包中的设置文件无效: {0} + + + + Tool '{0}' failed to install. + 工具“{0}”安装失败。 + + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + 工具“{0}”安装失败。请联系工具作者获取帮助。 + + + + 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. + 无法还原工具包。 + + + + Specified version '{0}' is not a valid NuGet version range. + 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 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..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 @@ -4,113 +4,119 @@ 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} - - - - Failed to add package. -WorkingDirectory: {0} -Arguments: {1} -Output: {2}{3} - Failed to add package. -WorkingDirectory: {0} -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} + 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} 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. + + The settings file in the tool's NuGet package is invalid: {0} + 工具之 NuGet 套件中的設定檔案無效: {0} + + + + Tool '{0}' failed to install. + 工具 '{0}' 無法安裝。 + + + + Tool '{0}' failed to install. Please contact the tool author for assistance. + 工具 '{0}' 無法安裝。請連絡工具作者尋求協助。 + + + + 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. + 此工具套件無法還原。 + + + + Specified version '{0}' is not a valid NuGet version range. + 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 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/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-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-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..b567ac74d --- /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.Id.ToString()); + table.AddColumn( + LocalizableStrings.VersionColumn, + p => p.Version.ToNormalizedString()); + 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.EnumeratePackages() + .Where(PackageHasCommands) + .OrderBy(p => p.Id) + .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.Id, + 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-proj/LocalizableStrings.resx b/src/dotnet/commands/dotnet-list/dotnet-list-tool/LocalizableStrings.resx similarity index 87% rename from src/dotnet/commands/dotnet-list/dotnet-list-proj/LocalizableStrings.resx rename to src/dotnet/commands/dotnet-list/dotnet-list-tool/LocalizableStrings.resx index a7913dc1d..b4d21c122 100644 --- a/src/dotnet/commands/dotnet-list/dotnet-list-proj/LocalizableStrings.resx +++ b/src/dotnet/commands/dotnet-list/dotnet-list-tool/LocalizableStrings.resx @@ -117,10 +117,25 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - .NET Projects in Solution viewer + + Lists installed tools in the current development environment. - - Command to list projects in a solution + + List user wide tools. - \ No newline at end of file + + 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-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-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/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/commands/dotnet-add/dotnet-add-proj/LocalizableStrings.resx b/src/dotnet/commands/dotnet-uninstall/LocalizableStrings.resx similarity index 93% rename from src/dotnet/commands/dotnet-add/dotnet-add-proj/LocalizableStrings.resx rename to src/dotnet/commands/dotnet-uninstall/LocalizableStrings.resx index a5810e897..99440a870 100644 --- a/src/dotnet/commands/dotnet-add/dotnet-add-proj/LocalizableStrings.resx +++ b/src/dotnet/commands/dotnet-uninstall/LocalizableStrings.resx @@ -117,13 +117,13 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - .NET Add Project to Solution Command + + .NET Uninstall Command - - Command to add project to solution + + Uninstalls an item from the development environment. - - Projects to add to solution + + 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..83309121e --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/LocalizableStrings.resx @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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. + + + 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} + + + 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 new file mode 100644 index 000000000..11cd9dd98 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommand.cs @@ -0,0 +1,132 @@ +// 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.Configurer; +using Microsoft.DotNet.ShellShim; +using Microsoft.DotNet.ToolPackage; +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 IReporter _reporter; + private readonly IReporter _errorReporter; + private CreateShellShimRepository _createShellShimRepository; + private CreateToolPackageStore _createToolPackageStoreAndInstaller; + + public UninstallToolCommand( + AppliedOption options, + ParseResult result, + CreateToolPackageStore createToolPackageStoreAndInstaller = null, + CreateShellShimRepository createShellShimRepository = null, + IReporter reporter = null) + : base(result) + { + var pathCalculator = new CliFolderPathCalculator(); + + _options = options ?? throw new ArgumentNullException(nameof(options)); + _reporter = reporter ?? Reporter.Output; + _errorReporter = reporter ?? Reporter.Error; + + _createShellShimRepository = createShellShimRepository ?? ShellShimRepositoryFactory.CreateShellShimRepository; + _createToolPackageStoreAndInstaller = createToolPackageStoreAndInstaller ?? ToolPackageFactory.CreateToolPackageStore; + } + + public override int Execute() + { + var global = _options.ValueOrDefault("global"); + var toolPath = _options.SingleArgumentOrDefault("tool-path"); + + if (string.IsNullOrWhiteSpace(toolPath) && !global) + { + 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(); + if (package == 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); + } + + 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.Id, + package.Version.ToNormalizedString()).Green()); + return 0; + } + catch (Exception ex) when (UninstallToolCommandLowLevelErrorConverter.ShouldConvertToUserFacingError(ex)) + { + throw new GracefulException( + 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-uninstall/tool/UninstallToolCommandParser.cs b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommandParser.cs new file mode 100644 index 000000000..028d44a0f --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/UninstallToolCommandParser.cs @@ -0,0 +1,29 @@ +// 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()), + 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 new file mode 100644 index 000000000..c45412a8e --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.cs.xlf @@ -0,0 +1,67 @@ + + + + + + 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. + + + + 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} + + + + 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 new file mode 100644 index 000000000..b7d0fef06 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.de.xlf @@ -0,0 +1,67 @@ + + + + + + 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. + + + + 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} + + + + 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 new file mode 100644 index 000000000..0f0884a52 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.es.xlf @@ -0,0 +1,67 @@ + + + + + + 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. + + + + 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} + + + + 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 new file mode 100644 index 000000000..bbc1608da --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.fr.xlf @@ -0,0 +1,67 @@ + + + + + + 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. + + + + 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} + + + + 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 new file mode 100644 index 000000000..28354ec20 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.it.xlf @@ -0,0 +1,67 @@ + + + + + + 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. + + + + 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} + + + + 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 new file mode 100644 index 000000000..cf28053cb --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ja.xlf @@ -0,0 +1,67 @@ + + + + + + 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. + + + + 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} + + + + 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 new file mode 100644 index 000000000..b2cc666d5 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ko.xlf @@ -0,0 +1,67 @@ + + + + + + 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. + + + + 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} + + + + 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 new file mode 100644 index 000000000..552aaeda3 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.pl.xlf @@ -0,0 +1,67 @@ + + + + + + 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. + + + + 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} + + + + 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 new file mode 100644 index 000000000..d7093abd1 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.pt-BR.xlf @@ -0,0 +1,67 @@ + + + + + + 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. + + + + 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} + + + + 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 new file mode 100644 index 000000000..7215ef17a --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.ru.xlf @@ -0,0 +1,67 @@ + + + + + + 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. + + + + 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} + + + + 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 new file mode 100644 index 000000000..56e68b543 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.tr.xlf @@ -0,0 +1,67 @@ + + + + + + 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. + + + + 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} + + + + 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 new file mode 100644 index 000000000..04cae1765 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.zh-Hans.xlf @@ -0,0 +1,67 @@ + + + + + + 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. + + + + 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} + + + + 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 new file mode 100644 index 000000000..c59aef876 --- /dev/null +++ b/src/dotnet/commands/dotnet-uninstall/tool/xlf/LocalizableStrings.zh-Hant.xlf @@ -0,0 +1,67 @@ + + + + + + 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. + + + + 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} + + + + 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/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/commands/dotnet-remove/dotnet-remove-proj/LocalizableStrings.resx b/src/dotnet/commands/dotnet-update/LocalizableStrings.resx similarity index 94% rename from src/dotnet/commands/dotnet-remove/dotnet-remove-proj/LocalizableStrings.resx rename to src/dotnet/commands/dotnet-update/LocalizableStrings.resx index 8b30c41cf..b2c5e6d30 100644 --- a/src/dotnet/commands/dotnet-remove/dotnet-remove-proj/LocalizableStrings.resx +++ b/src/dotnet/commands/dotnet-update/LocalizableStrings.resx @@ -117,13 +117,13 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - .NET Remove Project from Solution Command + + .NET Update Command - - Command to remove projects from a solution + + Updates an item in the development environment. - - Projects to remove from a solution + + The NuGet package identifier of the tool to update. - \ No newline at end of file + 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 0b640f004..af0e16264 100644 --- a/src/dotnet/dotnet.csproj +++ b/src/dotnet/dotnet.csproj @@ -18,7 +18,6 @@ - @@ -26,21 +25,24 @@ - + - + + + + @@ -50,7 +52,7 @@ - + @@ -77,4 +79,4 @@ - + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf index fcff78d2f..f464118ce 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf @@ -674,127 +674,193 @@ 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. + Invalid XML: {0} + Neplatné XML: {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. - - - - 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 - 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 + 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. 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. - - - - 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 - 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 - - - - 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. - - - - Failed to change permission: -Error: {0} -Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + 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. 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. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + + 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. + V příkazu {0} chybí nastavení vstupního bodu. + + + + 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. + Pro nástroj je definovaných více příkazů. + + + + Command '{0}' uses unsupported runner '{1}'." + Příkaz {0} používá nepodporovaný spouštěč {1}. + + + + Tool '{0}' (version '{1}') is already installed. + Nástroj {0} je už nainstalovaný. + + + + 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} + + + + 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: -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: +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF -setx PATH "%PATH%;{1}" +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}" + - - Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {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}" + - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + 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}" + + + + + 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} + + + + Column maximum width must be greater than zero. + 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. + + + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf index 777d128ea..cae4ffe72 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. @@ -674,127 +674,193 @@ 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. + Invalid XML: {0} + Ungültiges XML: {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. - - - - 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 - 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 + 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. 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. - - - - 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 - 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 - - - - 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. - - - - Failed to change permission: -Error: {0} -Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + Da Sie gerade das .NET Core SDK installiert haben, müssen Sie das Terminal neu öffnen, bevor Sie das installierte Tool ausführen. 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. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + + 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. + Dem Befehl "{0}" fehlt eine Einstiegspunkteinstellung. + + + + 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. + Für das Tool wurden mehrere Befehle definiert. + + + + Command '{0}' uses unsupported runner '{1}'." + Der Befehl "{0}" verwendet die nicht unterstützte Ausführung"{1}". + + + + Tool '{0}' (version '{1}') is already installed. + Das Tool "{0}" ist bereits installiert. + + + + 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} + + + + 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: -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: +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF -setx PATH "%PATH%;{1}" +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}" + - - Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {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}" + - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + 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}" + + + + + 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} + + + + Column maximum width must be greater than zero. + 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. + + + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf index 082d2d6d0..55e770628 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf @@ -674,127 +674,193 @@ 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. + Invalid XML: {0} + XML no válido: {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. - - - - 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 - 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 + Dado que acaba de instalar el SDK de .Net Core, tendrá que cerrar sesión o reiniciarla antes de ejecutar la herramienta instalada. 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. - - - - 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 - 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 - - - - 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. - - - - Failed to change permission: -Error: {0} -Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + Dado que acaba de instalar el SDK de .Net Core, tendrá que volver a abrir la terminal antes de ejecutar la herramienta instalada. 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. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + + 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. + En el comando “{0}”, falta un valor de punto de entrada. + + + + 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. + Se ha definido más de un comando para la herramienta. + + + + Command '{0}' uses unsupported runner '{1}'." + El comando “{0}” utiliza un ejecutor que no se admite: “{1}”. + + + + Tool '{0}' (version '{1}') is already installed. + La herramienta “{0}” ya está instalada. + + + + 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} + + + + 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: -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: +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF -setx PATH "%PATH%;{1}" +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}" + - - Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {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}" + - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + 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}" + + + + + 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} + + + + Column maximum width must be greater than zero. + 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. + + + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf index 04790f3aa..5d7e2755f 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf @@ -674,127 +674,193 @@ 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. + Invalid XML: {0} + XML non valide : {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. - - - - 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 - 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 + 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é. 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. - - - - 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 - 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 - - - - 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. - - - - Failed to change permission: -Error: {0} -Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + 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é. 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é. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + + 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. + 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}. + La commande '{0}' contient un ou plusieurs caractères non valides suivants : {1}. + + + + More than one command is defined for the tool. + Plusieurs commandes sont définies pour l'outil. + + + + Command '{0}' uses unsupported runner '{1}'." + La commande '{0}' utilise un exécuteur non pris en charge '{1}'." + + + + Tool '{0}' (version '{1}') is already installed. + L'outil '{0}' est déjà installé. + + + + 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} + + + + 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: -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: +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF -setx PATH "%PATH%;{1}" +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}" + - - Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {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}" + - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + 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}" + + + + + 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} + + + + Column maximum width must be greater than zero. + 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. + + + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf index 2f43ff640..28d31da38 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf @@ -674,127 +674,193 @@ 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. + Invalid XML: {0} + XML non valido: {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. - - - - 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 - 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 + Dal momento che è stato appena installato .NET Core SDK, è necessario disconnettersi o riavviare la sessione prima di eseguire lo strumento installato. 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. - - - - 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 - 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 - - - - 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. - - - - Failed to change permission: -Error: {0} -Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + Dal momento che è stato appena installato .NET Core SDK, è necessario riaprire il terminale prima di eseguire lo strumento installato. 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. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + + 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. + Nel comando '{0}' manca un'impostazione di punto di ingresso. + + + + 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. + Per lo strumento è definito più di un comando. + + + + Command '{0}' uses unsupported runner '{1}'." + Il comando '{0}' usa il runner '{1}'." + + + + Tool '{0}' (version '{1}') is already installed. + Lo strumento '{0}' è già installato. + + + + 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} + + + + 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: -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: +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF -setx PATH "%PATH%;{1}" +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}" + - - Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {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}" + - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + 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}" + + + + + 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} + + + + Column maximum width must be greater than zero. + 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. + + + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf index b2648f41d..46d5302b0 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf @@ -674,127 +674,193 @@ プロジェクト `{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. + Invalid XML: {0} + XML が無効です: {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. - - - - 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 - 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 + .NET Core SDK をインストールしたばかりなので、インストールしたツールを実行する前に、ログアウトするか、セッションを再起動する必要があります。 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. - - - - 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 - 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 - - - - 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. - - - - Failed to change permission: -Error: {0} -Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + .NET Core SDK をインストールしたばかりなので、インストールしたツールを実行する前に、端末を再び開く必要があります。 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 をインストールしたばかりなので、インストールしたツールを実行する前に、コマンド プロンプト ウィンドウを再び開く必要があります。 - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + + Tool defines a command with a missing name setting. + ツールは、名前設定がないコマンドを定義します。 + + + + Command '{0}' is missing an entry point setting. + コマンド '{0}' にエントリ ポイント設定がありません。 + + + + Command '{0}' contains one or more of the following invalid characters: {1}. + コマンド '{0}' には次の無効な文字が 1 つまたは複数含まれています: {1}。 + + + + More than one command is defined for the tool. + ツールに対して複数のコマンドが定義されています。 + + + + Command '{0}' uses unsupported runner '{1}'." + コマンド '{0}' はサポートされていないランナー '{1}' を使用します。 + + + + Tool '{0}' (version '{1}') is already installed. + ツール '{0}' は既にインストールされています。 + + + + 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} + + + + 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: -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: +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF -setx PATH "%PATH%;{1}" +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}" + - - Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {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}" + - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + 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}" + + + + + 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} + + + + Column maximum width must be greater than zero. + 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. + + + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf index c8e626ebc..470eb0bc5 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} @@ -674,127 +674,193 @@ '{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. + Invalid XML: {0} + 잘못된 XML: {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. - - - - 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 - 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 + .NET Core SDK를 방금 설치했기 때문에 설치한 도구를 실행하기 전에 로그아웃하거나 세션을 다시 시작해야 합니다. 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. - - - - 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 - 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 - - - - 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. - - - - Failed to change permission: -Error: {0} -Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + .NET Core SDK를 방금 설치했기 때문에 설치한 도구를 실행하기 전에 터미널을 다시 열어야 합니다. 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를 방금 설치했기 때문에 설치한 도구를 실행하기 전에 명령 프롬프트 창을 다시 열어야 합니다. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + + Tool defines a command with a missing name setting. + 도구에서 이름 설정 없이 명령을 정의합니다. + + + + Command '{0}' is missing an entry point setting. + '{0}' 명령에 진입점 설정이 없습니다. + + + + Command '{0}' contains one or more of the following invalid characters: {1}. + '{0}' 명령에 다음과 같은 잘못된 문자가 하나 이상 포함되어 있습니다. {1}. + + + + More than one command is defined for the tool. + 도구에 대해 두 개 이상의 명령이 등록되어 있습니다. + + + + Command '{0}' uses unsupported runner '{1}'." + '{0}' 명령에서 지원되지 않는 실행기 '{1}'을(를) 사용합니다." + + + + Tool '{0}' (version '{1}') is already installed. + '{0}' 도구가 이미 설치되어 있습니다. + + + + 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} + + + + 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: -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: +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF -setx PATH "%PATH%;{1}" +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}" + - - Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {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}" + - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + 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}" + + + + + 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} + + + + Column maximum width must be greater than zero. + 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. + + + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf index 866502ed7..889ec7173 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf @@ -674,127 +674,193 @@ 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. + Invalid XML: {0} + Nieprawidłowy kod XML: {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. - - - - 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 - 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 + Właśnie zainstalowano zestaw .NET Core SDK, dlatego należy wylogować się lub uruchomić ponownie sesję przed uruchomieniem zainstalowanego narzędzia. 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. - - - - 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 - 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 - - - - 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. - - - - Failed to change permission: -Error: {0} -Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + Właśnie zainstalowano zestaw .NET Core SDK, dlatego należy ponownie otworzyć terminal przed uruchomieniem zainstalowanego narzędzia. 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. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + + 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. + W poleceniu „{0}” brakuje ustawienia punktu wejścia. + + + + 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. + Dla narzędzia zdefiniowano więcej niż jedno polecenie. + + + + Command '{0}' uses unsupported runner '{1}'." + Polecenie „{0}” używa nieobsługiwanego modułu uruchamiającego „{1}”. + + + + Tool '{0}' (version '{1}') is already installed. + Narzędzie „{0}” jest już zainstalowane. + + + + 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} + + + + 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: -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: +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF -setx PATH "%PATH%;{1}" +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}" + - - Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {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}" + - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + 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}" + + + + + 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} + + + + Column maximum width must be greater than zero. + 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. + + + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf b/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf index d6590ff13..7d9b411ff 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf @@ -674,127 +674,193 @@ 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. + Invalid XML: {0} + XML inválido: {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. - - - - 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 - 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 + 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. 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. - - - - 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 - 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 - - - - 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. - - - - Failed to change permission: -Error: {0} -Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + Já que você acabou de instalar o SDK do .NET Core, você ainda precisará reabrir o terminal antes de executar a ferramenta instalada. 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. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + + 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. + Há uma configuração de ponto de entrada ausente no comando '{0}'. + + + + 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. + Há mais de um comando definido para a ferramenta. + + + + Command '{0}' uses unsupported runner '{1}'." + O comando '{0}' usa um executor '{1}' sem suporte." + + + + Tool '{0}' (version '{1}') is already installed. + A ferramenta '{0}' já está instalada. + + + + 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} + + + + 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: -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: +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF -setx PATH "%PATH%;{1}" +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}" + - - Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {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}" + - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + 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}" + + + + + 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} + + + + Column maximum width must be greater than zero. + 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. + + + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf index 0c8083046..7ecf75ccc 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf @@ -674,127 +674,193 @@ Проект "{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. + Invalid XML: {0} + Недопустимый XML: {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. - - - - 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 - 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 + Так как вы только что установили пакет SDK для .NET Core, перед его запуском нужно выйти из системы или перезапустить сеанс. 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. - - - - 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 - 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 - - - - 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. - - - - Failed to change permission: -Error: {0} -Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + Так как вы только что установили пакет SDK для .NET Core, перед его запуском нужно заново открыть терминал. 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, перед его запуском нужно заново открыть окно командной строки. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + + Tool defines a command with a missing name setting. + Инструмент определяет команду, для которой не задано имя. + + + + Command '{0}' is missing an entry point setting. + В команде "{0}" не задана точка входа. + + + + Command '{0}' contains one or more of the following invalid characters: {1}. + Команда "{0}" содержит следующие недопустимы символы: {1}. + + + + More than one command is defined for the tool. + Для инструмента определено больше одной команды. + + + + Command '{0}' uses unsupported runner '{1}'." + Команда "{0}" использует неподдерживаемое средство запуска "{1}". + + + + Tool '{0}' (version '{1}') is already installed. + Инструмент "{0}" уже установлен. + + + + 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} + + + + 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: -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: +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF -setx PATH "%PATH%;{1}" +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}" + - - Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {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}" + - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + 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}" + + + + + 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} + + + + Column maximum width must be greater than zero. + 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. + + + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf index f1ff54bfb..b633fd9cd 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf @@ -674,127 +674,193 @@ `{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. + Invalid XML: {0} + Geçersiz XML: {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. - - - - 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 - 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 + .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. 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. - - - - 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 - 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 - - - - 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. - - - - Failed to change permission: -Error: {0} -Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + .NET Core SDK’sını yüklediğinizden, yüklediğiniz aracı çalıştırmadan önce terminali yeniden açmanız gerekiyor. 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. - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + + 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. + '{0}' komutunda giriş noktası ayarı eksik. + + + + 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. + Araç için birden fazla komut tanımlı. + + + + Command '{0}' uses unsupported runner '{1}'." + '{0}' komutu, desteklenmeyen '{1}' çalıştırıcısını kullanıyor." + + + + Tool '{0}' (version '{1}') is already installed. + '{0}' aracı zaten yüklü. + + + + 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} + + + + 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: -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: +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF -setx PATH "%PATH%;{1}" +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}" + - - Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {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}" + - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + 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}" + + + + + 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} + + + + Column maximum width must be greater than zero. + 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. + + + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf index bbe34189e..11fef08ba 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf @@ -674,127 +674,193 @@ 已从解决方案中移除项目“{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. + Invalid XML: {0} + 无效的 XML: {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. - - - - 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 - 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 + 由于刚安装了 .NET Core SDK,因此在运行安装的工具之前,需要注销或重新启动会话。 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. - - - - 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 - 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 - - - - 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. - - - - Failed to change permission: -Error: {0} -Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + 由于刚安装了 .NET Core SDK,因此在运行安装的工具之前,需要重新打开终端。 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,因此在运行安装的工具之前,需要重新打开命令提示符窗口。 - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + + Tool defines a command with a missing name setting. + 工具使用缺失的名称设置定义命令。 + + + + Command '{0}' is missing an entry point setting. + 命令“{0}”缺少入口点设置。 + + + + Command '{0}' contains one or more of the following invalid characters: {1}. + 命令“{0}”包含一个或多个以下无效字符: {1}。 + + + + More than one command is defined for the tool. + 为工具定义了多个命令。 + + + + Command '{0}' uses unsupported runner '{1}'." + 命令“{0}”使用不受支持的运行程序“{1}”。” + + + + Tool '{0}' (version '{1}') is already installed. + 已安装工具“{0}”。 + + + + 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} + + + + 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: -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: +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF -setx PATH "%PATH%;{1}" +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}" + - - Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {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}" + - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + 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}" + + + + + 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} + + + + Column maximum width must be greater than zero. + 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. + + + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. diff --git a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf index 314f986c0..413d99070 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf @@ -674,127 +674,193 @@ 專案 `{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. + Invalid XML: {0} + XML 無效: {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. - - - - 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 - 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 + 因為您剛才安裝了 .NET Core SDK,您必須先登出或重新啟動,才能執行您安裝的工具。 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. - - - - 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 - 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 - - - - 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. - - - - Failed to change permission: -Error: {0} -Output: {1} - Failed to change permission: -Error: {0} -Output: {1} + 因為您剛才安裝了 .NET Core SDK,您必須先重新開啟終端機,才能執行您安裝的工具。 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,您必須先重新開啟 [命令提示字元] 視窗,才能執行您安裝的工具。 - - Cannot find the tools executable path. Please ensure {0} is added to your PATH. -You can do this by running the following command: + + Tool defines a command with a missing name setting. + 工具使用了缺少的名稱設定定義命令。 + + + + Command '{0}' is missing an entry point setting. + 命令 '{0}' 缺少進入點設定。 + + + + Command '{0}' contains one or more of the following invalid characters: {1}. + 命令 '{0}' 包含下列一或多個無效的字元: {1}。 + + + + More than one command is defined for the tool. + 為工具定義了多個命令。 + + + + Command '{0}' uses unsupported runner '{1}'." + 命令 '{0}' 使用了不支援的執行器 '{1}'。" + + + + Tool '{0}' (version '{1}') is already installed. + 工具 '{0}' 已安裝。 + + + + 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} + + + + 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: -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: +cat << \EOF >> ~/.bash_profile +# Add .NET Core SDK tools +export PATH="$PATH:{0}" +EOF -setx PATH "%PATH%;{1}" +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}" + - - Package '{0}' is missing entry point file {1}. - Package '{0}' is missing entry point file {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}" + - - Package '{0}' is missing tool settings file DotnetToolSettings.xml. - Package '{0}' is missing tool settings file DotnetToolSettings.xml. + + 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}" + + + + + 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} + + + + Column maximum width must be greater than zero. + 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. + + + + Failed to find staged tool package '{0}'. + Failed to find staged tool package '{0}'. + + + + Command '{0}' has a leading dot. + Command '{0}' has a leading dot. diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index 17cf424c7..65bd1e2a9 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -75,22 +75,8 @@ - - - - - - - "version": ".*" - "version": "$(MicrosoftNETCoreAppPackageVersion)" - - @@ -193,8 +179,8 @@ TemplateLayoutDirectory=$(SdkOutputDirectory)/Templates; - TemplatePackageName=%(BundledTemplate.Identity); - TemplatePackageVersion=%(BundledTemplate.Version); + TemplateFillInPackageName=%(BundledTemplate.Identity); + TemplateFillInPackageVersion=%(BundledTemplate.Version); PreviousStageDirectory=$(PreviousStageDirectory) @@ -206,6 +192,25 @@ + + + + + DotnetToolsLayoutDirectory=$(SdkOutputDirectory)/DotnetTools; + TemplateFillInPackageName=%(BundledDotnetTools.Identity); + TemplateFillInPackageVersion=%(BundledDotnetTools.Version); + PreviousStageDirectory=$(PreviousStageDirectory) + + + + + + + + diff --git a/test/EndToEnd/GivenDotnetUsesDotnetTools.cs b/test/EndToEnd/GivenDotnetUsesDotnetTools.cs new file mode 100644 index 000000000..c9b46d6a9 --- /dev/null +++ b/test/EndToEnd/GivenDotnetUsesDotnetTools.cs @@ -0,0 +1,17 @@ +using FluentAssertions; +using Microsoft.DotNet.Tools.Test.Utilities; +using Xunit; + +namespace EndToEnd +{ + public class GivenDotnetUsesDotnetTools : TestBase + { + [Fact] + public void ThenOneDotnetToolsCanBeCalled() + { + new DotnetCommand() + .ExecuteWithCapturedOutput("dev-certs --help") + .Should().Pass(); + } + } +} diff --git a/test/InsertionTests/GivenDotnetInvokesMSBuild.cs b/test/InsertionTests/GivenDotnetInvokesMSBuild.cs new file mode 100644 index 000000000..e692692fb --- /dev/null +++ b/test/InsertionTests/GivenDotnetInvokesMSBuild.cs @@ -0,0 +1,73 @@ +// 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.Tools.Test.Utilities; +using Xunit; +using System; +using System.IO; +using FluentAssertions; +using System.Reflection; +using System.Linq; +using System.Collections.Generic; + +namespace Microsoft.DotNet.Cli.InsertionTests +{ + public class GivenRestoreDotnetTools : TestBase + { + // Assets are placed during build of this project + private static string GetDotnetToolPath() => + 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/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..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,9 +20,13 @@ - + + + + + diff --git a/test/Microsoft.DotNet.Cli.Tests.sln b/test/Microsoft.DotNet.Cli.Tests.sln index 863d564db..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 # 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 @@ -86,6 +87,12 @@ 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 +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 @@ -564,6 +571,42 @@ 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 + {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 + {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/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"); } } } 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 + + + + + + diff --git a/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFirstTimeUseNoticeSentinel.cs b/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFirstTimeUseNoticeSentinel.cs index 0957b162d..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(); } @@ -170,6 +175,16 @@ namespace Microsoft.DotNet.Configurer.UnitTests _directories.Add(path); CreateDirectoryInvoked = true; } + + public void Delete(string path, bool recursive) + { + throw new NotImplementedException(); + } + + public void Move(string source, string destination) + { + 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..8b22e15ca 100644 --- a/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFunctionReturnStringAndFakeFileSystem.cs +++ b/test/Microsoft.DotNet.Configurer.UnitTests/GivenAFunctionReturnStringAndFakeFileSystem.cs @@ -124,6 +124,16 @@ 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(); + } } private class NoPermissionDirectoryFake : IDirectory @@ -134,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(); } @@ -153,13 +168,22 @@ namespace Microsoft.DotNet.Configurer.UnitTests { throw new UnauthorizedAccessException(); } + + public void Delete(string path, bool recursive) + { + 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 23ae45c4a..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(); } @@ -197,6 +202,16 @@ namespace Microsoft.DotNet.Configurer.UnitTests { throw new UnauthorizedAccessException(); } + + public void Delete(string path, bool recursive) + { + throw new NotImplementedException(); + } + + public void Move(string source, string destination) + { + throw new NotImplementedException(); + } } private class FileMock : IFile @@ -256,6 +271,16 @@ 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(); + } } private class MockStream : MemoryStream 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..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,7 +1,7 @@  - - $(CliTargetFramework) + net461;$(CliTargetFramework) + $(CliTargetFramework) $(MicrosoftNETCoreAppPackageVersion) Exe ../../tools/Key.snk @@ -28,7 +28,7 @@ - + diff --git a/test/Microsoft.DotNet.ShellShim.Tests/FakeFile.cs b/test/Microsoft.DotNet.ShellShim.Tests/FakeFile.cs index bb9d46d6d..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,16 @@ 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(); + } + public static FakeFile Empty => new FakeFile(new Dictionary()); } } 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..17b26b38b 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,19 +33,19 @@ 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")); + CommonLocalizableStrings.EnvironmentPathLinuxManualInstructions, + "/myhome/executable/path")); } [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/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/OsxEnvironmentPathTests.cs b/test/Microsoft.DotNet.ShellShim.Tests/OsxEnvironmentPathTests.cs index 230692608..dfab68062 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,10 +33,10 @@ 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")); + CommonLocalizableStrings.EnvironmentPathOSXManualInstructions, + "/myhome/executable/path")); } [Theory] @@ -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.ShellShim.Tests/ShellShimMakerTests.cs b/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs deleted file mode 100644 index 702bace71..000000000 --- a/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs +++ /dev/null @@ -1,196 +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.Xml.Linq; -using FluentAssertions; -using Microsoft.DotNet.Cli.Utils; -using Microsoft.DotNet.TestFramework; -using Microsoft.DotNet.Tools.Test.Utilities; -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 entryPoint, string runner) - { - if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - return; - - var shellShimMaker = new ShellShimMaker(TempRoot.Root); - - var tmpFile = Path.Combine(TempRoot.Root, Path.GetRandomFileName()); - - shellShimMaker.CreateConfigFile(tmpFile, entryPoint, runner); - - new FileInfo(tmpFile).Should().Exist(); - - var generated = XDocument.Load(tmpFile); - - 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); - } - - [Fact] - public void GivenAnExecutablePathItCanGenerateShimFile() - { - var outputDll = MakeHelloWorldExecutableDll(); - - var shellShimMaker = new ShellShimMaker(TempRoot.Root); - var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); - - shellShimMaker.CreateShim( - outputDll.FullName, - shellCommandName); - var stdOut = ExecuteInShell(shellCommandName); - - 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.FullName, - 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 shellShimMaker = new ShellShimMaker(TempRoot.Root); - var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); - - shellShimMaker.CreateShim( - outputDll.FullName, - shellCommandName); - - var stdOut = ExecuteInShell(shellCommandName, arguments); - - for (int i = 0; i < expectedPassThru.Length; i++) - { - stdOut.Should().Contain($"{i} = {expectedPassThru[i]}"); - } - } - - [Fact] - public void GivenAnExecutablePathWithExistingSameNameShimItThrows() - { - var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); - - MakeNameConflictingCommand(TempRoot.Root, shellCommandName); - - var shellShimMaker = new ShellShimMaker(TempRoot.Root); - - Action a = () => shellShimMaker.EnsureCommandNameUniqueness(shellCommandName); - a.ShouldThrow() - .And.Message - .Should().Contain( - $"Failed to install tool {shellCommandName}. A command with the same name already exists."); - } - - - [Fact] - public void GivenAnExecutablePathWithoutExistingSameNameShimItShouldNotThrow() - { - var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); - - var shellShimMaker = new ShellShimMaker(TempRoot.Root); - - Action a = () => shellShimMaker.EnsureCommandNameUniqueness(shellCommandName); - a.ShouldNotThrow(); - } - - private static void MakeNameConflictingCommand(string pathToPlaceShim, string shellCommandName) - { - File.WriteAllText(Path.Combine(pathToPlaceShim, shellCommandName), string.Empty); - } - - private string ExecuteInShell(string shellCommandName, string arguments = "") - { - ProcessStartInfo processStartInfo; - - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - var file = Path.Combine(TempRoot.Root, 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 = TempRoot.Root; - processStartInfo.EnvironmentVariables["PATH"] = Path.GetDirectoryName(new Muxer().MuxerPath); - - processStartInfo.ExecuteAndCaptureOutput(out var stdOut, out var stdErr); - - stdErr.Should().BeEmpty(); - - return stdOut ?? ""; - } - - private static FileInfo 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 outputDll; - } - } -} 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.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.ToolPackage.Tests/Microsoft.DotNet.ToolPackage.Tests.csproj b/test/Microsoft.DotNet.ToolPackage.Tests/Microsoft.DotNet.ToolPackage.Tests.csproj index 736655e5b..c5d027749 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 @@ + @@ -52,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 @@ - - - diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs b/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs index 0c739f674..1d141311e 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs +++ b/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs @@ -38,16 +38,33 @@ 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"); - a.ShouldThrow() + 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}'")))); + } + + [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.ToolPackage.Tests/ToolPackageInstallerTests.cs b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs new file mode 100644 index 000000000..b487c7dfb --- /dev/null +++ b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs @@ -0,0 +1,694 @@ +// 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 NuGet.Versioning; +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, + versionRange: VersionRange.Parse(TestPackageVersion), + targetFramework: _testTargetframework); + + a.ShouldThrow().WithMessage(LocalizableStrings.ToolInstallationRestoreFailed); + + reporter.Lines.Count.Should().Be(1); + reporter.Lines[0].Should().Contain(TestPackageId.ToString()); + } + + [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, + versionRange: VersionRange.Parse(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, + versionRange: VersionRange.Parse(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, + versionRange: VersionRange.Parse(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, + versionRange: VersionRange.Parse(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 GivenAConfigFileRootDirectoryPackageInstallSucceeds() + { + var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); + + var (store, installer, reporter, fileSystem) = Setup(useMock: false); + + var package = installer.InstallPackage( + packageId: TestPackageId, + versionRange: VersionRange.Parse(TestPackageVersion), + targetFramework: _testTargetframework, + rootConfigDirectory: nugetConfigPath.GetDirectoryPath()); + + 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, + versionRange: VersionRange.Parse(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, + versionRange: VersionRange.Parse(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(new PackageId("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, + versionRange: VersionRange.Parse(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, + versionRange: VersionRange.Parse(TestPackageVersion), + targetFramework: _testTargetframework, + source: source); + + first.ShouldNotThrow(); + + installer.InstallPackage( + packageId: TestPackageId, + versionRange: VersionRange.Parse(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, + versionRange: VersionRange.Parse(TestPackageVersion), + targetFramework: _testTargetframework, + source: source); + + AssertPackageInstall(reporter, fileSystem, package, store); + + Action secondCall = () => installer.InstallPackage( + packageId: TestPackageId, + versionRange: VersionRange.Parse(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.ToString()).Value) + .Should() + .BeTrue(); + + package.Uninstall(); + + fileSystem + .Directory + .EnumerateFileSystemEntries(store.Root.WithSubDirectories(ToolPackageStore.StagingDirectory).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, + versionRange: VersionRange.Parse(TestPackageVersion), + targetFramework: _testTargetframework, + source: source); + + AssertPackageInstall(reporter, fileSystem, package, store); + + package.Uninstall(); + + store.EnumeratePackages().Should().BeEmpty(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void GivenAnInstalledPackageUninstallRollsbackWhenTransactionFails(bool testMockBehaviorIsInSync) + { + var source = GetTestLocalFeedPath(); + + var (store, installer, reporter, fileSystem) = Setup( + useMock: testMockBehaviorIsInSync, + feeds: GetMockFeedsForSource(source)); + + var package = installer.InstallPackage( + packageId: TestPackageId, + versionRange: VersionRange.Parse(TestPackageVersion), + targetFramework: _testTargetframework, + source: source); + + AssertPackageInstall(reporter, fileSystem, package, store); + + using (var scope = new TransactionScope( + TransactionScopeOption.Required, + TimeSpan.Zero)) + { + package.Uninstall(); + + store.EnumeratePackages().Should().BeEmpty(); + } + + package = store.EnumeratePackageVersions(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, + versionRange: VersionRange.Parse(TestPackageVersion), + targetFramework: _testTargetframework, + source: source); + + AssertPackageInstall(reporter, fileSystem, package, store); + + using (var scope = new TransactionScope( + TransactionScopeOption.Required, + TimeSpan.Zero)) + { + package.Uninstall(); + scope.Complete(); + } + + 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(); + } + + [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, + IToolPackage package, + IToolPackageStore store) + { + reporter.Lines.Should().BeEmpty(); + + package.Id.Should().Be(TestPackageId); + package.Version.ToNormalizedString().Should().Be(TestPackageVersion); + package.PackageDirectory.Value.Should().Contain(store.Root.Value); + + 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"); + 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) != ToolPackageStore.StagingDirectory); + + fileSystem + .Directory + .EnumerateFileSystemEntries(store.Root.WithSubDirectories(ToolPackageStore.StagingDirectory).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.ToString(), + 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.ToString(), + Version = TestPackageVersion + } + } + } + }; + } + + private static IEnumerable GetOfflineMockFeed() + { + return new MockFeed[] + { + new MockFeed + { + Type = MockFeedType.OfflineFeed, + Uri = GetTestLocalFeedPath(), + Packages = new List + { + new MockFeedPackage + { + PackageId = TestPackageId.ToString(), + 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(Path.GetFullPath(TempRoot.Root), 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 static readonly PackageId TestPackageId = new PackageId("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 4e948966e..000000000 --- a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageObtainerTests.cs +++ /dev/null @@ -1,312 +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.IO; -using System.Reflection; -using FluentAssertions; -using Microsoft.DotNet.Tools.Test.Utilities; -using Microsoft.Extensions.EnvironmentAbstractions; -using Microsoft.DotNet.Cli; -using Microsoft.DotNet.Tools.Install.Tool; -using Xunit; - -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); - - Action a = () => packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - targetframework: _testTargetframework); - - a.ShouldThrow(); - } - - [Fact] - public void GivenOfflineFeedWhenCallItCanDownloadThePackage() - { - 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(), - packageToProjectFileAdder: new PackageToProjectFileAdder(), - projectRestorer: new ProjectRestorer()); - - ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = - packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - targetframework: _testTargetframework); - - var executable = toolConfigurationAndExecutablePath - .Executable; - - File.Exists(executable.Value) - .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"); - } - - [Fact] - public void GivenNugetConfigAndPackageNameAndVersionAndTargetFrameworkWhenCallItCreateAssetFile() - { - 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); - - /* - 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"); - } - - [Fact] - public void GivenAllButNoNugetConfigFilePathItCanDownloadThePackage() - { - 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); - - var packageObtainer = - new ToolPackageObtainer( - new DirectoryPath(toolsPath), - new DirectoryPath("no such path"), - () => uniqueTempProjectPath, - new Lazy(), - new PackageToProjectFileAdder(), - new ProjectRestorer()); - ToolConfigurationAndExecutablePath toolConfigurationAndExecutablePath = - packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - targetframework: _testTargetframework); - - var executable = toolConfigurationAndExecutablePath.Executable; - - File.Exists(executable.Value) - .Should() - .BeTrue(executable + " should have the executable"); - } - - [Fact] - public void GivenAllButNoPackageVersionItCanDownloadThePackage() - { - 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); - - var executable = toolConfigurationAndExecutablePath.Executable; - - File.Exists(executable.Value) - .Should() - .BeTrue(executable + " should have the executable"); - } - - [Fact] - public void GivenAllButNoPackageVersionAndInvokeTwiceItShouldNotThrow() - { - var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); - var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); - - var packageObtainer = - ConstructDefaultPackageObtainer(toolsPath); - - packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - nugetconfig: nugetConfigPath, - targetframework: _testTargetframework); - - Action secondCall = () => packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - nugetconfig: nugetConfigPath, - targetframework: _testTargetframework); - - secondCall.ShouldNotThrow(); - } - - - [Fact] - public void GivenAllButNoTargetFrameworkItCanDownloadThePackage() - { - var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); - var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); - - var 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, - packageVersion: TestPackageVersion, - nugetconfig: nugetConfigPath); - - var executable = toolConfigurationAndExecutablePath.Executable; - - File.Exists(executable.Value) - .Should() - .BeTrue(executable + " should have the executable"); - } - - [Fact] - public void GivenNonExistentNugetConfigFileItThrows() - { - 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); - - a.ShouldThrow() - .And - .Message.Should().Contain("does not exist"); - } - - [Fact] - public void GivenASourceItCanObtainThePackageFromThatSource() - { - var toolsPath = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); - - var packageObtainer = ConstructDefaultPackageObtainer(toolsPath); - var toolConfigurationAndExecutableDirectory = packageObtainer.ObtainAndReturnExecutablePath( - packageId: TestPackageId, - packageVersion: TestPackageVersion, - targetframework: _testTargetframework, - source: GetTestLocalFeedPath()); - - var executable = toolConfigurationAndExecutableDirectory.Executable; - - File.Exists(executable.Value) - .Should() - .BeTrue(executable + " should have the executable"); - } - - 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 ToolPackageObtainer ConstructDefaultPackageObtainer(string toolsPath) - { - return new ToolPackageObtainer( - new DirectoryPath(toolsPath), - new DirectoryPath("no such path"), - GetUniqueTempProjectPathEachTest, - new Lazy(), - new PackageToProjectFileAdder(), - new ProjectRestorer()); - } - - 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/EnvironmentPathInstructionMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/EnvironmentPathInstructionMock.cs new file mode 100644 index 000000000..33f8d04d1 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/EnvironmentPathInstructionMock.cs @@ -0,0 +1,40 @@ +// 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 const string MockInstructionText = "MOCK INSTRUCTION"; + + 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(MockInstructionText); + } + } + + 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..a6fd5c5c2 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/MockFeedType.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. + +namespace Microsoft.DotNet.Tools.Tests.ComponentMocks +{ + public enum MockFeedType + { + FeedFromLookUpNugetConfig, + ExplicitNugetConfig, + 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..7161dafb6 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ProjectRestorerMock.cs @@ -0,0 +1,166 @@ +// 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; +using NuGet.Versioning; + +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; + VersionRange versionRange; + 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]; + versionRange = VersionRange.Parse(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, + versionRange, + nugetConfig, + source); + + var packageVersion = feedPackage.Version; + targetFramework = string.IsNullOrEmpty(targetFramework) ? "targetFramework" : targetFramework; + + var fakeExecutableSubDirectory = Path.Combine( + packageId.ToLowerInvariant(), + packageVersion.ToLowerInvariant(), + "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, + VersionRange versionRange = null, + FilePath? nugetConfig = null, + string source = null) + { + var allPackages = _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(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) + { + if (_reporter != null) + { + _reporter.WriteLine($"Error: failed to restore package {packageId}."); + } + throw new ToolPackageException(LocalizableStrings.ToolInstallationRestoreFailed); + } + + return package; + } + + private static bool MatchPackage(MockFeedPackage p, string packageId, VersionRange versionRange) + { + if (string.Compare(p.PackageId, packageId, StringComparison.CurrentCultureIgnoreCase) != 0) + { + return false; + } + + return versionRange == null || + versionRange.FindBestMatch(new[] { NuGetVersion.Parse(p.Version) }) != null; + } + } +} 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/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..2d058d6fb --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageInstallerMock.cs @@ -0,0 +1,106 @@ +// 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; +using NuGet.Versioning; + +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( + PackageId packageId, + VersionRange versionRange = null, + string targetFramework = null, + FilePath? nugetConfig = null, + DirectoryPath? rootConfigDirectory = null, + string source = null, + string verbosity = null) + { + var packageRootDirectory = _store.GetRootPackageDirectory(packageId); + string rollbackDirectory = null; + + return TransactionalAction.Run( + action: () => { + var stageDirectory = _store.GetRandomStagingDirectory(); + _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}:{versionRange?.ToString("S", new VersionRangeFormatter()) ?? "*"}:{targetFramework}"); + + // Perform a restore on the fake project + _projectRestorer.Restore( + tempProject, + stageDirectory, + nugetConfig, + source, + verbosity); + + if (_installCallback != null) + { + _installCallback(); + } + + 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, + version.ToNormalizedString())); + } + + _fileSystem.Directory.CreateDirectory(packageRootDirectory.Value); + _fileSystem.Directory.Move(stageDirectory.Value, packageDirectory.Value); + rollbackDirectory = packageDirectory.Value; + + return new ToolPackageMock(_fileSystem, packageId, version, 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..6ad826441 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageMock.cs @@ -0,0 +1,128 @@ +// 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; +using NuGet.Versioning; + +namespace Microsoft.DotNet.Tools.Tests.ComponentMocks +{ + internal class ToolPackageMock : IToolPackage + { + private IFileSystem _fileSystem; + private Lazy> _commands; + private Action _uninstallCallback; + + public ToolPackageMock( + IFileSystem fileSystem, + PackageId id, + NuGetVersion version, + DirectoryPath packageDirectory, + Action uninstallCallback = null) + { + _fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)); + Id = id; + Version = version ?? throw new ArgumentNullException(nameof(version)); + PackageDirectory = packageDirectory; + _commands = new Lazy>(GetCommands); + _uninstallCallback = uninstallCallback; + } + + public PackageId Id { get; private set; } + + public NuGetVersion Version { 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, + Id, + 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, + Id, + ex.Message), + ex); + } + } + } +} 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..e8219560c --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageStoreMock.cs @@ -0,0 +1,118 @@ +// 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; +using NuGet.Versioning; + +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 DirectoryPath GetRandomStagingDirectory() + { + 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; + } + + foreach (var subdirectory in _fileSystem.Directory.EnumerateFileSystemEntries(packageRootDirectory.Value)) + { + yield return new ToolPackageMock( + _fileSystem, + packageId, + 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/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/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 diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Mock/FileSystemMockBuilder.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Mock/FileSystemMockBuilder.cs index cda8c704b..83043dec9 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Mock/FileSystemMockBuilder.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Mock/FileSystemMockBuilder.cs @@ -106,6 +106,32 @@ 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)) + { + return; + } + + _files.Remove(path); + } } private class DirectoryMock : IDirectory @@ -124,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) @@ -141,7 +179,51 @@ 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) + { + 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); + } + } + + 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); + } } } 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/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-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 diff --git a/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs b/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs index 6cfb9a11b..46d5303a0 100644 --- a/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs +++ b/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs @@ -34,12 +34,14 @@ 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. 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-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-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"; 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/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; diff --git a/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs b/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs new file mode 100644 index 000000000..a09ad4afa --- /dev/null +++ b/test/dotnet.Tests/CommandTests/InstallToolCommandTests.cs @@ -0,0 +1,449 @@ +// 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.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; +using Xunit; +using Parser = Microsoft.DotNet.Cli.Parser; +using System.Runtime.InteropServices; +using LocalizableStrings = Microsoft.DotNet.Tools.Install.Tool.LocalizableStrings; +using Microsoft.DotNet.ShellShim; + +namespace Microsoft.DotNet.Tests.Commands +{ + public class InstallToolCommandTests + { + private readonly IFileSystem _fileSystem; + private readonly IToolPackageStore _toolPackageStore; + private readonly CreateShellShimRepository _createShellShimRepository; + private readonly CreateToolPackageStoreAndInstaller _createToolPackageStoreAndInstaller; + private readonly EnvironmentPathInstructionMock _environmentPathInstructionMock; + private readonly AppliedOption _appliedCommand; + 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"; + private const string PackageVersion = "1.0.4"; + + public InstallToolCommandTests() + { + _reporter = new BufferedReporter(); + _fileSystem = new FileSystemMockBuilder().Build(); + _toolPackageStore = new ToolPackageStoreMock(new DirectoryPath(PathToPlacePackages), _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"]; + var parser = Parser.Instance; + _parseResult = parser.ParseFrom("dotnet install", new[] {"tool", PackageId}); + } + + [Fact] + public void WhenRunWithPackageIdItShouldCreateValidShim() + { + var installToolCommand = new InstallToolCommand(_appliedCommand, + _parseResult, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, + _environmentPathInstructionMock, + _reporter); + + installToolCommand.Execute().Should().Be(0); + + // It is hard to simulate shell behavior. Only Assert shim can point to executable dll + _fileSystem.File.Exists(ExpectedCommandPath()).Should().BeTrue(); + var deserializedFakeShim = JsonConvert.DeserializeObject( + _fileSystem.File.ReadAllText(ExpectedCommandPath())); + + _fileSystem.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 {PackageId} --source {sourcePath}"); + AppliedOption appliedCommand = result["dotnet"]["install"]["tool"]; + ParseResult parseResult = + Parser.Instance.ParseFrom("dotnet install", new[] { "tool", PackageId, "--source", sourcePath }); + + + var toolToolPackageInstaller = CreateToolPackageInstaller( + feeds: new MockFeed[] { + new MockFeed + { + Type = MockFeedType.Source, + Uri = sourcePath, + Packages = new List + { + new MockFeedPackage + { + PackageId = PackageId, + Version = PackageVersion + } + } + } + }); + + var installToolCommand = new InstallToolCommand(appliedCommand, + parseResult, + (_) => (_toolPackageStore, toolToolPackageInstaller), + _createShellShimRepository, + _environmentPathInstructionMock, + _reporter); + + installToolCommand.Execute().Should().Be(0); + + // It is hard to simulate shell behavior. Only Assert shim can point to executable dll + _fileSystem.File.Exists(ExpectedCommandPath()) + .Should().BeTrue(); + var deserializedFakeShim = + JsonConvert.DeserializeObject( + _fileSystem.File.ReadAllText(ExpectedCommandPath())); + _fileSystem.File.Exists(deserializedFakeShim.ExecutablePath).Should().BeTrue(); + } + + [Fact] + public void WhenRunWithPackageIdItShouldShowPathInstruction() + { + var installToolCommand = new InstallToolCommand(_appliedCommand, + _parseResult, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, + _environmentPathInstructionMock, + _reporter); + + installToolCommand.Execute().Should().Be(0); + + _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, toolPackageInstaller), + _createShellShimRepository, + _environmentPathInstructionMock, + _reporter); + + Action a = () => installToolCommand.Execute(); + + a.ShouldThrow().And.Message + .Should().Contain( + "Simulated error" + Environment.NewLine + + string.Format(LocalizableStrings.ToolInstallationFailed, PackageId)); + + _fileSystem.Directory.Exists(Path.Combine(PathToPlacePackages, PackageId)).Should().BeFalse(); + } + + [Fact] + public void GivenCreateShimItShouldHaveNoBrokenFolderOnDisk() + { + _fileSystem.File.CreateEmptyFile(ExpectedCommandPath()); // Create conflict shim + + var installToolCommand = new InstallToolCommand( + _appliedCommand, + _parseResult, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, + _environmentPathInstructionMock, + _reporter); + + Action a = () => installToolCommand.Execute(); + + a.ShouldThrow().And.Message + .Should().Contain(string.Format( + CommonLocalizableStrings.ShellShimConflict, + ProjectRestorerMock.FakeCommandName)); + + _fileSystem.Directory.Exists(Path.Combine(PathToPlacePackages, PackageId)).Should().BeFalse(); + } + + [Fact] + public void GivenInCorrectToolConfigurationWhenRunWithPackageIdItShouldFail() + { + var toolPackageInstaller = + CreateToolPackageInstaller( + installCallback: () => throw new ToolConfigurationException("Simulated error")); + + var installToolCommand = new InstallToolCommand( + _appliedCommand, + _parseResult, + (_) => (_toolPackageStore, toolPackageInstaller), + _createShellShimRepository, + _environmentPathInstructionMock, + _reporter); + + Action a = () => installToolCommand.Execute(); + + a.ShouldThrow().And.Message + .Should().Contain( + string.Format( + LocalizableStrings.InvalidToolConfiguration, + "Simulated error") + Environment.NewLine + + string.Format(LocalizableStrings.ToolInstallationFailedContactAuthor, PackageId) + ); + } + + [Fact] + public void WhenRunWithPackageIdItShouldShowSuccessMessage() + { + var installToolCommand = new InstallToolCommand( + _appliedCommand, + _parseResult, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, + 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 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, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, + 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, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, + 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, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, + 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, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, + new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true), + _reporter); + + Action a = () => installToolCommand.Execute(); + + 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] + 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, + _createToolPackageStoreAndInstaller, + _createShellShimRepository, + 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 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) + { + return new ToolPackageInstallerMock( + fileSystem: _fileSystem, + store: _toolPackageStore, + projectRestorer: new ProjectRestorerMock( + fileSystem: _fileSystem, + reporter: _reporter, + feeds: feeds), + installCallback: installCallback); + } + + private static string ExpectedCommandPath() + { + var extension = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : string.Empty; + return Path.Combine( + "pathToPlace", + ProjectRestorerMock.FakeCommandName + extension); + } + } +} 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/CommandTests/UninstallToolCommandTests.cs b/test/dotnet.Tests/CommandTests/UninstallToolCommandTests.cs new file mode 100644 index 000000000..813a70ec4 --- /dev/null +++ b/test/dotnet.Tests/CommandTests/UninstallToolCommandTests.cs @@ -0,0 +1,201 @@ +// 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 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(); + _environmentPathInstructionMock = new EnvironmentPathInstructionMock(_reporter, ShimsDirectory); + } + + [Fact] + public void GivenANonExistentPackageItErrors() + { + var packageId = "does.not.exist"; + var command = CreateUninstallCommand($"-g {packageId}"); + + Action a = () => command.Execute(); + + a.ShouldThrow().And.Message + .Should().Contain( + string.Format( + LocalizableStrings.ToolNotInstalled, + packageId)); + } + + [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(); + + Action a = () => CreateUninstallCommand( + options: $"-g {PackageId}", + uninstallCallback: () => throw new IOException("simulated error")) + .Execute(); + + a.ShouldThrow() + .And.Message + .Should().Contain( + string.Format( + CommonLocalizableStrings.FailedToUninstallToolPackage, + PackageId, + "simulated error")); + + _fileSystem.Directory.Exists(packageDirectory.Value).Should().BeTrue(); + _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, packageInstallerMock), + (_) => new ShellShimRepositoryMock(new DirectoryPath(ShimsDirectory), _fileSystem), + _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), + (_) => new ShellShimRepositoryMock(new DirectoryPath(ShimsDirectory), _fileSystem), + _reporter); + } + } +} 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/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs b/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs index 6f2b1db8f..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() { - string firstTimeNonVerbUseMessage = Cli.Utils.LocalizableStrings.DotNetCommandLineTools; + string firstTimeNonVerbUseMessage = Cli.Utils.LocalizableStrings.DotNetSdkInfoLabel; _firstDotnetNonVerbUseCommandResult.StdOut .Should() diff --git a/test/dotnet.Tests/ParserTests/InstallToolParserTests.cs b/test/dotnet.Tests/ParserTests/InstallToolParserTests.cs index 625f110c1..1c9b54e64 100644 --- a/test/dotnet.Tests/ParserTests/InstallToolParserTests.cs +++ b/test/dotnet.Tests/ParserTests/InstallToolParserTests.cs @@ -68,5 +68,26 @@ 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); + } + + [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"); + } + } +} 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"); + } + } +} 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); + } + } +} 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) diff --git a/test/dotnet.Tests/dotnet.Tests.csproj b/test/dotnet.Tests/dotnet.Tests.csproj index 6095d1a0e..7d080f445 100644 --- a/test/dotnet.Tests/dotnet.Tests.csproj +++ b/test/dotnet.Tests/dotnet.Tests.csproj @@ -71,6 +71,7 @@ + @@ -80,7 +81,9 @@ + + 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")]