Merge branch 'master' into master-UpdateDependencies

This commit is contained in:
Livar 2018-04-05 15:32:36 -07:00 committed by GitHub
commit d8eed7963e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
75 changed files with 628 additions and 169 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,7 +1,7 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildName>cli</BuildName>
<SdkBrandName>Microsoft .NET Core SDK 2.1.300 - Preview</SdkBrandName>
<SdkBrandName>Microsoft .NET Core SDK $(CliBrandingVersion)</SdkBrandName>
<MSBuildExtensionsBrandName>.NET Standard Support for Visual Studio 2015</MSBuildExtensionsBrandName>
<SharedFrameworkBrandName>Microsoft .NET Core Runtime 2.1.0 - Preview</SharedFrameworkBrandName>
<SharedHostBrandName>Microsoft .NET Core Host 2.1.0 - Preview</SharedHostBrandName>

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-26405-02</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

@ -5,16 +5,18 @@
<VersionPatch>300</VersionPatch>
<ReleaseSuffix Condition=" '$(ReleaseSuffix)' == '' ">preview3</ReleaseSuffix>
<CliVersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)-$(ReleaseSuffix)</CliVersionPrefix>
<SimpleVersion Condition=" '$(DropSuffix)' == '' ">$(VersionMajor).$(VersionMinor).$(VersionPatch).$(CommitCount)</SimpleVersion>
<SimpleVersion Condition=" '$(SimpleVersion)' == '' ">$(VersionMajor).$(VersionMinor).$(VersionPatch)</SimpleVersion>
<CliVersionNoSuffix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</CliVersionNoSuffix>
<CliVersionPrefix>$(CliVersionNoSuffix)-$(ReleaseSuffix)</CliVersionPrefix>
<CliBrandingVersion>$(CliVersionNoSuffix) - $(ReleaseSuffix)</CliBrandingVersion>
<SimpleVersion Condition=" '$(DropSuffix)' == '' ">$(CliVersionNoSuffix).$(CommitCount)</SimpleVersion>
<SimpleVersion Condition=" '$(SimpleVersion)' == '' ">$(CliVersionNoSuffix)</SimpleVersion>
<VersionSuffix Condition=" '$(DropSuffix)' == '' ">$(ReleaseSuffix)-$(CommitCount)</VersionSuffix>
<FullNugetVersion>$(VersionMajor).$(VersionMinor).$(VersionPatch)-$(ReleaseSuffix)-$(CommitCount)</FullNugetVersion>
<FullNugetVersion>$(CliVersionNoSuffix)-$(ReleaseSuffix)-$(CommitCount)</FullNugetVersion>
<NugetVersion Condition=" '$(DropSuffix)' == '' ">$(FullNugetVersion)</NugetVersion>
<NugetVersion Condition=" '$(NugetVersion)' == '' ">$(VersionMajor).$(VersionMinor).$(VersionPatch)</NugetVersion>
<NugetVersion Condition=" '$(NugetVersion)' == '' ">$(CliVersionNoSuffix)</NugetVersion>
<SdkVersion>$(NugetVersion)</SdkVersion>
<SdkNugetVersion>$(NugetVersion)</SdkNugetVersion>

View file

@ -53,8 +53,8 @@
<!-- Create layout: Generate and Place postinst -->
<ReplaceFileContents
InputFile="$(DebianPostinstTemplateFile)"
DestinationFile="$(DebianPostinstFile)"
InputFiles="$(DebianPostinstTemplateFile)"
DestinationFiles="$(DebianPostinstFile)"
ReplacementItems="@(DebianPostInstTokenValues)" />
<Chmod
@ -63,8 +63,8 @@
<!-- Create layout: Generate and Place debian_config.json -->
<ReplaceFileContents
InputFile="$(DebianConfigTemplateFile)"
DestinationFile="$(DebianConfigJsonFile)"
InputFiles="$(DebianConfigTemplateFile)"
DestinationFiles="$(DebianConfigJsonFile)"
ReplacementItems="@(DebianConfigTokenValues)" />
<Chmod

View file

@ -154,7 +154,9 @@
'$(SimpleVersion)'
'$(NugetVersion)'
'$(CombinedFrameworkSDKHostInstallerUpgradeCode)'
'$(Architecture)'" />
'$(Architecture)'
'$(MicrosoftNETCoreAppPackageVersion)'
'$(AspNetCoreVersion)'" />
</Target>
<Target Name="GenerateSdkNupkg"

