Merged PR 126597: Merge from upstream release/2.1.3xx

Merge from upstream release/2.1.3xx

Note: this conflicted with several cherry-picked commits that were already present in release/2.1.3xx-MSRC.
This commit is contained in:
Peter Huene 2018-06-12 17:36:06 +00:00
commit b7eb74ff6b
14 changed files with 64 additions and 22 deletions

View file

@ -13,12 +13,11 @@
Condition="!Exists('$(DotnetToolsNuPkgPath)/$(TemplateFillInPackageName.ToLower())')">
<PropertyGroup>
<DotnetToolsRestoreAdditionalParameters>--runtime any</DotnetToolsRestoreAdditionalParameters>
<DotnetToolsRestoreAdditionalParameters>--runtime any /p:RestoreProjectStyle=DotnetToolReference</DotnetToolsRestoreAdditionalParameters>
<DotnetToolsRestoreAdditionalParameters>$(DotnetToolsRestoreAdditionalParameters) /p:TargetFramework=$(CliTargetFramework)</DotnetToolsRestoreAdditionalParameters>
<DotnetToolsRestoreAdditionalParameters>$(DotnetToolsRestoreAdditionalParameters) /p:TemplateFillInPackageName=$(TemplateFillInPackageName)</DotnetToolsRestoreAdditionalParameters>
<DotnetToolsRestoreAdditionalParameters>$(DotnetToolsRestoreAdditionalParameters) /p:TemplateFillInPackageVersion=$(TemplateFillInPackageVersion)</DotnetToolsRestoreAdditionalParameters>
<DotnetToolsRestoreAdditionalParameters>$(DotnetToolsRestoreAdditionalParameters) /p:RestorePackagesPath=$(DotnetToolsLayoutDirectory)</DotnetToolsRestoreAdditionalParameters>
<DotnetToolsRestoreAdditionalParameters Condition=" $(DotnetToolsRestoreProjectStyle) != '' " >$(DotnetToolsRestoreAdditionalParameters) /p:RestoreProjectStyle=$(DotnetToolsRestoreProjectStyle)</DotnetToolsRestoreAdditionalParameters>
</PropertyGroup>
<DotNetRestore ToolPath="$(PreviousStageDirectory)"

View file

@ -6,24 +6,21 @@
<!-- only the runtime OSX .pkgs have a `-internal` suffix -->
<InstallerStartSuffix Condition="'$(HostOSName)' == 'osx'">-internal</InstallerStartSuffix>
<!-- deb and rpm based installers have the `-upgrade` suffx -->
<InstallerEndSuffix Condition=" '$(IsDebianBaseDistro)' == 'true' OR '$(IsRPMBasedDistro)' == 'true' ">-upgrade</InstallerEndSuffix>
<!-- Downloaded Installers + Archives -->
<DownloadedRuntimeDepsInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-runtime-deps-$(SharedHostVersion)-$(CoreSetupRid)$(InstallerEndSuffix)$(InstallerExtension)</DownloadedRuntimeDepsInstallerFileName>
<DownloadedRuntimeDepsInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-runtime-deps-$(SharedHostVersion)-$(CoreSetupRid)$(InstallerExtension)</DownloadedRuntimeDepsInstallerFileName>
<DownloadedRuntimeDepsInstallerFile Condition=" '$(InstallerExtension)' != '' ">$(PackagesDirectory)/$(DownloadedRuntimeDepsInstallerFileName)</DownloadedRuntimeDepsInstallerFile>
<!-- Use the "x64" Rid when downloading Linux shared framework 'DEB' installer files. -->
<SharedFrameworkInstallerFileRid>$(CoreSetupRid)</SharedFrameworkInstallerFileRid>
<SharedFrameworkInstallerFileRid Condition=" '$(IsDebianBaseDistro)' == 'true' OR '$(IsRPMBasedDistro)' == 'true' ">x64</SharedFrameworkInstallerFileRid>
<DownloadedSharedHostInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-host$(InstallerStartSuffix)-$(SharedHostVersion)-$(SharedFrameworkInstallerFileRid)$(InstallerEndSuffix)$(InstallerExtension)</DownloadedSharedHostInstallerFileName>
<DownloadedSharedHostInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-host$(InstallerStartSuffix)-$(SharedHostVersion)-$(SharedFrameworkInstallerFileRid)$(InstallerExtension)</DownloadedSharedHostInstallerFileName>
<DownloadedSharedHostInstallerFile Condition=" '$(InstallerExtension)' != '' ">$(PackagesDirectory)/$(DownloadedSharedHostInstallerFileName)</DownloadedSharedHostInstallerFile>
<DownloadedHostFxrInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-hostfxr$(InstallerStartSuffix)-$(HostFxrVersion)-$(SharedFrameworkInstallerFileRid)$(InstallerEndSuffix)$(InstallerExtension)</DownloadedHostFxrInstallerFileName>
<DownloadedHostFxrInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-hostfxr$(InstallerStartSuffix)-$(HostFxrVersion)-$(SharedFrameworkInstallerFileRid)$(InstallerExtension)</DownloadedHostFxrInstallerFileName>
<DownloadedHostFxrInstallerFile Condition=" '$(InstallerExtension)' != '' ">$(PackagesDirectory)/$(DownloadedHostFxrInstallerFileName)</DownloadedHostFxrInstallerFile>
<DownloadedSharedFrameworkInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-runtime$(InstallerStartSuffix)-$(MicrosoftNETCoreAppPackageVersion)-$(SharedFrameworkInstallerFileRid)$(InstallerEndSuffix)$(InstallerExtension)</DownloadedSharedFrameworkInstallerFileName>
<DownloadedSharedFrameworkInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-runtime$(InstallerStartSuffix)-$(MicrosoftNETCoreAppPackageVersion)-$(SharedFrameworkInstallerFileRid)$(InstallerExtension)</DownloadedSharedFrameworkInstallerFileName>
<DownloadedSharedFrameworkInstallerFile Condition=" '$(InstallerExtension)' != '' ">$(PackagesDirectory)/$(DownloadedSharedFrameworkInstallerFileName)</DownloadedSharedFrameworkInstallerFile>
<!-- Use the portable "linux-x64" Rid when downloading Linux shared framework compressed file. -->

