Merge pull request #8933 from dotnet/merges/release/2.1.3xx-to-master

Merge release/2.1.3xx to master
This commit is contained in:
Livar 2018-04-05 13:27:53 -07:00 committed by GitHub
commit 94a69a95b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 494 additions and 85 deletions

View file

@ -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).

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MicrosoftAspNetCoreAppPackageVersion>2.1.0-preview2-30431</MicrosoftAspNetCoreAppPackageVersion>
<MicrosoftAspNetCoreAppPackageVersion>2.1.0-preview2-30475</MicrosoftAspNetCoreAppPackageVersion>
<MicrosoftNETCoreAppPackageVersion>2.1.0-preview3-26404-01</MicrosoftNETCoreAppPackageVersion>
<MicrosoftNETCoreDotNetHostResolverPackageVersion>$(MicrosoftNETCoreAppPackageVersion)</MicrosoftNETCoreDotNetHostResolverPackageVersion>
<MicrosoftBuildPackageVersion>15.7.0-preview-000124</MicrosoftBuildPackageVersion>
<MicrosoftBuildPackageVersion>15.7.0-preview-000127</MicrosoftBuildPackageVersion>
<MicrosoftBuildFrameworkPackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildFrameworkPackageVersion>
<MicrosoftBuildRuntimePackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildRuntimePackageVersion>
<MicrosoftBuildLocalizationPackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildLocalizationPackageVersion>
@ -21,7 +21,7 @@
<MicrosoftNETSdkPublishPackageVersion>$(MicrosoftNETSdkWebPackageVersion)</MicrosoftNETSdkPublishPackageVersion>
<MicrosoftNETSdkWebProjectSystemPackageVersion>$(MicrosoftNETSdkWebPackageVersion)</MicrosoftNETSdkWebProjectSystemPackageVersion>
<MicrosoftDotNetCommonItemTemplatesPackageVersion>1.0.1-beta3-20180104-1263555</MicrosoftDotNetCommonItemTemplatesPackageVersion>
<MicrosoftDotNetCommonProjectTemplates20PackageVersion>1.0.1-beta3-20180104-1263555</MicrosoftDotNetCommonProjectTemplates20PackageVersion>
<MicrosoftDotNetCommonProjectTemplates20PackageVersion>$(MicrosoftDotNetCommonItemTemplatesPackageVersion)</MicrosoftDotNetCommonProjectTemplates20PackageVersion>
<MicrosoftDotNetTestProjectTemplates20PackageVersion>1.0.1-beta3-20180227-1423805</MicrosoftDotNetTestProjectTemplates20PackageVersion>
<MicrosoftTemplateEngineCliPackageVersion>1.0.0-beta3-20171204-315</MicrosoftTemplateEngineCliPackageVersion>
<MicrosoftTemplateEngineAbstractionsPackageVersion>$(MicrosoftTemplateEngineCliPackageVersion)</MicrosoftTemplateEngineAbstractionsPackageVersion>

View file

@ -49,7 +49,7 @@
<WriteLinesToFile Condition="'$(ExternalRestoreSources)' != '' and '$(DotNetBuildOffline)' != 'true'"
File="$(GeneratedNuGetConfig)"
Lines="&lt;add key=&quot;PrivateBlobFeed&quot; value=&quot;%(NugetConfigPrivateFeeds.Identity)&quot; /&gt;"
Lines="&lt;add key=&quot;PrivateBlobFeed%(NugetConfigPrivateFeeds.Filename)&quot; value=&quot;%(NugetConfigPrivateFeeds.Identity)&quot; /&gt;"
Overwrite="false" />
<WriteLinesToFile Condition="'$(DotNetBuildOffline)' != 'true'"

View file

@ -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";

View file

@ -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 = "<PROJECT>";
public static readonly string SolutionArgumentName = "<SLN_FILE>";

View file

@ -628,4 +628,13 @@ setx PATH "%PATH%;{0}"
<data name="ToolSettingsInvalidLeadingDotCommandName" xml:space="preserve">
<value>The command name '{0}' cannot begin with a leading dot (.).</value>
</data>
<data name="FormatVersionIsHigher" xml:space="preserve">
<value>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</value>
</data>
<data name="FormatVersionIsMalformed" xml:space="preserve">
<value>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</value>
</data>
<data name="FormatVersionIsMissing" xml:space="preserve">
<value>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</value>
</data>
</root>

View file

@ -18,6 +18,8 @@ namespace Microsoft.DotNet.ToolPackage
IReadOnlyList<CommandSettings> Commands { get; }
IEnumerable<string> Warnings { get; }
void Uninstall();
}
}

View file