View file

@ -17,7 +17,7 @@
<SdkPkgScriptTemplateFile>$(SdkPkgScriptsDirectory)/postinstall</SdkPkgScriptTemplateFile>
<SdkPkgDestinationScriptsDirectory>$(PkgIntermediateDirectory)/scripts</SdkPkgDestinationScriptsDirectory>
<SdkPkgScriptFile>$(SdkPkgDestinationScriptsDirectory)/postinstall</SdkPkgScriptFile>
<SdkProductArchiveResourcesDirectory>$(SdkPkgSourcesRootDirectory)/resources</SdkProductArchiveResourcesDirectory>
<SdkProductArchiveResourcesDirectory>$(PkgIntermediateDirectory)/resources</SdkProductArchiveResourcesDirectory>
<SdkProductArchiveDistributionTemplateFile>$(SdkPkgSourcesRootDirectory)/Distribution-Template</SdkProductArchiveDistributionTemplateFile>
<SdkProductArchiveDistributionFile>$(PkgIntermediateDirectory)/CLI-SDK-Formatted-Distribution-Template.xml</SdkProductArchiveDistributionFile>
@ -61,6 +61,16 @@
<PostInstallScriptReplacement Include="%SDK_VERSION%">
<ReplacementString>$(SdkVersion)</ReplacementString>
</PostInstallScriptReplacement>
<ResourcesReplacement Include="{DOTNETSDKVERSION}">
<ReplacementString>$(SdkVersion)</ReplacementString>
</ResourcesReplacement>
<ResourcesReplacement Include="{DOTNETRUNTIMEVERSION}">
<ReplacementString>$(MicrosoftNETCoreAppPackageVersion)</ReplacementString>
</ResourcesReplacement>
<ResourcesReplacement Include="{ASPNETCOREVERSION}">
<ReplacementString>$(AspNetCoreVersion)</ReplacementString>
</ResourcesReplacement>
</ItemGroup>
<!-- Consumed By Publish -->
@ -69,6 +79,8 @@
</ItemGroup>
<ItemGroup>
<SdkProductArchiveResourcesTemplateFiles Include="$(SdkPkgSourcesRootDirectory)/resources/**/*" />
<GenerateSdkPkgInputs Include="$(SdkLayoutOutputDirectory)/**/*" />
<GenerateSdkPkgInputs Include="$(SdkPkgScriptsDirectory)/**/*" />
@ -77,7 +89,7 @@
<GenerateSdkProductArchiveInputs Include="$(DownloadedHostFxrInstallerFile)" />
<GenerateSdkProductArchiveInputs Include="$(DownloadedSharedHostInstallerFile)" />
<GenerateSdkProductArchiveInputs Include="$(SdkProductArchiveDistributionTemplateFile)" />
<GenerateSdkProductArchiveInputs Include="$(SdkProductArchiveResourcesDirectory)/**/*" />
<GenerateSdkProductArchiveInputs Include="@(SdkProductArchiveResourcesTemplateFiles)" />
</ItemGroup>
</Target>
@ -91,11 +103,17 @@
DestinationFiles="@(AspNetRuntimeFilesInput->'$(SdkLayoutOutputDirectory)/%(RecursiveDir)%(FileName)%(Extension)')" />
<ReplaceFileContents
InputFile="$(SdkPkgScriptTemplateFile)"
DestinationFile="$(SdkPkgScriptFile)"
InputFiles="$(SdkPkgScriptTemplateFile)"
DestinationFiles="$(SdkPkgScriptFile)"
ReplacementPatterns="@(PostInstallScriptReplacement -> '%(Identity)')"
ReplacementStrings="@(PostInstallScriptReplacement -> '%(ReplacementString)')" />
<ReplaceFileContents
InputFiles="@(SdkProductArchiveResourcesTemplateFiles)"
DestinationFiles="@(SdkProductArchiveResourcesTemplateFiles -> '$(SdkProductArchiveResourcesDirectory)/%(RecursiveDir)%(Filename)%(Extension)')"
ReplacementPatterns="@(ResourcesReplacement -> '%(Identity)')"
ReplacementStrings="@(ResourcesReplacement -> '%(ReplacementString)')" />
<Chmod
Glob="$(SdkPkgScriptFile)"
Mode="ugo+x" />
@ -130,8 +148,8 @@
<!-- Fill out parameters in the Distribution Template -->
<ReplaceFileContents
InputFile="$(SdkProductArchiveDistributionTemplateFile)"
DestinationFile="$(SdkProductArchiveDistributionFile)"
InputFiles="$(SdkProductArchiveDistributionTemplateFile)"
DestinationFiles="$(SdkProductArchiveDistributionFile)"
ReplacementPatterns="@(DistributionTemplateReplacement -> '%(Identity)')"
ReplacementStrings="@(DistributionTemplateReplacement -> '%(ReplacementString)')" />