View file

@ -9,7 +9,7 @@
<DotnetSqlCachePackageVersion>2.1.0</DotnetSqlCachePackageVersion>
<DotnetUserSecretsPackageVersion>2.1.0</DotnetUserSecretsPackageVersion>
<DotnetWatchPackageVersion>2.1.0</DotnetWatchPackageVersion>
<MicrosoftNETCoreAppPackageVersion>2.1.1-rtm-26531-02</MicrosoftNETCoreAppPackageVersion>
<MicrosoftNETCoreAppPackageVersion>2.1.1-servicing-26605-02</MicrosoftNETCoreAppPackageVersion>
<MicrosoftNETCoreDotNetHostResolverPackageVersion>$(MicrosoftNETCoreAppPackageVersion)</MicrosoftNETCoreDotNetHostResolverPackageVersion>
<MicrosoftBuildPackageVersion>15.7.179</MicrosoftBuildPackageVersion>
<MicrosoftBuildFrameworkPackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildFrameworkPackageVersion>

View file

@ -116,6 +116,13 @@
<_AspNetCoreAllPackageVersion>$(MicrosoftAspNetCoreAllPackageVersion)</_AspNetCoreAllPackageVersion>
<_AspNetCoreAppPackageVersion>$(MicrosoftAspNetCoreAppPackageVersion)</_AspNetCoreAppPackageVersion>
<!-- Default aspnetcore patch versions, specified as a stabilized version -->
<_DefaultPatchVersionForAspNetCoreAll2_1>2.1.1</_DefaultPatchVersionForAspNetCoreAll2_1>
<_DefaultPatchVersionForAspNetCoreApp2_1>$(_DefaultPatchVersionForAspNetCoreAll2_1)</_DefaultPatchVersionForAspNetCoreApp2_1>
<!-- If we are currently building a prerelease of the version that we intend to lock to, set the default version to the ingested version instead of the stabilized version. -->
<_DefaultPatchVersionForAspNetCoreAll2_1 Condition="$(_AspNetCoreAllPackageVersion.StartsWith('$(_DefaultPatchVersionForAspNetCoreAll2_1)-'))">$(_AspNetCoreAllPackageVersion)</_DefaultPatchVersionForAspNetCoreAll2_1>
<_DefaultPatchVersionForAspNetCoreApp2_1 Condition="$(_AspNetCoreAppPackageVersion.StartsWith('$(_DefaultPatchVersionForAspNetCoreApp2_1)-'))">$(_AspNetCoreAppPackageVersion)</_DefaultPatchVersionForAspNetCoreApp2_1>
<!-- Use only major and minor in target framework version -->
<_NETCoreAppTargetFrameworkVersion>$(_NETCoreAppPackageVersion.Split('.')[0]).$(_NETCoreAppPackageVersion.Split('.')[1])</_NETCoreAppTargetFrameworkVersion>
<_NETStandardTargetFrameworkVersion>$(_NETStandardLibraryPackageVersion.Split('.')[0]).$(_NETStandardLibraryPackageVersion.Split('.')[1])</_NETStandardTargetFrameworkVersion>
@ -170,6 +177,10 @@ Copyright (c) .NET Foundation. All rights reserved.
<NETCoreSdkVersion>$(SdkVersion)</NETCoreSdkVersion>
<_NETCoreSdkIsPreview>$(_NETCoreSdkIsPreview)</_NETCoreSdkIsPreview>
<!-- Default patch versions for each minor version of ASP.NET Core -->
<DefaultPatchVersionForAspNetCoreAll2_1>$(_DefaultPatchVersionForAspNetCoreAll2_1)</DefaultPatchVersionForAspNetCoreAll2_1>
<DefaultPatchVersionForAspNetCoreApp2_1>$(_DefaultPatchVersionForAspNetCoreApp2_1)</DefaultPatchVersionForAspNetCoreApp2_1>
<!-- Latest patch versions for each minor version of .NET Core -->
<LatestPatchVersionForNetCore1_0 Condition="'$(LatestPatchVersionForNetCore1_0)' == ''">1.0.11</LatestPatchVersionForNetCore1_0>
<LatestPatchVersionForNetCore1_1 Condition="'$(LatestPatchVersionForNetCore1_1)' == ''">1.1.8</LatestPatchVersionForNetCore1_1>