@ -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<string> warnings = null)
{
if (string.IsNullOrWhiteSpace(commandName))
{
@ -32,6 +34,7 @@ namespace Microsoft.DotNet.ToolPackage
CommandName = commandName;
ToolAssemblyEntryPoint = toolAssemblyEntryPoint;
Warnings = warnings ?? new List<string>();
}
private void EnsureNoInvalidFilenameCharacters(string commandName)
@ -60,5 +63,6 @@ namespace Microsoft.DotNet.ToolPackage
public string CommandName { get; }
public string ToolAssemblyEntryPoint { get; }
public IEnumerable<string> Warnings { get; }
}
}

View file

@ -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; }
}
}

View file

@ -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<string> 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<string> GenerateWarningAccordingToVersionAttribute(DotNetCliTool dotNetCliTool)
{
List<string> warnings = new List<string>();
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;
}
}
}

View file

@ -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<IReadOnlyList<CommandSettings>> _commands;
public ToolPackageInstance(
IToolPackageStore store,
PackageId id,
NuGetVersion version,
DirectoryPath packageDirectory)
{
_store = store ?? throw new ArgumentNullException(nameof(store));
_commands = new Lazy<IReadOnlyList<CommandSettings>>(GetCommands);
Id = id;
Version = version ?? throw new ArgumentNullException(nameof(version));
PackageDirectory = packageDirectory;
}
public IEnumerable<string> 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<IReadOnlyList<CommandSettings>> _commands;
private Lazy<ToolConfiguration> _toolConfiguration;
public ToolPackageInstance(
IToolPackageStore store,
PackageId id,
NuGetVersion version,
DirectoryPath packageDirectory)
{
_store = store ?? throw new ArgumentNullException(nameof(store));
_commands = new Lazy<IReadOnlyList<CommandSettings>>(GetCommands);
Id = id;
Version = version ?? throw new ArgumentNullException(nameof(version));
PackageDirectory = packageDirectory;
_toolConfiguration = new Lazy<ToolConfiguration>(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<CommandSettings> GetCommands()
{
const string AssetsFileName = "project.assets.json";
const string ToolSettingsFileName = "DotnetToolSettings.xml";
try
{
var commands = new List<CommandSettings>();
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));
}
}
}

View file