View file

@ -104,8 +104,8 @@
<GeneratedInstallers Include="$(SdkInstallerFile)" />
</ItemGroup>
<ReplaceFileContents InputFile="$(AfterInstallHostScriptTemplateFile)"
DestinationFile="$(AfterInstallHostScriptDestinationFile)"
<ReplaceFileContents InputFiles="$(AfterInstallHostScriptTemplateFile)"
DestinationFiles="$(AfterInstallHostScriptDestinationFile)"
ReplacementItems="@(AfterInstallHostTokenValue)"/>
<Chmod

View file

@ -9,8 +9,8 @@
<Message Text="$(VersionBadge)" />
<ReplaceFileContents
InputFile="$(VersionSvgTemplate)"
DestinationFile="$(VersionBadge)"
InputFiles="$(VersionSvgTemplate)"
DestinationFiles="$(VersionBadge)"
ReplacementPatterns="ver_number"
ReplacementStrings="$(SdkVersion)" />
</Target>
@ -21,8 +21,8 @@
<Message Text="$(CoherentBadge)" />
<ReplaceFileContents
InputFile="$(VersionSvgTemplate)"
DestinationFile="$(CoherentBadge)"
InputFiles="$(VersionSvgTemplate)"
DestinationFiles="$(CoherentBadge)"
ReplacementPatterns="ver_number"
ReplacementStrings="$(SdkVersion)" />
</Target>

View file

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

View file

@ -7,9 +7,9 @@
<div align="left" style="font-family: Helvetica;padding-left:10px">
<p>The following was installed at /usr/local/share/dotnet</h2>
<ul>
<li>.NET Core SDK 2.1.300</li>
<li>.NET Core Runtime 2.1.0</li>
<li>ASP.NET Core Runtime 2.1.0</li>
<li>.NET Core SDK {DOTNETSDKVERSION}</li>
<li>.NET Core Runtime {DOTNETRUNTIMEVERSION}</li>
<li>ASP.NET Core Runtime {ASPNETCOREVERSION}</li>
</ul>
</div>
<br>

View file

@ -7,9 +7,9 @@
<div align="left" style="font-family: Helvetica;padding-left:10px">
<p>The following was installed at /usr/local/share/dotnet</h2>
<ul>
<li>.NET Core SDK 2.1.300</li>
<li>.NET Core Runtime 2.1.0</li>
<li>ASP.NET Core Runtime 2.1.0</li>
<li>.NET Core SDK {DOTNETSDKVERSION}</li>
<li>.NET Core Runtime {DOTNETRUNTIMEVERSION}</li>
<li>ASP.NET Core Runtime {ASPNETCOREVERSION}</li>
</ul>
</div>
<br>

View file

@ -7,9 +7,9 @@
<div align="left" style="font-family: Helvetica;padding-left:10px">
<p>The following was installed at /usr/local/share/dotnet</h2>
<ul>
<li>.NET Core SDK 2.1.300</li>
<li>.NET Core Runtime 2.1.0</li>
<li>ASP.NET Core Runtime 2.1.0</li>
<li>.NET Core SDK {DOTNETSDKVERSION}</li>
<li>.NET Core Runtime {DOTNETRUNTIMEVERSION}</li>
<li>ASP.NET Core Runtime {ASPNETCOREVERSION}</li>
</ul>
</div>
<br>

View file