View file

@ -54,6 +54,8 @@
Condition=" '$(OS)' == 'Windows_NT' And '$(Architecture)' == 'x64' "/>
<ForPublishing Include="$(PackagesDirectory)/VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.swr"
Condition=" '$(OS)' == 'Windows_NT' And '$(Architecture)' == 'x64' "/>
<ForPublishing Include="$(PackagesDirectory)/nuGetPackagesArchive.lzma"
Condition=" '$(OS)' == 'Windows_NT' And '$(Architecture)' == 'x64' "/>
</ItemGroup>
<ItemGroup>

View file

@ -3,6 +3,7 @@
<PropertyGroup>
<FinalArchive>$(SdkOutputDirectory)/nuGetPackagesArchive.lzma</FinalArchive>
<PackagesArchive>$(PackagesDirectory)/nuGetPackagesArchive.lzma</PackagesArchive>
<NugetPackagesArchiveName>nuGetPackagesArchive-$(AspNetCoreVersion).lzma</NugetPackagesArchiveName>
<IntermediateArchive>$(IntermediateDirectory)/$(NugetPackagesArchiveName)</IntermediateArchive>
<NugetPackagesArchiveBlobUrl>$(AspNetCoreSharedFxRootUrl)$(AspNetCoreVersion)/$(NugetPackagesArchiveName)</NugetPackagesArchiveBlobUrl>
@ -17,5 +18,6 @@
ContinueOnError="WarnAndContinue" />
<Copy SourceFiles="$(IntermediateArchive)" DestinationFiles="$(FinalArchive)" />
<Copy SourceFiles="$(IntermediateArchive)" DestinationFiles="$(PackagesArchive)" />
</Target>
</Project>

View file

