diff --git a/README.md b/README.md index c8601e119..df0cbc3f5 100644 --- a/README.md +++ b/README.md @@ -209,4 +209,3 @@ License ------- By downloading the .zip you are agreeing to the terms in the project [EULA](https://aka.ms/dotnet-core-eula). - diff --git a/build/Branding.props b/build/Branding.props index 282dae5b7..a13a74294 100644 --- a/build/Branding.props +++ b/build/Branding.props @@ -1,7 +1,7 @@ cli - Microsoft .NET Core SDK 2.1.300 - Preview + Microsoft .NET Core SDK $(CliBrandingVersion) .NET Standard Support for Visual Studio 2015 Microsoft .NET Core Runtime 2.1.0 - Preview Microsoft .NET Core Host 2.1.0 - Preview diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 400039734..e3de5db30 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -1,10 +1,10 @@ - 2.1.0-preview2-30431 + 2.1.0-preview2-30475 2.1.0-preview3-26405-02 $(MicrosoftNETCoreAppPackageVersion) - 15.7.0-preview-000124 + 15.7.0-preview-000127 $(MicrosoftBuildPackageVersion) $(MicrosoftBuildPackageVersion) $(MicrosoftBuildPackageVersion) @@ -21,7 +21,7 @@ $(MicrosoftNETSdkWebPackageVersion) $(MicrosoftNETSdkWebPackageVersion) 1.0.1-beta3-20180104-1263555 - 1.0.1-beta3-20180104-1263555 + $(MicrosoftDotNetCommonItemTemplatesPackageVersion) 1.0.1-beta3-20180227-1423805 1.0.0-beta3-20171204-315 $(MicrosoftTemplateEngineCliPackageVersion) diff --git a/build/NugetConfigFile.targets b/build/NugetConfigFile.targets index d491ebee2..aa0b563ae 100644 --- a/build/NugetConfigFile.targets +++ b/build/NugetConfigFile.targets @@ -49,7 +49,7 @@ 300 preview3 - $(VersionMajor).$(VersionMinor).$(VersionPatch)-$(ReleaseSuffix) - $(VersionMajor).$(VersionMinor).$(VersionPatch).$(CommitCount) - $(VersionMajor).$(VersionMinor).$(VersionPatch) + $(VersionMajor).$(VersionMinor).$(VersionPatch) + $(CliVersionNoSuffix)-$(ReleaseSuffix) + $(CliVersionNoSuffix) - $(ReleaseSuffix) + $(CliVersionNoSuffix).$(CommitCount) + $(CliVersionNoSuffix) - $(ReleaseSuffix)-$(CommitCount) + $(ReleaseSuffix)-$(CommitCount) - $(VersionMajor).$(VersionMinor).$(VersionPatch)-$(ReleaseSuffix)-$(CommitCount) + $(CliVersionNoSuffix)-$(ReleaseSuffix)-$(CommitCount) - $(FullNugetVersion) - $(VersionMajor).$(VersionMinor).$(VersionPatch) + $(FullNugetVersion) + $(CliVersionNoSuffix) $(NugetVersion) - $(NugetVersion) + $(NugetVersion) diff --git a/build/package/Installer.DEB.proj b/build/package/Installer.DEB.proj index f8c741964..0e516f440 100644 --- a/build/package/Installer.DEB.proj +++ b/build/package/Installer.DEB.proj @@ -53,8 +53,8 @@ + '$(Architecture)' + '$(MicrosoftNETCoreAppPackageVersion)' + '$(AspNetCoreVersion)'" /> $(SdkPkgScriptsDirectory)/postinstall $(PkgIntermediateDirectory)/scripts $(SdkPkgDestinationScriptsDirectory)/postinstall - $(SdkPkgSourcesRootDirectory)/resources + $(PkgIntermediateDirectory)/resources $(SdkPkgSourcesRootDirectory)/Distribution-Template $(PkgIntermediateDirectory)/CLI-SDK-Formatted-Distribution-Template.xml @@ -61,6 +61,16 @@ $(SdkVersion) + + + $(SdkVersion) + + + $(MicrosoftNETCoreAppPackageVersion) + + + $(AspNetCoreVersion) + @@ -69,6 +79,8 @@ + + @@ -77,7 +89,7 @@ - + @@ -91,11 +103,17 @@ DestinationFiles="@(AspNetRuntimeFilesInput->'$(SdkLayoutOutputDirectory)/%(RecursiveDir)%(FileName)%(Extension)')" /> + + @@ -130,8 +148,8 @@ diff --git a/build/package/Installer.RPM.targets b/build/package/Installer.RPM.targets index 115d6070f..9302cf5ea 100644 --- a/build/package/Installer.RPM.targets +++ b/build/package/Installer.RPM.targets @@ -104,8 +104,8 @@ - @@ -21,8 +21,8 @@ diff --git a/build_projects/dotnet-cli-build/ReplaceFileContents.cs b/build_projects/dotnet-cli-build/ReplaceFileContents.cs index b0baf4179..130550aba 100644 --- a/build_projects/dotnet-cli-build/ReplaceFileContents.cs +++ b/build_projects/dotnet-cli-build/ReplaceFileContents.cs @@ -3,6 +3,7 @@ using System; using System.IO; +using System.Linq; using System.Text.RegularExpressions; using Microsoft.Build.Utilities; using Microsoft.Build.Framework; @@ -28,10 +29,10 @@ namespace Microsoft.DotNet.Cli.Build public class ReplaceFileContents : Task { [Required] - public string InputFile { get; set; } + public ITaskItem[] InputFiles { get; set; } [Required] - public string DestinationFile { get; set; } + public ITaskItem[] DestinationFiles { get; set; } public ITaskItem[] ReplacementItems { get; set; } @@ -55,19 +56,36 @@ namespace Microsoft.DotNet.Cli.Build throw new Exception($"Expected {nameof(ReplacementPatterns)} (length {ReplacementPatterns.Length}) and {nameof(ReplacementStrings)} (length {ReplacementStrings.Length}) to have the same length."); } - if (!File.Exists(InputFile)) + if (InputFiles.Length != DestinationFiles.Length) { - throw new FileNotFoundException($"Expected file {InputFile} was not found."); + throw new Exception($"Expected {nameof(InputFiles)} (length {InputFiles.Length}) and {nameof(DestinationFiles)} (length {DestinationFiles.Length}) to have the same length."); } - string inputFileText = File.ReadAllText(InputFile); - string outputFileText = ReplacePatterns(inputFileText); + var filesNotFound = InputFiles.Where(i => !File.Exists(i.ItemSpec)).Select(i => i.ItemSpec); + if (filesNotFound.Any()) + { + var filesNotFoundString = string.Join(",", filesNotFound); + throw new FileNotFoundException($"Expected files where not found: {filesNotFoundString}"); + } - WriteOutputFile(outputFileText); + Log.LogMessage(MessageImportance.High, $"ReplacingContents for `{InputFiles.Length}` files."); + + for (var i = 0; i < InputFiles.Length; i++) + { + ReplaceContents(InputFiles[i].ItemSpec, DestinationFiles[i].ItemSpec); + } return true; } + public void ReplaceContents(string inputFile, string destinationFile) + { + string inputFileText = File.ReadAllText(inputFile); + string outputFileText = ReplacePatterns(inputFileText); + + WriteOutputFile(destinationFile, outputFileText); + } + public string ReplacePatterns(string inputFileText) { var outText = inputFileText; @@ -92,15 +110,18 @@ namespace Microsoft.DotNet.Cli.Build return outText; } - public void WriteOutputFile(string outputFileText) + public void WriteOutputFile(string destinationFile, string outputFileText) { - var destinationDirectory = Path.GetDirectoryName(DestinationFile); + var destinationDirectory = Path.GetDirectoryName(destinationFile); + Log.LogMessage(MessageImportance.High, $"Destination Directory: {destinationDirectory}"); if (!Directory.Exists(destinationDirectory)) { + Log.LogMessage(MessageImportance.High, $"Destination Directory `{destinationDirectory}` does not exist. Creating..."); Directory.CreateDirectory(destinationDirectory); } - File.WriteAllText(DestinationFile, outputFileText); + Log.LogMessage(MessageImportance.High, $"Writing file: {destinationFile}"); + File.WriteAllText(destinationFile, outputFileText); } } } diff --git a/packaging/osx/clisdk/resources/cs.lproj/conclusion.html b/packaging/osx/clisdk/resources/cs.lproj/conclusion.html index 7d91816fd..03fc060e4 100644 --- a/packaging/osx/clisdk/resources/cs.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/cs.lproj/conclusion.html @@ -7,9 +7,9 @@

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

    -
  • .NET Core SDK 2.1.300
  • -
  • .NET Core Runtime 2.1.0
  • -
  • ASP.NET Core Runtime 2.1.0
  • +
  • .NET Core SDK {DOTNETSDKVERSION}
  • +
  • .NET Core Runtime {DOTNETRUNTIMEVERSION}
  • +
  • ASP.NET Core Runtime {ASPNETCOREVERSION}

diff --git a/packaging/osx/clisdk/resources/de.lproj/conclusion.html b/packaging/osx/clisdk/resources/de.lproj/conclusion.html index 7d91816fd..03fc060e4 100644 --- a/packaging/osx/clisdk/resources/de.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/de.lproj/conclusion.html @@ -7,9 +7,9 @@

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

    -
  • .NET Core SDK 2.1.300
  • -
  • .NET Core Runtime 2.1.0
  • -
  • ASP.NET Core Runtime 2.1.0
  • +
  • .NET Core SDK {DOTNETSDKVERSION}
  • +
  • .NET Core Runtime {DOTNETRUNTIMEVERSION}
  • +
  • ASP.NET Core Runtime {ASPNETCOREVERSION}

diff --git a/packaging/osx/clisdk/resources/en.lproj/conclusion.html b/packaging/osx/clisdk/resources/en.lproj/conclusion.html index 7d91816fd..03fc060e4 100644 --- a/packaging/osx/clisdk/resources/en.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/en.lproj/conclusion.html @@ -7,9 +7,9 @@

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

    -
  • .NET Core SDK 2.1.300
  • -
  • .NET Core Runtime 2.1.0
  • -
  • ASP.NET Core Runtime 2.1.0
  • +
  • .NET Core SDK {DOTNETSDKVERSION}
  • +
  • .NET Core Runtime {DOTNETRUNTIMEVERSION}
  • +
  • ASP.NET Core Runtime {ASPNETCOREVERSION}

diff --git a/packaging/osx/clisdk/resources/es.lproj/conclusion.html b/packaging/osx/clisdk/resources/es.lproj/conclusion.html index 7d91816fd..03fc060e4 100644 --- a/packaging/osx/clisdk/resources/es.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/es.lproj/conclusion.html @@ -7,9 +7,9 @@

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

    -
  • .NET Core SDK 2.1.300
  • -
  • .NET Core Runtime 2.1.0
  • -
  • ASP.NET Core Runtime 2.1.0
  • +
  • .NET Core SDK {DOTNETSDKVERSION}
  • +
  • .NET Core Runtime {DOTNETRUNTIMEVERSION}
  • +
  • ASP.NET Core Runtime {ASPNETCOREVERSION}

diff --git a/packaging/osx/clisdk/resources/fr.lproj/conclusion.html b/packaging/osx/clisdk/resources/fr.lproj/conclusion.html index 7d91816fd..03fc060e4 100644 --- a/packaging/osx/clisdk/resources/fr.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/fr.lproj/conclusion.html @@ -7,9 +7,9 @@

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

    -
  • .NET Core SDK 2.1.300
  • -
  • .NET Core Runtime 2.1.0
  • -
  • ASP.NET Core Runtime 2.1.0
  • +
  • .NET Core SDK {DOTNETSDKVERSION}
  • +
  • .NET Core Runtime {DOTNETRUNTIMEVERSION}
  • +
  • ASP.NET Core Runtime {ASPNETCOREVERSION}

diff --git a/packaging/osx/clisdk/resources/it.lproj/conclusion.html b/packaging/osx/clisdk/resources/it.lproj/conclusion.html index 7d91816fd..03fc060e4 100644 --- a/packaging/osx/clisdk/resources/it.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/it.lproj/conclusion.html @@ -7,9 +7,9 @@

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

    -
  • .NET Core SDK 2.1.300
  • -
  • .NET Core Runtime 2.1.0
  • -
  • ASP.NET Core Runtime 2.1.0
  • +
  • .NET Core SDK {DOTNETSDKVERSION}
  • +
  • .NET Core Runtime {DOTNETRUNTIMEVERSION}
  • +
  • ASP.NET Core Runtime {ASPNETCOREVERSION}

diff --git a/packaging/osx/clisdk/resources/ja.lproj/conclusion.html b/packaging/osx/clisdk/resources/ja.lproj/conclusion.html index 7d91816fd..03fc060e4 100644 --- a/packaging/osx/clisdk/resources/ja.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/ja.lproj/conclusion.html @@ -7,9 +7,9 @@

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

    -
  • .NET Core SDK 2.1.300
  • -
  • .NET Core Runtime 2.1.0
  • -
  • ASP.NET Core Runtime 2.1.0
  • +
  • .NET Core SDK {DOTNETSDKVERSION}
  • +
  • .NET Core Runtime {DOTNETRUNTIMEVERSION}
  • +
  • ASP.NET Core Runtime {ASPNETCOREVERSION}

diff --git a/packaging/osx/clisdk/resources/ko.lproj/conclusion.html b/packaging/osx/clisdk/resources/ko.lproj/conclusion.html index 7d91816fd..03fc060e4 100644 --- a/packaging/osx/clisdk/resources/ko.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/ko.lproj/conclusion.html @@ -7,9 +7,9 @@

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

    -
  • .NET Core SDK 2.1.300
  • -
  • .NET Core Runtime 2.1.0
  • -
  • ASP.NET Core Runtime 2.1.0
  • +
  • .NET Core SDK {DOTNETSDKVERSION}
  • +
  • .NET Core Runtime {DOTNETRUNTIMEVERSION}
  • +
  • ASP.NET Core Runtime {ASPNETCOREVERSION}

diff --git a/packaging/osx/clisdk/resources/pl.lproj/conclusion.html b/packaging/osx/clisdk/resources/pl.lproj/conclusion.html index 7d91816fd..03fc060e4 100644 --- a/packaging/osx/clisdk/resources/pl.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/pl.lproj/conclusion.html @@ -7,9 +7,9 @@

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

    -
  • .NET Core SDK 2.1.300
  • -
  • .NET Core Runtime 2.1.0
  • -
  • ASP.NET Core Runtime 2.1.0
  • +
  • .NET Core SDK {DOTNETSDKVERSION}
  • +
  • .NET Core Runtime {DOTNETRUNTIMEVERSION}
  • +
  • ASP.NET Core Runtime {ASPNETCOREVERSION}

diff --git a/packaging/osx/clisdk/resources/pt-br.lproj/conclusion.html b/packaging/osx/clisdk/resources/pt-br.lproj/conclusion.html index 7d91816fd..03fc060e4 100644 --- a/packaging/osx/clisdk/resources/pt-br.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/pt-br.lproj/conclusion.html @@ -7,9 +7,9 @@

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

    -
  • .NET Core SDK 2.1.300
  • -
  • .NET Core Runtime 2.1.0
  • -
  • ASP.NET Core Runtime 2.1.0
  • +
  • .NET Core SDK {DOTNETSDKVERSION}
  • +
  • .NET Core Runtime {DOTNETRUNTIMEVERSION}
  • +
  • ASP.NET Core Runtime {ASPNETCOREVERSION}

diff --git a/packaging/osx/clisdk/resources/ru.lproj/conclusion.html b/packaging/osx/clisdk/resources/ru.lproj/conclusion.html index 7d91816fd..03fc060e4 100644 --- a/packaging/osx/clisdk/resources/ru.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/ru.lproj/conclusion.html @@ -7,9 +7,9 @@

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

    -
  • .NET Core SDK 2.1.300
  • -
  • .NET Core Runtime 2.1.0
  • -
  • ASP.NET Core Runtime 2.1.0
  • +
  • .NET Core SDK {DOTNETSDKVERSION}
  • +
  • .NET Core Runtime {DOTNETRUNTIMEVERSION}
  • +
  • ASP.NET Core Runtime {ASPNETCOREVERSION}

diff --git a/packaging/osx/clisdk/resources/tr.lproj/conclusion.html b/packaging/osx/clisdk/resources/tr.lproj/conclusion.html index 7d91816fd..03fc060e4 100644 --- a/packaging/osx/clisdk/resources/tr.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/tr.lproj/conclusion.html @@ -7,9 +7,9 @@

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

    -
  • .NET Core SDK 2.1.300
  • -
  • .NET Core Runtime 2.1.0
  • -
  • ASP.NET Core Runtime 2.1.0
  • +
  • .NET Core SDK {DOTNETSDKVERSION}
  • +
  • .NET Core Runtime {DOTNETRUNTIMEVERSION}
  • +
  • ASP.NET Core Runtime {ASPNETCOREVERSION}

diff --git a/packaging/osx/clisdk/resources/zh-hans.lproj/conclusion.html b/packaging/osx/clisdk/resources/zh-hans.lproj/conclusion.html index 7d91816fd..03fc060e4 100644 --- a/packaging/osx/clisdk/resources/zh-hans.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/zh-hans.lproj/conclusion.html @@ -7,9 +7,9 @@

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

    -
  • .NET Core SDK 2.1.300
  • -
  • .NET Core Runtime 2.1.0
  • -
  • ASP.NET Core Runtime 2.1.0
  • +
  • .NET Core SDK {DOTNETSDKVERSION}
  • +
  • .NET Core Runtime {DOTNETRUNTIMEVERSION}
  • +
  • ASP.NET Core Runtime {ASPNETCOREVERSION}

diff --git a/packaging/osx/clisdk/resources/zh-hant.lproj/conclusion.html b/packaging/osx/clisdk/resources/zh-hant.lproj/conclusion.html index 7d91816fd..03fc060e4 100644 --- a/packaging/osx/clisdk/resources/zh-hant.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/zh-hant.lproj/conclusion.html @@ -7,9 +7,9 @@

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

    -
  • .NET Core SDK 2.1.300
  • -
  • .NET Core Runtime 2.1.0
  • -
  • ASP.NET Core Runtime 2.1.0
  • +
  • .NET Core SDK {DOTNETSDKVERSION}
  • +
  • .NET Core Runtime {DOTNETRUNTIMEVERSION}
  • +
  • ASP.NET Core Runtime {ASPNETCOREVERSION}

diff --git a/packaging/windows/clisdk/bundle.wxl b/packaging/windows/clisdk/bundle.wxl index 92deb5132..18fc7750c 100644 --- a/packaging/windows/clisdk/bundle.wxl +++ b/packaging/windows/clisdk/bundle.wxl @@ -50,9 +50,9 @@ The installation was successful The following were installed at [DOTNETHOME] - • .NET Core SDK 2.1.300 - • .NET Core Runtime 2.1.0 - • ASP.NET Core Runtime 2.1.0 + • .NET Core SDK [DOTNETSDKVERSION] + • .NET Core Runtime [DOTNETRUNTIMEVERSION] + • ASP.NET Core Runtime [ASPNETCOREVERSION] This product collects usage data • More information and opt-out https://aka.ms/dotnet-cli-telemetry diff --git a/packaging/windows/clisdk/bundle.wxs b/packaging/windows/clisdk/bundle.wxs index 5e6936af7..aeae3aad9 100644 --- a/packaging/windows/clisdk/bundle.wxs +++ b/packaging/windows/clisdk/bundle.wxs @@ -24,6 +24,9 @@ + + + diff --git a/packaging/windows/clisdk/generatebundle.ps1 b/packaging/windows/clisdk/generatebundle.ps1 index 8b53d9591..a2b166baf 100644 --- a/packaging/windows/clisdk/generatebundle.ps1 +++ b/packaging/windows/clisdk/generatebundle.ps1 @@ -14,7 +14,9 @@ param( [Parameter(Mandatory=$true)][string]$DotnetCLIDisplayVersion, [Parameter(Mandatory=$true)][string]$DotnetCLINugetVersion, [Parameter(Mandatory=$true)][string]$UpgradeCode, - [Parameter(Mandatory=$true)][string]$Architecture + [Parameter(Mandatory=$true)][string]$Architecture, + [Parameter(Mandatory=$true)][string]$DotNetRuntimeVersion, + [Parameter(Mandatory=$true)][string]$AspNetCoreVersion ) . "$PSScriptRoot\..\..\..\scripts\common\_common.ps1" @@ -43,6 +45,8 @@ function RunCandleForBundle -dAdditionalSharedFXMsiSourcePath="$AdditionalSharedFxMSIFile" ` -dAdditionalHostFXRMsiSourcePath="$AdditionalHostFxrMSIFile" ` -dAdditionalSharedHostMsiSourcePath="$AdditionalSharedHostMSIFile" ` + -dDotNetRuntimeVersion="$DotNetRuntimeVersion" ` + -dAspNetCoreVersion="$AspNetCoreVersion" ` -arch "$Architecture" ` -ext WixBalExtension.dll ` -ext WixUtilExtension.dll ` diff --git a/scripts/obtain/dotnet-install.sh b/scripts/obtain/dotnet-install.sh index 00a42d872..55de51b91 100755 --- a/scripts/obtain/dotnet-install.sh +++ b/scripts/obtain/dotnet-install.sh @@ -79,6 +79,10 @@ get_legacy_os_name_from_platform() { echo "fedora.23" return 0 ;; + "fedora.27") + echo "fedora.27" + return 0 + ;; "fedora.24") echo "fedora.24" return 0 @@ -91,6 +95,10 @@ get_legacy_os_name_from_platform() { echo "opensuse.42.1" return 0 ;; + "opensuse.42.3") + echo "opensuse.42.3" + return 0 + ;; "rhel.7"*) echo "rhel" return 0 @@ -107,6 +115,10 @@ get_legacy_os_name_from_platform() { echo "ubuntu.16.10" return 0 ;; + "ubuntu.18.04") + echo "ubuntu.18.04" + return 0 + ;; "alpine.3.4.3") echo "alpine" return 0 @@ -145,13 +157,13 @@ get_linux_platform_name() { get_current_os_name() { eval $invocation - linux_platform_name="unknown" local uname=$(uname) if [ "$uname" = "Darwin" ]; then echo "osx" return 0 elif [ "$uname" = "Linux" ]; then + local linux_platform_name linux_platform_name="$(get_linux_platform_name)" || { echo "linux" && return 0 ; } if [[ $linux_platform_name == "rhel.6" || $linux_platform_name == "alpine.3.6" ]]; then @@ -570,9 +582,10 @@ copy_files_or_dirs_from_list() { local root_path="$(remove_trailing_slash "$1")" local out_path="$(remove_trailing_slash "$2")" local override="$3" + local osname="$(get_current_os_name)" local override_switch=$( if [ "$override" = false ]; then - if [[ $linux_platform_name == 'alpine'* ]]; then + if [[ "$osname" == 'alpine'* ]]; then printf -- "-u"; else printf -- "-n"; diff --git a/src/Microsoft.DotNet.Cli.Utils/Constants.cs b/src/Microsoft.DotNet.Cli.Utils/Constants.cs index ad5d5111d..81d485e11 100644 --- a/src/Microsoft.DotNet.Cli.Utils/Constants.cs +++ b/src/Microsoft.DotNet.Cli.Utils/Constants.cs @@ -18,6 +18,7 @@ namespace Microsoft.DotNet.Cli.Utils public static readonly string MSBUILD_EXE_PATH = "MSBUILD_EXE_PATH"; public static readonly string MSBuildExtensionsPath = "MSBuildExtensionsPath"; + public static readonly string EnableDefaultItems = "EnableDefaultItems"; public static readonly string ProjectArgumentName = ""; public static readonly string SolutionArgumentName = ""; diff --git a/src/dotnet/CommonLocalizableStrings.resx b/src/dotnet/CommonLocalizableStrings.resx index ad6125977..e06ee07c0 100644 --- a/src/dotnet/CommonLocalizableStrings.resx +++ b/src/dotnet/CommonLocalizableStrings.resx @@ -628,4 +628,13 @@ setx PATH "%PATH%;{0}" The command name '{0}' cannot begin with a leading dot (.). + + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + + + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + + + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + diff --git a/src/dotnet/ToolPackage/IToolPackage.cs b/src/dotnet/ToolPackage/IToolPackage.cs index c769b002d..ebf351487 100644 --- a/src/dotnet/ToolPackage/IToolPackage.cs +++ b/src/dotnet/ToolPackage/IToolPackage.cs @@ -18,6 +18,8 @@ namespace Microsoft.DotNet.ToolPackage IReadOnlyList Commands { get; } + IEnumerable Warnings { get; } + void Uninstall(); } } diff --git a/src/dotnet/ToolPackage/ToolConfiguration.cs b/src/dotnet/ToolPackage/ToolConfiguration.cs index fe6eeb2a9..bcb11c4e5 100644 --- a/src/dotnet/ToolPackage/ToolConfiguration.cs +++ b/src/dotnet/ToolPackage/ToolConfiguration.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; +using System.Collections.Generic; using System.IO; using System.Linq; using Microsoft.DotNet.Tools; @@ -12,7 +13,8 @@ namespace Microsoft.DotNet.ToolPackage { public ToolConfiguration( string commandName, - string toolAssemblyEntryPoint) + string toolAssemblyEntryPoint, + IEnumerable warnings = null) { if (string.IsNullOrWhiteSpace(commandName)) { @@ -32,6 +34,7 @@ namespace Microsoft.DotNet.ToolPackage CommandName = commandName; ToolAssemblyEntryPoint = toolAssemblyEntryPoint; + Warnings = warnings ?? new List(); } private void EnsureNoInvalidFilenameCharacters(string commandName) @@ -60,5 +63,6 @@ namespace Microsoft.DotNet.ToolPackage public string CommandName { get; } public string ToolAssemblyEntryPoint { get; } + public IEnumerable Warnings { get; } } } diff --git a/src/dotnet/ToolPackage/ToolConfigurationDeserialization/DotNetCliTool.cs b/src/dotnet/ToolPackage/ToolConfigurationDeserialization/DotNetCliTool.cs index 91fd9fde4..99bc2ff10 100644 --- a/src/dotnet/ToolPackage/ToolConfigurationDeserialization/DotNetCliTool.cs +++ b/src/dotnet/ToolPackage/ToolConfigurationDeserialization/DotNetCliTool.cs @@ -9,5 +9,8 @@ namespace Microsoft.DotNet.ToolPackage.ToolConfigurationDeserialization { [XmlArrayItem("Command", IsNullable = false)] public DotNetCliToolCommand[] Commands { get; set; } + + [XmlAttribute(AttributeName = "Version")] + public string Version { get; set; } } } diff --git a/src/dotnet/ToolPackage/ToolConfigurationDeserializer.cs b/src/dotnet/ToolPackage/ToolConfigurationDeserializer.cs index 7d943c36e..c2319e13a 100644 --- a/src/dotnet/ToolPackage/ToolConfigurationDeserializer.cs +++ b/src/dotnet/ToolPackage/ToolConfigurationDeserializer.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; +using System.Collections.Generic; using System.IO; using System.Xml; using System.Xml.Serialization; @@ -12,6 +13,10 @@ namespace Microsoft.DotNet.ToolPackage { internal static class ToolConfigurationDeserializer { + // The supported tool configuration schema version. + // This should match the schema version in the GenerateToolsSettingsFile task from the SDK. + private const int SupportedVersion = 1; + public static ToolConfiguration Deserialize(string pathToXml) { var serializer = new XmlSerializer(typeof(DotNetCliTool)); @@ -43,6 +48,8 @@ namespace Microsoft.DotNet.ToolPackage ex); } + List warnings = GenerateWarningAccordingToVersionAttribute(dotNetCliTool); + if (dotNetCliTool.Commands.Length != 1) { throw new ToolConfigurationException(CommonLocalizableStrings.ToolSettingsMoreThanOneCommand); @@ -59,7 +66,33 @@ namespace Microsoft.DotNet.ToolPackage return new ToolConfiguration( dotNetCliTool.Commands[0].Name, - dotNetCliTool.Commands[0].EntryPoint); + dotNetCliTool.Commands[0].EntryPoint, + warnings); + } + + private static List GenerateWarningAccordingToVersionAttribute(DotNetCliTool dotNetCliTool) + { + List warnings = new List(); + if (string.IsNullOrWhiteSpace(dotNetCliTool.Version)) + { + warnings.Add(CommonLocalizableStrings.FormatVersionIsMissing); + } + else + { + if (!int.TryParse(dotNetCliTool.Version, out int version)) + { + warnings.Add(CommonLocalizableStrings.FormatVersionIsMalformed); + } + else + { + if (version > SupportedVersion) + { + warnings.Add(CommonLocalizableStrings.FormatVersionIsHigher); + } + } + } + + return warnings; } } } diff --git a/src/dotnet/ToolPackage/ToolPackageInstance.cs b/src/dotnet/ToolPackage/ToolPackageInstance.cs index 74b092109..4dd9733fb 100644 --- a/src/dotnet/ToolPackage/ToolPackageInstance.cs +++ b/src/dotnet/ToolPackage/ToolPackageInstance.cs @@ -13,23 +13,7 @@ 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 IEnumerable Warnings => _toolConfiguration.Value.Warnings; public PackageId Id { get; private set; } public NuGetVersion Version { get; private set; } @@ -44,13 +28,36 @@ namespace Microsoft.DotNet.ToolPackage } } + private const string AssetsFileName = "project.assets.json"; + private const string ToolSettingsFileName = "DotnetToolSettings.xml"; + + private IToolPackageStore _store; + private Lazy> _commands; + private Lazy _toolConfiguration; + + 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; + _toolConfiguration = new Lazy(GetToolConfiguration); + } + public void Uninstall() { var rootDirectory = PackageDirectory.GetParentPath(); string tempPackageDirectory = null; TransactionalAction.Run( - action: () => { + action: () => + { try { if (Directory.Exists(PackageDirectory.Value)) @@ -78,13 +85,15 @@ namespace Microsoft.DotNet.ToolPackage ex); } }, - commit: () => { + commit: () => + { if (tempPackageDirectory != null) { Directory.Delete(tempPackageDirectory, true); } }, - rollback: () => { + rollback: () => + { if (tempPackageDirectory != null) { Directory.CreateDirectory(rootDirectory.Value); @@ -95,31 +104,13 @@ namespace Microsoft.DotNet.ToolPackage 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); + ToolConfiguration configuration = _toolConfiguration.Value; var entryPointFromLockFile = FindItemInTargetLibrary(library, configuration.ToolAssemblyEntryPoint); if (entryPointFromLockFile == null) { @@ -152,6 +143,44 @@ namespace Microsoft.DotNet.ToolPackage } } + private ToolConfiguration GetToolConfiguration() + { + try + { + var lockFile = new LockFileFormat().Read(PackageDirectory.WithFile(AssetsFileName).Value); + var library = FindLibraryInLockFile(lockFile); + return DeserializeToolConfiguration(ToolSettingsFileName, library); + } + catch (Exception ex) when (ex is UnauthorizedAccessException || ex is IOException) + { + throw new ToolConfigurationException( + string.Format( + CommonLocalizableStrings.FailedToRetrieveToolConfiguration, + ex.Message), + ex); + } + } + + private ToolConfiguration DeserializeToolConfiguration(string ToolSettingsFileName, LockFileTargetLibrary library) + { + 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); + return configuration; + } + private LockFileTargetLibrary FindLibraryInLockFile(LockFile lockFile) { return lockFile @@ -166,5 +195,6 @@ namespace Microsoft.DotNet.ToolPackage ?.ToolsAssemblies ?.SingleOrDefault(t => LockFileMatcher.MatchesFile(t, targetRelativeFilePath)); } + } } diff --git a/src/dotnet/commands/dotnet-run/RunCommand.cs b/src/dotnet/commands/dotnet-run/RunCommand.cs index 2c7d20f51..4d8aecc46 100644 --- a/src/dotnet/commands/dotnet-run/RunCommand.cs +++ b/src/dotnet/commands/dotnet-run/RunCommand.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using Microsoft.Build.Evaluation; +using Microsoft.Build.Execution; using Microsoft.Build.Exceptions; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Tools; @@ -184,6 +184,9 @@ namespace Microsoft.DotNet.Tools.Run { var globalProperties = new Dictionary { + // This property disables default item globbing to improve performance + // This should be safe because we are not evaluating items, only properties + { Constants.EnableDefaultItems, "false" }, { Constants.MSBuildExtensionsPath, AppContext.BaseDirectory } }; @@ -197,7 +200,7 @@ namespace Microsoft.DotNet.Tools.Run globalProperties.Add("TargetFramework", Framework); } - Project project = new Project(Project, globalProperties, null); + var project = new ProjectInstance(Project, globalProperties, null); string runProgram = project.GetPropertyValue("RunCommand"); if (string.IsNullOrEmpty(runProgram)) @@ -220,7 +223,7 @@ namespace Microsoft.DotNet.Tools.Run .WorkingDirectory(runWorkingDirectory); } - private void ThrowUnableToRunError(Project project) + private void ThrowUnableToRunError(ProjectInstance project) { string targetFrameworks = project.GetPropertyValue("TargetFrameworks"); if (!string.IsNullOrEmpty(targetFrameworks)) diff --git a/src/dotnet/commands/dotnet-tool/install/LocalizableStrings.resx b/src/dotnet/commands/dotnet-tool/install/LocalizableStrings.resx index c970ea1cf..af448e1e9 100644 --- a/src/dotnet/commands/dotnet-tool/install/LocalizableStrings.resx +++ b/src/dotnet/commands/dotnet-tool/install/LocalizableStrings.resx @@ -161,7 +161,9 @@ Tool '{1}' (version '{2}') was successfully installed. The settings file in the tool's NuGet package is invalid: {0} - Tool '{0}' failed to install. + Tool '{0}' failed to install. You may need to specify the version using + + dotnet tool install -g {0} --version <version> Tool '{0}' failed to install. Please contact the tool author for assistance. @@ -187,4 +189,4 @@ Tool '{1}' (version '{2}') was successfully installed. Location where the tool will be installed. - + \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-tool/install/ToolInstallCommand.cs b/src/dotnet/commands/dotnet-tool/install/ToolInstallCommand.cs index 0977cd066..42bcb8790 100644 --- a/src/dotnet/commands/dotnet-tool/install/ToolInstallCommand.cs +++ b/src/dotnet/commands/dotnet-tool/install/ToolInstallCommand.cs @@ -148,6 +148,11 @@ namespace Microsoft.DotNet.Tools.Tool.Install scope.Complete(); } + foreach (string w in package.Warnings) + { + _reporter.WriteLine(w.Yellow()); + } + if (_global) { _environmentPathInstruction.PrintAddPathInstructionIfPathDoesNotExist(); diff --git a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.cs.xlf b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.cs.xlf index 019e0c5c4..6d683ff31 100644 --- a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.cs.xlf +++ b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.cs.xlf @@ -60,8 +60,10 @@ Nástroj {1} (verze {2}) byl úspěšně nainstalován. - Tool '{0}' failed to install. - Nástroj {0} se nepodařilo nainstalovat. + Tool '{0}' failed to install. You may need to specify the version using + + dotnet tool install -g {0} --version <version> + Nástroj {0} se nepodařilo nainstalovat. diff --git a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.de.xlf index 58227cfb8..c96dd1df9 100644 --- a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.de.xlf +++ b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.de.xlf @@ -60,8 +60,10 @@ Das Tool "{1}" (Version "{2}") wurde erfolgreich installiert. - Tool '{0}' failed to install. - Fehler bei der Installation des Tools "{0}". + Tool '{0}' failed to install. You may need to specify the version using + + dotnet tool install -g {0} --version <version> + Fehler bei der Installation des Tools "{0}". diff --git a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.es.xlf b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.es.xlf index 774e3968c..1978faa6f 100644 --- a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.es.xlf +++ b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.es.xlf @@ -60,8 +60,10 @@ La herramienta "{1}" (versión "{2}") se instaló correctamente. - Tool '{0}' failed to install. - No se pudo instalar la herramienta “{0}”. + Tool '{0}' failed to install. You may need to specify the version using + + dotnet tool install -g {0} --version <version> + No se pudo instalar la herramienta “{0}”. diff --git a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.fr.xlf b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.fr.xlf index cdf3f021c..fb105c682 100644 --- a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.fr.xlf +++ b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.fr.xlf @@ -60,8 +60,10 @@ L'outil '{1}' (version '{2}') a été installé. - Tool '{0}' failed to install. - Impossible d'installer l'outil '{0}'. + Tool '{0}' failed to install. You may need to specify the version using + + dotnet tool install -g {0} --version <version> + Impossible d'installer l'outil '{0}'. diff --git a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.it.xlf b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.it.xlf index c42d1cc40..972f85489 100644 --- a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.it.xlf +++ b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.it.xlf @@ -60,8 +60,10 @@ Lo strumento '{1}' (versione '{2}') è stato installato. - Tool '{0}' failed to install. - Non è stato possibile installare lo strumento '{0}'. + Tool '{0}' failed to install. You may need to specify the version using + + dotnet tool install -g {0} --version <version> + Non è stato possibile installare lo strumento '{0}'. diff --git a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.ja.xlf b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.ja.xlf index 9fa3c5928..d04d679cd 100644 --- a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.ja.xlf +++ b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.ja.xlf @@ -60,8 +60,10 @@ Tool '{1}' (version '{2}') was successfully installed. - Tool '{0}' failed to install. - ツール '{0}' をインストールできませんでした。 + Tool '{0}' failed to install. You may need to specify the version using + + dotnet tool install -g {0} --version <version> + ツール '{0}' をインストールできませんでした。 diff --git a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.ko.xlf b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.ko.xlf index e7d4dbd9e..36543e273 100644 --- a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.ko.xlf +++ b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.ko.xlf @@ -60,8 +60,10 @@ Tool '{1}' (version '{2}') was successfully installed. - Tool '{0}' failed to install. - '{0}' 도구를 설치하지 못했습니다. + Tool '{0}' failed to install. You may need to specify the version using + + dotnet tool install -g {0} --version <version> + '{0}' 도구를 설치하지 못했습니다. diff --git a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.pl.xlf b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.pl.xlf index 2d7d4f93f..57ac9d21f 100644 --- a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.pl.xlf +++ b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.pl.xlf @@ -60,8 +60,10 @@ Pomyślnie zainstalowano narzędzie „{1}” (wersja: „{2}”). - Tool '{0}' failed to install. - Zainstalowanie narzędzia „{0}” nie powiodło się. + Tool '{0}' failed to install. You may need to specify the version using + + dotnet tool install -g {0} --version <version> + Zainstalowanie narzędzia „{0}” nie powiodło się. diff --git a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.pt-BR.xlf index 0dc50e9a1..961c58a9a 100644 --- a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.pt-BR.xlf @@ -60,8 +60,10 @@ A ferramenta '{1}' (versão '{2}') foi instalada com êxito. - Tool '{0}' failed to install. - Não foi possível instalar a ferramenta '{0}'. + Tool '{0}' failed to install. You may need to specify the version using + + dotnet tool install -g {0} --version <version> + Não foi possível instalar a ferramenta '{0}'. diff --git a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.ru.xlf b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.ru.xlf index 42eb6fd3d..f953077a3 100644 --- a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.ru.xlf +++ b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.ru.xlf @@ -60,8 +60,10 @@ Tool '{1}' (version '{2}') was successfully installed. - Tool '{0}' failed to install. - Не удалось установить инструмент "{0}". + Tool '{0}' failed to install. You may need to specify the version using + + dotnet tool install -g {0} --version <version> + Не удалось установить инструмент "{0}". diff --git a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.tr.xlf b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.tr.xlf index 2bd6bf5bb..f596ce661 100644 --- a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.tr.xlf +++ b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.tr.xlf @@ -60,8 +60,10 @@ Tool '{1}' (version '{2}') was successfully installed. - Tool '{0}' failed to install. - '{0}' aracı yüklenemedi. + Tool '{0}' failed to install. You may need to specify the version using + + dotnet tool install -g {0} --version <version> + '{0}' aracı yüklenemedi. diff --git a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.zh-Hans.xlf index 63d1210de..ede31a8f7 100644 --- a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.zh-Hans.xlf @@ -60,8 +60,10 @@ Tool '{1}' (version '{2}') was successfully installed. - Tool '{0}' failed to install. - 工具“{0}”安装失败。 + Tool '{0}' failed to install. You may need to specify the version using + + dotnet tool install -g {0} --version <version> + 工具“{0}”安装失败。 diff --git a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.zh-Hant.xlf index 48bd8e3e5..3c41fffe8 100644 --- a/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/commands/dotnet-tool/install/xlf/LocalizableStrings.zh-Hant.xlf @@ -60,8 +60,10 @@ Tool '{1}' (version '{2}') was successfully installed. - Tool '{0}' failed to install. - 工具 '{0}' 無法安裝。 + Tool '{0}' failed to install. You may need to specify the version using + + dotnet tool install -g {0} --version <version> + 工具 '{0}' 無法安裝。 diff --git a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf index 530f7b87b..1ad8c87ba 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.cs.xlf @@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}" Příkaz {0} obsahuje úvodní tečku. + + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + + + + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + + + + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf index df86a678e..fd08ba0ae 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.de.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.de.xlf @@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}" Der Befehl "{0}" weist einen vorangestellten Punkt auf. + + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + + + + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + + + + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf index eeeaf4677..ff8efe426 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.es.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.es.xlf @@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}" El comando "{0}" tiene un punto al principio. + + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + + + + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + + + + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf index 185d6ba1f..30ba594d4 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.fr.xlf @@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}" La commande '{0}' commence par un point. + + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + + + + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + + + + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf index 6614c8b26..73a334fac 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.it.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.it.xlf @@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}" Il comando '{0}' presenta un punto iniziale. + + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + + + + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + + + + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf index 9d3518995..923244e61 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ja.xlf @@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}" コマンド '{0}' の先頭にドットがあります。 + + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + + + + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + + + + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf index db044c92a..b8769753f 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ko.xlf @@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}" 명령 '{0}' 앞에 점이 있습니다. + + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + + + + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + + + + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf index de47d9779..e06525415 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pl.xlf @@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}" Polecenie „{0}” zawiera kropkę na początku. + + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + + + + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + + + + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf b/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf index dc7b67b8e..5bac8fb07 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf @@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}" O comando '{0}' tem um ponto à esquerda. + + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + + + + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + + + + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf index 73111d0eb..a356ca731 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.ru.xlf @@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}" В начале команды "{0}" стоит точка. + + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + + + + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + + + + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf index 3f6a52a12..5cd7faabb 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.tr.xlf @@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}" '{0}' komutunun başında nokta var. + + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + + + + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + + + + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf index 8729ab7fb..c0f3a3706 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf @@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}" 命令“{0}”有一个前导点。 + + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + + + + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + + + + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + + \ No newline at end of file diff --git a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf index a93c4900e..c8312b3c9 100644 --- a/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf +++ b/src/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf @@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}" 命令 '{0}' 的開頭有一個點 (.)。 + + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK. + + + + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool. + + + + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool. + + \ No newline at end of file diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index 65bd1e2a9..cd3ca221e 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -356,8 +356,8 @@ "version": "$(MicrosoftNETCoreAppPackageVersion)"
diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/DotnetToolSettingsGolden.xml b/test/Microsoft.DotNet.ToolPackage.Tests/DotnetToolSettingsGolden.xml index cd4f20107..7b3ae9d5d 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/DotnetToolSettingsGolden.xml +++ b/test/Microsoft.DotNet.ToolPackage.Tests/DotnetToolSettingsGolden.xml @@ -1,5 +1,5 @@  - + diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/DotnetToolSettingsMajorHigherVersion.xml b/test/Microsoft.DotNet.ToolPackage.Tests/DotnetToolSettingsMajorHigherVersion.xml new file mode 100644 index 000000000..f74b863d8 --- /dev/null +++ b/test/Microsoft.DotNet.ToolPackage.Tests/DotnetToolSettingsMajorHigherVersion.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/DotnetToolSettingsMissingVersion.xml b/test/Microsoft.DotNet.ToolPackage.Tests/DotnetToolSettingsMissingVersion.xml new file mode 100644 index 000000000..cd4f20107 --- /dev/null +++ b/test/Microsoft.DotNet.ToolPackage.Tests/DotnetToolSettingsMissingVersion.xml @@ -0,0 +1,6 @@ + + + + + + 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 c5d027749..27ff23b4b 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/Microsoft.DotNet.ToolPackage.Tests.csproj +++ b/test/Microsoft.DotNet.ToolPackage.Tests/Microsoft.DotNet.ToolPackage.Tests.csproj @@ -34,6 +34,12 @@ Always + + Always + + + Always + diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/SampleGlobalTool/DotnetToolSettings.xml b/test/Microsoft.DotNet.ToolPackage.Tests/SampleGlobalTool/DotnetToolSettings.xml index b9c18a1e7..92142c78d 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/SampleGlobalTool/DotnetToolSettings.xml +++ b/test/Microsoft.DotNet.ToolPackage.Tests/SampleGlobalTool/DotnetToolSettings.xml @@ -1,5 +1,5 @@ - - + + diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs b/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs index 1d141311e..c102bb9ca 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs +++ b/test/Microsoft.DotNet.ToolPackage.Tests/ToolConfigurationDeserializerTests.cs @@ -41,6 +41,30 @@ namespace Microsoft.DotNet.ToolPackage.Tests .Contain(CommonLocalizableStrings.ToolSettingsMissingCommandName); } + [Fact] + public void GivenMissingVersionItHasWarningReflectIt() + { + ToolConfiguration toolConfiguration = ToolConfigurationDeserializer.Deserialize("DotnetToolSettingsMissingVersion.xml"); + + toolConfiguration.Warnings.First().Should().Be(CommonLocalizableStrings.FormatVersionIsMissing); + } + + [Fact] + public void GivenMajorHigherVersionItHasWarningReflectIt() + { + ToolConfiguration toolConfiguration = ToolConfigurationDeserializer.Deserialize("DotnetToolSettingsMajorHigherVersion.xml"); + + toolConfiguration.Warnings.First().Should().Be(CommonLocalizableStrings.FormatVersionIsHigher); + } + + [Fact] + public void GivenMinorHigherVersionItHasNoWarning() + { + ToolConfiguration toolConfiguration = ToolConfigurationDeserializer.Deserialize("DotnetToolSettingsGolden.xml"); + + toolConfiguration.Warnings.Should().BeEmpty(); + } + [Fact] public void GivenInvalidCharAsFileNameItThrows() { diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageInstallerMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageInstallerMock.cs index 539205cca..facc85132 100644 --- a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageInstallerMock.cs +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageInstallerMock.cs @@ -22,17 +22,20 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks private readonly IProjectRestorer _projectRestorer; private readonly IFileSystem _fileSystem; private readonly Action _installCallback; + private readonly Dictionary> _warningsMap; public ToolPackageInstallerMock( IFileSystem fileSystem, IToolPackageStore store, IProjectRestorer projectRestorer, - Action installCallback = null) + Action installCallback = null, + Dictionary> warningsMap = null) { _fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)); _store = store ?? throw new ArgumentNullException(nameof(store)); _projectRestorer = projectRestorer ?? throw new ArgumentNullException(nameof(projectRestorer)); _installCallback = installCallback; + _warningsMap = warningsMap ?? new Dictionary>(); } public IToolPackage InstallPackage(PackageId packageId, @@ -86,7 +89,10 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks _fileSystem.Directory.Move(stageDirectory.Value, packageDirectory.Value); rollbackDirectory = packageDirectory.Value; - return new ToolPackageMock(_fileSystem, packageId, version, packageDirectory); + IEnumerable warnings = null; + _warningsMap.TryGetValue(packageId, out warnings); + + return new ToolPackageMock(_fileSystem, packageId, version, packageDirectory, warnings: warnings); }, rollback: () => { if (rollbackDirectory != null && _fileSystem.Directory.Exists(rollbackDirectory)) diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageMock.cs index 6ad826441..565e140e4 100644 --- a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageMock.cs +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageMock.cs @@ -17,13 +17,15 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks private IFileSystem _fileSystem; private Lazy> _commands; private Action _uninstallCallback; + private IEnumerable _warnings; public ToolPackageMock( IFileSystem fileSystem, PackageId id, NuGetVersion version, DirectoryPath packageDirectory, - Action uninstallCallback = null) + Action uninstallCallback = null, + IEnumerable warnings = null) { _fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)); Id = id; @@ -31,6 +33,7 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks PackageDirectory = packageDirectory; _commands = new Lazy>(GetCommands); _uninstallCallback = uninstallCallback; + _warnings = warnings ?? new List(); } public PackageId Id { get; private set; } @@ -47,6 +50,8 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks } } + public IEnumerable Warnings => _warnings; + public void Uninstall() { var rootDirectory = PackageDirectory.GetParentPath(); diff --git a/test/dotnet.Tests/CommandTests/ToolInstallCommandTests.cs b/test/dotnet.Tests/CommandTests/ToolInstallCommandTests.cs index 89ea673d2..65ea11d13 100644 --- a/test/dotnet.Tests/CommandTests/ToolInstallCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/ToolInstallCommandTests.cs @@ -137,6 +137,37 @@ namespace Microsoft.DotNet.Tests.Commands _reporter.Lines.First().Should().Be(EnvironmentPathInstructionMock.MockInstructionText); } + [Fact] + public void WhenRunWithPackageIdPackageFormatIsNotFullySupportedItShouldShowPathInstruction() + { + const string Warning = "WARNING"; + var injectedWarnings = new Dictionary>() + { + [new PackageId(PackageId)] = new List() { Warning } + }; + + var toolPackageInstaller = new ToolPackageInstallerMock( + fileSystem: _fileSystem, + store: _toolPackageStore, + projectRestorer: new ProjectRestorerMock( + fileSystem: _fileSystem, + reporter: _reporter), + warningsMap: injectedWarnings); + + var installToolCommand = new ToolInstallCommand( + _appliedCommand, + _parseResult, + (_) => (_toolPackageStore, toolPackageInstaller), + _createShellShimRepository, + _environmentPathInstructionMock, + _reporter); + + installToolCommand.Execute().Should().Be(0); + + _reporter.Lines.First().Should().Be(Warning.Yellow()); + _reporter.Lines.Skip(1).First().Should().Be(EnvironmentPathInstructionMock.MockInstructionText); + } + [Fact] public void GivenFailedPackageInstallWhenRunWithPackageIdItShouldFail() {