@ -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<string, string>
{
// 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))

View file

@ -161,7 +161,9 @@ Tool '{1}' (version '{2}') was successfully installed.</value>
<value>The settings file in the tool's NuGet package is invalid: {0}</value>
</data>
<data name="ToolInstallationFailed" xml:space="preserve">
<value>Tool '{0}' failed to install.</value>
<value>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g {0} --version &lt;version&gt;</value>
</data>
<data name="ToolInstallationFailedContactAuthor" xml:space="preserve">
<value>Tool '{0}' failed to install. Please contact the tool author for assistance.</value>
@ -187,4 +189,4 @@ Tool '{1}' (version '{2}') was successfully installed.</value>
<data name="ToolPathDescription" xml:space="preserve">
<value>Location where the tool will be installed.</value>
</data>
</root>
</root>

View file

@ -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();

View file

@ -60,8 +60,10 @@ Nástroj {1} (verze {2}) byl úspěšně nainstalován.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">Nástroj {0} se nepodařilo nainstalovat.</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g {0} --version &lt;version&gt;</source>
<target state="needs-review-translation">Nástroj {0} se nepodařilo nainstalovat.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ Das Tool "{1}" (Version "{2}") wurde erfolgreich installiert.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">Fehler bei der Installation des Tools "{0}".</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g {0} --version &lt;version&gt;</source>
<target state="needs-review-translation">Fehler bei der Installation des Tools "{0}".</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ La herramienta "{1}" (versión "{2}") se instaló correctamente.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">No se pudo instalar la herramienta “{0}”.</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g {0} --version &lt;version&gt;</source>
<target state="needs-review-translation">No se pudo instalar la herramienta “{0}”.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ L'outil '{1}' (version '{2}') a été installé.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">Impossible d'installer l'outil '{0}'.</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g {0} --version &lt;version&gt;</source>
<target state="needs-review-translation">Impossible d'installer l'outil '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ Lo strumento '{1}' (versione '{2}') è stato installato.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">Non è stato possibile installare lo strumento '{0}'.</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g {0} --version &lt;version&gt;</source>
<target state="needs-review-translation">Non è stato possibile installare lo strumento '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">ツール '{0}' をインストールできませんでした。</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g {0} --version &lt;version&gt;</source>
<target state="needs-review-translation">ツール '{0}' をインストールできませんでした。</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">'{0}' 도구를 설치하지 못했습니다.</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g {0} --version &lt;version&gt;</source>
<target state="needs-review-translation">'{0}' 도구를 설치하지 못했습니다.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ Pomyślnie zainstalowano narzędzie „{1}” (wersja: „{2}”).</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">Zainstalowanie narzędzia „{0}” nie powiodło się.</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g {0} --version &lt;version&gt;</source>
<target state="needs-review-translation">Zainstalowanie narzędzia „{0}” nie powiodło się.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ A ferramenta '{1}' (versão '{2}') foi instalada com êxito.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">Não foi possível instalar a ferramenta '{0}'.</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g {0} --version &lt;version&gt;</source>
<target state="needs-review-translation">Não foi possível instalar a ferramenta '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">Не удалось установить инструмент "{0}".</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g {0} --version &lt;version&gt;</source>
<target state="needs-review-translation">Не удалось установить инструмент "{0}".</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">'{0}' aracı yüklenemedi.</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g {0} --version &lt;version&gt;</source>
<target state="needs-review-translation">'{0}' aracı yüklenemedi.</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">工具“{0}”安装失败。</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g {0} --version &lt;version&gt;</source>
<target state="needs-review-translation">工具“{0}”安装失败。</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -60,8 +60,10 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailed">
<source>Tool '{0}' failed to install.</source>
<target state="translated">工具 '{0}' 無法安裝。</target>
<source>Tool '{0}' failed to install. You may need to specify the version using
dotnet tool install -g {0} --version &lt;version&gt;</source>
<target state="needs-review-translation">工具 '{0}' 無法安裝。</target>
<note />
</trans-unit>
<trans-unit id="ToolInstallationFailedContactAuthor">

View file

@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">Příkaz {0} obsahuje úvodní tečku.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">Der Befehl "{0}" weist einen vorangestellten Punkt auf.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">El comando "{0}" tiene un punto al principio.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">La commande '{0}' commence par un point.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">Il comando '{0}' presenta un punto iniziale.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">コマンド '{0}' の先頭にドットがあります。</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">명령 '{0}' 앞에 점이 있습니다.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">Polecenie „{0}” zawiera kropkę na początku.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">O comando '{0}' tem um ponto à esquerda.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">В начале команды "{0}" стоит точка.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">'{0}' komutunun başında nokta var.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">命令“{0}”有一个前导点。</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -863,6 +863,21 @@ setx PATH "%PATH%;{0}"
<target state="needs-review-translation">命令 '{0}' 的開頭有一個點 (.)。</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsHigher">
<source>Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</source>
<target state="new">Format version is higher than supported. This tool may not be supported in this SDK version. Please update your SDK.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMalformed">
<source>Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is malformed. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FormatVersionIsMissing">
<source>Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</source>
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<DotNetCliTool>
<DotNetCliTool Version="1" >
<Commands>
<Command Name="sayhello" EntryPoint="console.dll" Runner="dotnet" />
</Commands>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<DotNetCliTool Version="2">
<Commands>
<Command Name="sayhello" EntryPoint="console.dll" Runner="dotnet" />
</Commands>
</DotNetCliTool>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<DotNetCliTool>
<Commands>
<Command Name="sayhello" EntryPoint="console.dll" Runner="dotnet" />
</Commands>
</DotNetCliTool>

View file

@ -34,6 +34,12 @@
<None Update="DotnetToolSettingsGolden.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="DotnetToolSettingsMissingVersion.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="DotnetToolSettingsMajorHigherVersion.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Remove="SampleGlobalTool/**" />
<Content Remove="SampleGlobalTool/**" />

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<DotNetCliTool>
<?xml version="1.0" encoding="utf-8" ?>
<DotNetCliTool Version="1" >
<Commands>
<Command Name="demo" EntryPoint="consoledemo.dll" Runner="dotnet" />
</Commands>

View file

@ -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()
{

View file

@ -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<PackageId, IEnumerable<string>> _warningsMap;
public ToolPackageInstallerMock(
IFileSystem fileSystem,
IToolPackageStore store,
IProjectRestorer projectRestorer,
Action installCallback = null)
Action installCallback = null,
Dictionary<PackageId, IEnumerable<string>> 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<PackageId, IEnumerable<string>>();
}
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<string> warnings = null;
_warningsMap.TryGetValue(packageId, out warnings);
return new ToolPackageMock(_fileSystem, packageId, version, packageDirectory, warnings: warnings);
},
rollback: () => {
if (rollbackDirectory != null && _fileSystem.Directory.Exists(rollbackDirectory))

View file

@ -17,13 +17,15 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks
private IFileSystem _fileSystem;
private Lazy<IReadOnlyList<CommandSettings>> _commands;
private Action _uninstallCallback;
private IEnumerable<string> _warnings;
public ToolPackageMock(
IFileSystem fileSystem,
PackageId id,
NuGetVersion version,
DirectoryPath packageDirectory,
Action uninstallCallback = null)
Action uninstallCallback = null,
IEnumerable<string> 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<IReadOnlyList<CommandSettings>>(GetCommands);
_uninstallCallback = uninstallCallback;
_warnings = warnings ?? new List<string>();
}
public PackageId Id { get; private set; }
@ -47,6 +50,8 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks
}
}
public IEnumerable<string> Warnings => _warnings;
public void Uninstall()
{
var rootDirectory = PackageDirectory.GetParentPath();

View file

@ -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<PackageId, IEnumerable<string>>()
{
[new PackageId(PackageId)] = new List<string>() { 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()
{