@ -89,8 +89,8 @@ if($Architecture.StartsWith("arm", [StringComparison]::OrdinalIgnoreCase))
$InstallArchitecture = "x64"
}
Write-Output "$dotnetInstallPath -version ""2.2.0-preview1-007799"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$InstallArchitecture"""
Invoke-Expression "$dotnetInstallPath -version ""2.2.0-preview1-007799"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$InstallArchitecture"""
Write-Output "$dotnetInstallPath -version ""2.1.300"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$InstallArchitecture"""
Invoke-Expression "$dotnetInstallPath -version ""2.1.300"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$InstallArchitecture"""
if ($LastExitCode -ne 0)
{

View file

@ -162,7 +162,7 @@ if [[ $archlower == 'arm'* ]]; then
fi
if [ "$STAGE0_SOURCE_DIR" == "" ]; then
(set -x ; "$REPOROOT/scripts/obtain/dotnet-install.sh" --version "2.2.0-preview1-007799" --install-dir "$DOTNET_INSTALL_DIR" --architecture "$INSTALL_ARCHITECTURE" $LINUX_PORTABLE_INSTALL_ARGS)
(set -x ; "$REPOROOT/scripts/obtain/dotnet-install.sh" --version "2.1.300" --install-dir "$DOTNET_INSTALL_DIR" --architecture "$INSTALL_ARCHITECTURE" $LINUX_PORTABLE_INSTALL_ARGS)
else
echo "Copying bootstrap cli from $STAGE0_SOURCE_DIR"
cp -r $STAGE0_SOURCE_DIR/* "$DOTNET_INSTALL_DIR"

View file

@ -3,6 +3,7 @@
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.DotNet.Cli.Utils
@ -47,5 +48,35 @@ namespace Microsoft.DotNet.Cli.Utils
}
}
}
/// <summary>
/// Run Directory.Move and File.Move in Windows has a chance to get IOException with
/// HResult 0x80070005 due to Indexer. But this error is transient.
/// </summary>
internal static void RetryOnMoveAccessFailure(Action action)
{
const int ERROR_HRESULT_ACCESS_DENIED = unchecked((int)0x80070005);
int nextWaitTime = 10;
int remainRetry = 10;
while (true)
{
try
{
action();
break;
}
catch (IOException e) when (e.HResult == ERROR_HRESULT_ACCESS_DENIED)
{
Thread.Sleep(nextWaitTime);
nextWaitTime *= 2;
remainRetry--;
if (remainRetry == 0)
{
throw;
}
}
}
}
}
}

View file

@ -113,7 +113,7 @@ namespace Microsoft.DotNet.ShellShim
foreach (var file in GetShimFiles(commandName).Where(f => _fileSystem.File.Exists(f.Value)))
{
var tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
_fileSystem.File.Move(file.Value, tempPath);
FileAccessRetrier.RetryOnMoveAccessFailure(() => _fileSystem.File.Move(file.Value, tempPath));
files[file.Value] = tempPath;
}
}
@ -137,7 +137,7 @@ namespace Microsoft.DotNet.ShellShim
rollback: () => {
foreach (var kvp in files)
{
_fileSystem.File.Move(kvp.Value, kvp.Key);
FileAccessRetrier.RetryOnMoveAccessFailure(() => _fileSystem.File.Move(kvp.Value, kvp.Key));
}
});
}

View file

@ -4,6 +4,7 @@ using System.IO;
using System.Linq;
using System.Xml.Linq;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Configurer;
using Microsoft.DotNet.Tools;
using Microsoft.Extensions.EnvironmentAbstractions;
@ -82,7 +83,7 @@ namespace Microsoft.DotNet.ToolPackage
}
Directory.CreateDirectory(packageRootDirectory.Value);
Directory.Move(stageDirectory.Value, packageDirectory.Value);
FileAccessRetrier.RetryOnMoveAccessFailure(() => Directory.Move(stageDirectory.Value, packageDirectory.Value));
rollbackDirectory = packageDirectory.Value;
return new ToolPackageInstance(_store, packageId, version, packageDirectory);

View file

@ -8,6 +8,7 @@ using Microsoft.Extensions.EnvironmentAbstractions;
using NuGet.ProjectModel;
using NuGet.Versioning;
using Microsoft.DotNet.Cli.Utils;
using System.Threading;
namespace Microsoft.DotNet.ToolPackage
{
@ -79,7 +80,7 @@ namespace Microsoft.DotNet.ToolPackage
// Use the staging directory for uninstall
// This prevents cross-device moves when temp is mounted to a different device
var tempPath = _store.GetRandomStagingDirectory().Value;
Directory.Move(PackageDirectory.Value, tempPath);
FileAccessRetrier.RetryOnMoveAccessFailure(() => Directory.Move(PackageDirectory.Value, tempPath));
tempPackageDirectory = tempPath;
}
@ -111,7 +112,7 @@ namespace Microsoft.DotNet.ToolPackage
if (tempPackageDirectory != null)
{
Directory.CreateDirectory(rootDirectory.Value);
Directory.Move(tempPackageDirectory, PackageDirectory.Value);
FileAccessRetrier.RetryOnMoveAccessFailure(() => Directory.Move(tempPackageDirectory, PackageDirectory.Value));
}
});
}

View file

@ -30,8 +30,7 @@
TemplateFillInPackageName=%(BundledDotnetTools.Identity);
TemplateFillInPackageVersion=%(BundledDotnetTools.Version);
PreviousStageDirectory=$(PreviousStageDirectory);
DotnetToolsLayoutDirectory=$(testAssetSourceRoot);
DotnetToolsRestoreProjectStyle=DotnetToolReference
DotnetToolsLayoutDirectory=$(testAssetSourceRoot)
</Properties>
</TestDotnetTools>
</ItemGroup>

View file

@ -54,8 +54,7 @@
TemplateFillInPackageName=dotnet-watch;
TemplateFillInPackageVersion=$(DotnetWatchPackageVersion);
PreviousStageDirectory=$(PreviousStageDirectory);
DotnetToolsLayoutDirectory=$(testAssetSourceRoot);
DotnetToolsRestoreProjectStyle=DotnetToolReference
DotnetToolsLayoutDirectory=$(testAssetSourceRoot)
</Properties>
</TestDotnetTools>
</ItemGroup>