@ -7,9 +7,9 @@
<div align="left" style="font-family: Helvetica;padding-left:10px">
<p>The following was installed at /usr/local/share/dotnet</h2>
<ul>
<li>.NET Core SDK 2.1.300</li>
<li>.NET Core Runtime 2.1.0</li>
<li>ASP.NET Core Runtime 2.1.0</li>
<li>.NET Core SDK {DOTNETSDKVERSION}</li>
<li>.NET Core Runtime {DOTNETRUNTIMEVERSION}</li>
<li>ASP.NET Core Runtime {ASPNETCOREVERSION}</li>
</ul>
</div>
<br>

View file

@ -7,9 +7,9 @@
<div align="left" style="font-family: Helvetica;padding-left:10px">
<p>The following was installed at /usr/local/share/dotnet</h2>
<ul>
<li>.NET Core SDK 2.1.300</li>
<li>.NET Core Runtime 2.1.0</li>
<li>ASP.NET Core Runtime 2.1.0</li>
<li>.NET Core SDK {DOTNETSDKVERSION}</li>
<li>.NET Core Runtime {DOTNETRUNTIMEVERSION}</li>
<li>ASP.NET Core Runtime {ASPNETCOREVERSION}</li>
</ul>
</div>
<br>

View file

@ -7,9 +7,9 @@
<div align="left" style="font-family: Helvetica;padding-left:10px">
<p>The following was installed at /usr/local/share/dotnet</h2>
<ul>
<li>.NET Core SDK 2.1.300</li>
<li>.NET Core Runtime 2.1.0</li>
<li>ASP.NET Core Runtime 2.1.0</li>
<li>.NET Core SDK {DOTNETSDKVERSION}</li>
<li>.NET Core Runtime {DOTNETRUNTIMEVERSION}</li>
<li>ASP.NET Core Runtime {ASPNETCOREVERSION}</li>
</ul>
</div>
<br>

View file

@ -7,9 +7,9 @@
<div align="left" style="font-family: Helvetica;padding-left:10px">
<p>The following was installed at /usr/local/share/dotnet</h2>
<ul>
<li>.NET Core SDK 2.1.300</li>
<li>.NET Core Runtime 2.1.0</li>
<li>ASP.NET Core Runtime 2.1.0</li>
<li>.NET Core SDK {DOTNETSDKVERSION}</li>
<li>.NET Core Runtime {DOTNETRUNTIMEVERSION}</li>
<li>ASP.NET Core Runtime {ASPNETCOREVERSION}</li>
</ul>
</div>
<br>

View file

@ -7,9 +7,9 @@
<div align="left" style="font-family: Helvetica;padding-left:10px">
<p>The following was installed at /usr/local/share/dotnet</h2>
<ul>
<li>.NET Core SDK 2.1.300</li>
<li>.NET Core Runtime 2.1.0</li>
<li>ASP.NET Core Runtime 2.1.0</li>
<li>.NET Core SDK {DOTNETSDKVERSION}</li>
<li>.NET Core Runtime {DOTNETRUNTIMEVERSION}</li>
<li>ASP.NET Core Runtime {ASPNETCOREVERSION}</li>
</ul>
</div>
<br>

View file

@ -7,9 +7,9 @@
<div align="left" style="font-family: Helvetica;padding-left:10px">
<p>The following was installed at /usr/local/share/dotnet</h2>
<ul>
<li>.NET Core SDK 2.1.300</li>
<li>.NET Core Runtime 2.1.0</li>
<li>ASP.NET Core Runtime 2.1.0</li>
<li>.NET Core SDK {DOTNETSDKVERSION}</li>
<li>.NET Core Runtime {DOTNETRUNTIMEVERSION}</li>
<li>ASP.NET Core Runtime {ASPNETCOREVERSION}</li>
</ul>
</div>
<br>

View file

@ -7,9 +7,9 @@
<div align="left" style="font-family: Helvetica;padding-left:10px">
<p>The following was installed at /usr/local/share/dotnet</h2>
<ul>
<li>.NET Core SDK 2.1.300</li>
<li>.NET Core Runtime 2.1.0</li>
<li>ASP.NET Core Runtime 2.1.0</li>
<li>.NET Core SDK {DOTNETSDKVERSION}</li>
<li>.NET Core Runtime {DOTNETRUNTIMEVERSION}</li>
<li>ASP.NET Core Runtime {ASPNETCOREVERSION}</li>
</ul>
</div>
<br>

View file

@ -7,9 +7,9 @@
<div align="left" style="font-family: Helvetica;padding-left:10px">
<p>The following was installed at /usr/local/share/dotnet</h2>
<ul>
<li>.NET Core SDK 2.1.300</li>
<li>.NET Core Runtime 2.1.0</li>
<li>ASP.NET Core Runtime 2.1.0</li>
<li>.NET Core SDK {DOTNETSDKVERSION}</li>
<li>.NET Core Runtime {DOTNETRUNTIMEVERSION}</li>
<li>ASP.NET Core Runtime {ASPNETCOREVERSION}</li>
</ul>
</div>
<br>

View file

@ -7,9 +7,9 @@
<div align="left" style="font-family: Helvetica;padding-left:10px">
<p>The following was installed at /usr/local/share/dotnet</h2>
<ul>
<li>.NET Core SDK 2.1.300</li>
<li>.NET Core Runtime 2.1.0</li>
<li>ASP.NET Core Runtime 2.1.0</li>
<li>.NET Core SDK {DOTNETSDKVERSION}</li>
<li>.NET Core Runtime {DOTNETRUNTIMEVERSION}</li>
<li>ASP.NET Core Runtime {ASPNETCOREVERSION}</li>
</ul>
</div>
<br>

View file

@ -7,9 +7,9 @@
<div align="left" style="font-family: Helvetica;padding-left:10px">
<p>The following was installed at /usr/local/share/dotnet</h2>
<ul>
<li>.NET Core SDK 2.1.300</li>
<li>.NET Core Runtime 2.1.0</li>
<li>ASP.NET Core Runtime 2.1.0</li>
<li>.NET Core SDK {DOTNETSDKVERSION}</li>
<li>.NET Core Runtime {DOTNETRUNTIMEVERSION}</li>
<li>ASP.NET Core Runtime {ASPNETCOREVERSION}</li>
</ul>
</div>
<br>

View file

@ -7,9 +7,9 @@
<div align="left" style="font-family: Helvetica;padding-left:10px">
<p>The following was installed at /usr/local/share/dotnet</h2>
<ul>
<li>.NET Core SDK 2.1.300</li>
<li>.NET Core Runtime 2.1.0</li>
<li>ASP.NET Core Runtime 2.1.0</li>
<li>.NET Core SDK {DOTNETSDKVERSION}</li>
<li>.NET Core Runtime {DOTNETRUNTIMEVERSION}</li>
<li>ASP.NET Core Runtime {ASPNETCOREVERSION}</li>
</ul>
</div>
<br>

View file

@ -50,9 +50,9 @@
<String Id="FirstTimeWelcomeMessage">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

View file

@ -24,6 +24,9 @@
<Variable Name="DOTNETHOME" Type="string" Value="[ProgramFiles6432Folder]dotnet" bal:Overridable="no" />
<Variable Name="BUNDLEMONIKER" Type="string" Value="$(var.ProductMoniker)" bal:Overridable="no" />
<Variable Name="DOTNETSDKVERSION" Type="string" Value="$(var.DisplayVersion)" bal:Overridable="no" />
<Variable Name="DOTNETRUNTIMEVERSION" Type="string" Value="$(var.DotNetRuntimeVersion)" bal:Overridable="no" />
<Variable Name="ASPNETCOREVERSION" Type="string" Value="$(var.AspNetCoreVersion)" bal:Overridable="no" />
<Chain DisableSystemRestore="yes" ParallelCache="yes">
<MsiPackage SourceFile="$(var.SharedFXMsiSourcePath)">

View file

@ -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 `

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>

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

@ -356,8 +356,8 @@
<ReplacementString>"version": "$(MicrosoftNETCoreAppPackageVersion)"</ReplacementString>
</PropertyGroup>
<ReplaceFileContents
InputFile="$(VSTestRuntimeConfigPath)"
DestinationFile="$(VSTestRuntimeConfigPath)"
InputFiles="$(VSTestRuntimeConfigPath)"
DestinationFiles="$(VSTestRuntimeConfigPath)"
ReplacementPatterns="$(ReplacementPattern)"
ReplacementStrings="$(ReplacementString)" />
</Target>

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