Merge pull request #9381 from dotnet/merges/release/2.1.4xx-to-master

Merge release/2.1.4xx to master
This commit is contained in:
Livar 2018-06-05 22:45:53 -07:00 committed by GitHub
commit 670dcedba2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 216 additions and 108 deletions

View file

@ -5,7 +5,7 @@
<MicrosoftAspNetCoreAppPackageVersion>$(MicrosoftAspNetCoreAllPackageVersion)</MicrosoftAspNetCoreAppPackageVersion> <MicrosoftAspNetCoreAppPackageVersion>$(MicrosoftAspNetCoreAllPackageVersion)</MicrosoftAspNetCoreAppPackageVersion>
<MicrosoftNETCoreAppPackageVersion>2.2.0-preview1-26529-01</MicrosoftNETCoreAppPackageVersion> <MicrosoftNETCoreAppPackageVersion>2.2.0-preview1-26529-01</MicrosoftNETCoreAppPackageVersion>
<MicrosoftNETCoreDotNetHostResolverPackageVersion>$(MicrosoftNETCoreAppPackageVersion)</MicrosoftNETCoreDotNetHostResolverPackageVersion> <MicrosoftNETCoreDotNetHostResolverPackageVersion>$(MicrosoftNETCoreAppPackageVersion)</MicrosoftNETCoreDotNetHostResolverPackageVersion>
<MicrosoftBuildPackageVersion>15.8.0-preview-000061</MicrosoftBuildPackageVersion> <MicrosoftBuildPackageVersion>15.8.0-preview-000060</MicrosoftBuildPackageVersion>
<MicrosoftBuildFrameworkPackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildFrameworkPackageVersion> <MicrosoftBuildFrameworkPackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildFrameworkPackageVersion>
<MicrosoftBuildRuntimePackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildRuntimePackageVersion> <MicrosoftBuildRuntimePackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildRuntimePackageVersion>
<MicrosoftBuildLocalizationPackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildLocalizationPackageVersion> <MicrosoftBuildLocalizationPackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildLocalizationPackageVersion>

View file

@ -8,7 +8,8 @@
<MajorMinorVersion>$(VersionMajor).$(VersionMinor)</MajorMinorVersion> <MajorMinorVersion>$(VersionMajor).$(VersionMinor)</MajorMinorVersion>
<CliVersionNoSuffix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</CliVersionNoSuffix> <CliVersionNoSuffix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</CliVersionNoSuffix>
<CliVersionPrefix>$(CliVersionNoSuffix)-$(ReleaseSuffix)</CliVersionPrefix> <CliVersionPrefix>$(CliVersionNoSuffix)-$(ReleaseSuffix)</CliVersionPrefix>
<CliBrandingVersion>$(CliVersionNoSuffix) - $(ReleaseSuffix)</CliBrandingVersion> <CliBrandingVersion Condition=" '$(DropSuffix)' != 'true' ">$(CliVersionNoSuffix) - $(ReleaseSuffix)</CliBrandingVersion>
<CliBrandingVersion Condition=" '$(DropSuffix)' == 'true' ">$(CliVersionNoSuffix)</CliBrandingVersion>
<SimpleVersion Condition=" '$(DropSuffix)' != 'true' ">$(CliVersionNoSuffix).$(CommitCount)</SimpleVersion> <SimpleVersion Condition=" '$(DropSuffix)' != 'true' ">$(CliVersionNoSuffix).$(CommitCount)</SimpleVersion>
<SimpleVersion Condition=" '$(SimpleVersion)' == '' ">$(CliVersionNoSuffix)</SimpleVersion> <SimpleVersion Condition=" '$(SimpleVersion)' == '' ">$(CliVersionNoSuffix)</SimpleVersion>

View file

@ -119,6 +119,11 @@ namespace Microsoft.DotNet.Tools.Common
/// </summary> /// </summary>
public static string GetRelativePath(string path1, string path2) public static string GetRelativePath(string path1, string path2)
{ {
if (!Path.IsPathRooted(path1) || !Path.IsPathRooted(path2))
{
throw new ArgumentException("both paths need to be rooted/full path");
}
return GetRelativePath(path1, path2, Path.DirectorySeparatorChar, true); return GetRelativePath(path1, path2, Path.DirectorySeparatorChar, true);
} }

View file

@ -7,6 +7,7 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyMetadataAttribute("Serviceable", "True")] [assembly: AssemblyMetadataAttribute("Serviceable", "True")]
[assembly: InternalsVisibleTo("dotnet, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("dotnet, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("dotnet.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("dotnet.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.Configurer, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.Tools.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.DotNet.Tools.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.Cli.Utils.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.DotNet.Cli.Utils.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.TestFramework, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.DotNet.TestFramework, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]

View file

@ -21,7 +21,7 @@ namespace Microsoft.DotNet.Configurer
private string SentinelPath => Path.Combine(_dotnetUserProfileFolderPath, SENTINEL); private string SentinelPath => Path.Combine(_dotnetUserProfileFolderPath, SENTINEL);
public AspNetCertificateSentinel(CliFolderPathCalculator cliFallbackFolderPathCalculator) : public AspNetCertificateSentinel() :
this( this(
CliFolderPathCalculator.DotnetUserProfileFolderPath, CliFolderPathCalculator.DotnetUserProfileFolderPath,
FileSystemWrapper.Default.File, FileSystemWrapper.Default.File,

View file

@ -4,40 +4,59 @@
using System; using System;
using System.IO; using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Microsoft.DotNet.Cli.Utils;
using NuGet.Common; using NuGet.Common;
namespace Microsoft.DotNet.Configurer namespace Microsoft.DotNet.Configurer
{ {
public class CliFolderPathCalculator public static class CliFolderPathCalculator
{ {
public const string DotnetHomeVariableName = "DOTNET_CLI_HOME";
private const string DotnetProfileDirectoryName = ".dotnet"; private const string DotnetProfileDirectoryName = ".dotnet";
private const string ToolsShimFolderName = "tools"; private const string ToolsShimFolderName = "tools";
public string CliFallbackFolderPath => Environment.GetEnvironmentVariable("DOTNET_CLI_TEST_FALLBACKFOLDER") ?? public static string CliFallbackFolderPath =>
Path.Combine(new DirectoryInfo(AppContext.BaseDirectory).Parent.FullName, "NuGetFallbackFolder"); Environment.GetEnvironmentVariable("DOTNET_CLI_TEST_FALLBACKFOLDER") ??
public string ToolsShimPath => Path.Combine(DotnetUserProfileFolderPath, ToolsShimFolderName); Path.Combine(new DirectoryInfo(AppContext.BaseDirectory).Parent.FullName, "NuGetFallbackFolder");
public string ToolsPackagePath => ToolPackageFolderPathCalculator.GetToolPackageFolderPath(ToolsShimPath);
public BashPathUnderHomeDirectory ToolsShimPathInUnix public static string ToolsShimPath => Path.Combine(DotnetUserProfileFolderPath, ToolsShimFolderName);
public static string ToolsPackagePath => ToolPackageFolderPathCalculator.GetToolPackageFolderPath(ToolsShimPath);
public static BashPathUnderHomeDirectory ToolsShimPathInUnix =>
new BashPathUnderHomeDirectory(
DotnetHomePath,
Path.Combine(DotnetProfileDirectoryName, ToolsShimFolderName));
public static string DotnetUserProfileFolderPath =>
Path.Combine(DotnetHomePath, DotnetProfileDirectoryName);
public static string PlatformHomeVariableName =>
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "USERPROFILE" : "HOME";
public static string DotnetHomePath
{ {
get get
{ {
return new BashPathUnderHomeDirectory(Environment.GetEnvironmentVariable("HOME"), var home = Environment.GetEnvironmentVariable(DotnetHomeVariableName);
Path.Combine(DotnetProfileDirectoryName, ToolsShimFolderName)); if (string.IsNullOrEmpty(home))
{
home = Environment.GetEnvironmentVariable(PlatformHomeVariableName);
if (string.IsNullOrEmpty(home))
{
throw new ConfigurationException(
string.Format(
LocalizableStrings.FailedToDetermineUserHomeDirectory,
DotnetHomeVariableName))
.DisplayAsError();
}
}
return home;
} }
} }
public static string DotnetUserProfileFolderPath public static string NuGetUserSettingsDirectory =>
{
get
{
string profileDir = Environment.GetEnvironmentVariable(
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "USERPROFILE" : "HOME");
return Path.Combine(profileDir, DotnetProfileDirectoryName);
}
}
public string NuGetUserSettingsDirectory =>
NuGetEnvironment.GetFolderPath(NuGetFolderPath.UserSettingsDirectory); NuGetEnvironment.GetFolderPath(NuGetFolderPath.UserSettingsDirectory);
} }
} }

View file

@ -0,0 +1,22 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace Microsoft.DotNet.Configurer
{
internal class ConfigurationException : Exception
{
public ConfigurationException()
{
}
public ConfigurationException(string message) : base(message)
{
}
public ConfigurationException(string message, Exception innerException) : base(message, innerException)
{
}
}
}

View file

@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Configurer
private string SentinelPath => Path.Combine(_dotnetUserProfileFolderPath, SENTINEL); private string SentinelPath => Path.Combine(_dotnetUserProfileFolderPath, SENTINEL);
public FirstTimeUseNoticeSentinel(CliFolderPathCalculator cliFolderPathCalculator) : public FirstTimeUseNoticeSentinel() :
this( this(
CliFolderPathCalculator.DotnetUserProfileFolderPath, CliFolderPathCalculator.DotnetUserProfileFolderPath,
FileSystemWrapper.Default.File, FileSystemWrapper.Default.File,

View file

@ -154,4 +154,7 @@ Successfully installed the ASP.NET Core HTTPS Development Certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only). For establishing trust on other platforms refer to the platform specific documentation. To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only). For establishing trust on other platforms refer to the platform specific documentation.
For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.</value> For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.</value>
</data> </data>
<data name="FailedToDetermineUserHomeDirectory" xml:space="preserve">
<value>The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</value>
</data>
</root> </root>

View file

@ -17,6 +17,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="NETStandard.Library" Version="2.0.0" />
<PackageReference Include="NuGet.Common" Version="$(NuGetCommonPackageVersion)" /> <PackageReference Include="NuGet.Common" Version="$(NuGetCommonPackageVersion)" />
<PackageReference Include="NuGet.Configuration" Version="$(NuGetConfigurationPackageVersion)" /> <PackageReference Include="NuGet.Configuration" Version="$(NuGetConfigurationPackageVersion)" />
<PackageReference Include="Microsoft.DotNet.Archive" Version="$(MicrosoftDotNetArchivePackageVersion)" /> <PackageReference Include="Microsoft.DotNet.Archive" Version="$(MicrosoftDotNetArchivePackageVersion)" />

View file

@ -17,31 +17,20 @@ namespace Microsoft.DotNet.Configurer
private readonly INuGetCacheSentinel _nuGetCacheSentinel; private readonly INuGetCacheSentinel _nuGetCacheSentinel;
private readonly CliFolderPathCalculator _cliFolderPathCalculator; public NuGetCachePrimer(INuGetPackagesArchiver nugetPackagesArchiver, INuGetCacheSentinel nuGetCacheSentinel)
: this(nugetPackagesArchiver, nuGetCacheSentinel, FileSystemWrapper.Default.File)
public NuGetCachePrimer(
INuGetPackagesArchiver nugetPackagesArchiver,
INuGetCacheSentinel nuGetCacheSentinel,
CliFolderPathCalculator cliFolderPathCalculator)
: this(nugetPackagesArchiver,
nuGetCacheSentinel,
cliFolderPathCalculator,
FileSystemWrapper.Default.File)
{ {
} }
internal NuGetCachePrimer( internal NuGetCachePrimer(
INuGetPackagesArchiver nugetPackagesArchiver, INuGetPackagesArchiver nugetPackagesArchiver,
INuGetCacheSentinel nuGetCacheSentinel, INuGetCacheSentinel nuGetCacheSentinel,
CliFolderPathCalculator cliFolderPathCalculator,
IFile file) IFile file)
{ {
_nugetPackagesArchiver = nugetPackagesArchiver; _nugetPackagesArchiver = nugetPackagesArchiver;
_nuGetCacheSentinel = nuGetCacheSentinel; _nuGetCacheSentinel = nuGetCacheSentinel;
_cliFolderPathCalculator = cliFolderPathCalculator;
_file = file; _file = file;
} }
@ -52,7 +41,7 @@ namespace Microsoft.DotNet.Configurer
return; return;
} }
var nuGetFallbackFolder = _cliFolderPathCalculator.CliFallbackFolderPath; var nuGetFallbackFolder = CliFolderPathCalculator.CliFallbackFolderPath;
_nugetPackagesArchiver.ExtractArchive(nuGetFallbackFolder); _nugetPackagesArchiver.ExtractArchive(nuGetFallbackFolder);

View file

@ -27,8 +27,8 @@ namespace Microsoft.DotNet.Configurer
private Stream InProgressSentinel { get; set; } private Stream InProgressSentinel { get; set; }
public NuGetCacheSentinel(CliFolderPathCalculator cliFolderPathCalculator) : public NuGetCacheSentinel() :
this(cliFolderPathCalculator.CliFallbackFolderPath, this(CliFolderPathCalculator.CliFallbackFolderPath,
FileSystemWrapper.Default.File, FileSystemWrapper.Default.File,
FileSystemWrapper.Default.Directory) FileSystemWrapper.Default.Directory)
{ {

View file

@ -14,7 +14,7 @@ namespace Microsoft.DotNet.Configurer
private readonly IDirectory _directory; private readonly IDirectory _directory;
private string _dotnetUserProfileFolderPath; private string _dotnetUserProfileFolderPath;
public UserLevelCacheWriter(CliFolderPathCalculator cliFolderPathCalculator) : public UserLevelCacheWriter() :
this( this(
CliFolderPathCalculator.DotnetUserProfileFolderPath, CliFolderPathCalculator.DotnetUserProfileFolderPath,
FileSystemWrapper.Default.File, FileSystemWrapper.Default.File,

View file

@ -71,6 +71,11 @@ Pokud chcete certifikátu důvěřovat (platí jenom pro Windows a macOS), nains
Další informace o konfiguraci protokolu HTTPS najdete na webu https://go.microsoft.com/fwlink/?linkid=848054.</target> Další informace o konfiguraci protokolu HTTPS najdete na webu https://go.microsoft.com/fwlink/?linkid=848054.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="FailedToDetermineUserHomeDirectory">
<source>The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</source>
<target state="new">The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -71,6 +71,11 @@ Um dem Zertifikat zu vertrauen (nur Windows und macOS), installieren Sie zuerst
Weitere Informationen zur Konfiguration von HTTPS finden Sie unter https://go.microsoft.com/fwlink/?linkid=848054.</target> Weitere Informationen zur Konfiguration von HTTPS finden Sie unter https://go.microsoft.com/fwlink/?linkid=848054.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="FailedToDetermineUserHomeDirectory">
<source>The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</source>
<target state="new">The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -70,6 +70,11 @@ Para confiar en el certificado (solo Windows y macOS), instale primero la herram
Para obtener más información sobre la configuración HTTPS, vea https://go.microsoft.com/fwlink/?linkid=848054.</target> Para obtener más información sobre la configuración HTTPS, vea https://go.microsoft.com/fwlink/?linkid=848054.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="FailedToDetermineUserHomeDirectory">
<source>The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</source>
<target state="new">The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -71,6 +71,11 @@ Pour approuver le certificat (Windows et macOS uniquement), installez d'abord l'
Pour plus d'informations sur la configuration du protocole HTTPS, consultez https://go.microsoft.com/fwlink/?linkid=848054.</target> Pour plus d'informations sur la configuration du protocole HTTPS, consultez https://go.microsoft.com/fwlink/?linkid=848054.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="FailedToDetermineUserHomeDirectory">
<source>The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</source>
<target state="new">The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -71,6 +71,11 @@ Per considerare attendibile il certificato (solo Windows e macOS), installare pr
Per altre informazioni sulla configurazione di HTTPS, vedere https://go.microsoft.com/fwlink/?linkid=848054.</target> Per altre informazioni sulla configurazione di HTTPS, vedere https://go.microsoft.com/fwlink/?linkid=848054.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="FailedToDetermineUserHomeDirectory">
<source>The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</source>
<target state="new">The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -71,6 +71,11 @@ ASP.NET Core HTTPS 開発証明書が正常にインストールされました
HTTPS を構成する方法の詳細については、https://go.microsoft.com/fwlink/?linkid=848054 をご覧ください。</target> HTTPS を構成する方法の詳細については、https://go.microsoft.com/fwlink/?linkid=848054 をご覧ください。</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="FailedToDetermineUserHomeDirectory">
<source>The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</source>
<target state="new">The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -71,6 +71,11 @@ ASP.NET Core HTTPS 개발 인증서를 설치했습니다.
HTTPS 구성에 대한 자세한 내용은 https://go.microsoft.com/fwlink/?linkid=848054를 참조하세요.</target> HTTPS 구성에 대한 자세한 내용은 https://go.microsoft.com/fwlink/?linkid=848054를 참조하세요.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="FailedToDetermineUserHomeDirectory">
<source>The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</source>
<target state="new">The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -71,6 +71,11 @@ Aby ufać temu certyfikatowi (dotyczy tylko systemów Windows i macOS), najpierw
Aby uzyskać więcej informacji dotyczących konfigurowania protokołu HTTPS, zobacz https://go.microsoft.com/fwlink/?linkid=848054.</target> Aby uzyskać więcej informacji dotyczących konfigurowania protokołu HTTPS, zobacz https://go.microsoft.com/fwlink/?linkid=848054.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="FailedToDetermineUserHomeDirectory">
<source>The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</source>
<target state="new">The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -71,6 +71,11 @@ Para confiar no certificado (apenas Windows e macOS), primeiramente instale a fe
Para saber mais sobre a configuração de HTTPS, acesse https://go.microsoft.com/fwlink/?linkid=848054.</target> Para saber mais sobre a configuração de HTTPS, acesse https://go.microsoft.com/fwlink/?linkid=848054.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="FailedToDetermineUserHomeDirectory">
<source>The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</source>
<target state="new">The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -71,6 +71,11 @@ For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?l
Дополнительные сведения о настройке HTTPS: https://go.microsoft.com/fwlink/?linkid=848054.</target> Дополнительные сведения о настройке HTTPS: https://go.microsoft.com/fwlink/?linkid=848054.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="FailedToDetermineUserHomeDirectory">
<source>The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</source>
<target state="new">The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -71,6 +71,11 @@ Sertifikaya güvenmek için (yalnızca Windows ve macOS) önce 'dotnet tool inst
HTTPS yapılandırması hakkında daha fazla bilgi için bkz. https://go.microsoft.com/fwlink/?linkid=848054.</target> HTTPS yapılandırması hakkında daha fazla bilgi için bkz. https://go.microsoft.com/fwlink/?linkid=848054.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="FailedToDetermineUserHomeDirectory">
<source>The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</source>
<target state="new">The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -71,6 +71,11 @@ For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?l
有关配置 HTTPS 的详细信息,请参阅 https://go.microsoft.com/fwlink/?linkid=848054。</target> 有关配置 HTTPS 的详细信息,请参阅 https://go.microsoft.com/fwlink/?linkid=848054。</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="FailedToDetermineUserHomeDirectory">
<source>The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</source>
<target state="new">The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -71,6 +71,11 @@ For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?l
如需如何設定 HTTPS 的詳細資訊,請參閱 https://go.microsoft.com/fwlink/?linkid=848054。</target> 如需如何設定 HTTPS 的詳細資訊,請參閱 https://go.microsoft.com/fwlink/?linkid=848054。</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="FailedToDetermineUserHomeDirectory">
<source>The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</source>
<target state="new">The user's home directory could not be determined. Set the '{0}' environment variable to specify the directory to use.</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -88,15 +88,14 @@ namespace Microsoft.DotNet.Cli
var success = true; var success = true;
var command = string.Empty; var command = string.Empty;
var lastArg = 0; var lastArg = 0;
var cliFallbackFolderPathCalculator = new CliFolderPathCalculator();
TopLevelCommandParserResult topLevelCommandParserResult = TopLevelCommandParserResult.Empty; TopLevelCommandParserResult topLevelCommandParserResult = TopLevelCommandParserResult.Empty;
using (INuGetCacheSentinel nugetCacheSentinel = new NuGetCacheSentinel(cliFallbackFolderPathCalculator)) using (INuGetCacheSentinel nugetCacheSentinel = new NuGetCacheSentinel())
using (IFirstTimeUseNoticeSentinel disposableFirstTimeUseNoticeSentinel = using (IFirstTimeUseNoticeSentinel disposableFirstTimeUseNoticeSentinel =
new FirstTimeUseNoticeSentinel(cliFallbackFolderPathCalculator)) new FirstTimeUseNoticeSentinel())
{ {
IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel = disposableFirstTimeUseNoticeSentinel; IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel = disposableFirstTimeUseNoticeSentinel;
IAspNetCertificateSentinel aspNetCertificateSentinel = new AspNetCertificateSentinel(cliFallbackFolderPathCalculator); IAspNetCertificateSentinel aspNetCertificateSentinel = new AspNetCertificateSentinel();
IFileSentinel toolPathSentinel = new FileSentinel( IFileSentinel toolPathSentinel = new FileSentinel(
new FilePath( new FilePath(
Path.Combine( Path.Combine(
@ -174,7 +173,6 @@ namespace Microsoft.DotNet.Cli
firstTimeUseNoticeSentinel, firstTimeUseNoticeSentinel,
aspNetCertificateSentinel, aspNetCertificateSentinel,
toolPathSentinel, toolPathSentinel,
cliFallbackFolderPathCalculator,
hasSuperUserAccess, hasSuperUserAccess,
dotnetFirstRunConfiguration, dotnetFirstRunConfiguration,
environmentProvider); environmentProvider);
@ -241,7 +239,6 @@ namespace Microsoft.DotNet.Cli
IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel, IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel,
IAspNetCertificateSentinel aspNetCertificateSentinel, IAspNetCertificateSentinel aspNetCertificateSentinel,
IFileSentinel toolPathSentinel, IFileSentinel toolPathSentinel,
CliFolderPathCalculator cliFolderPathCalculator,
bool hasSuperUserAccess, bool hasSuperUserAccess,
DotnetFirstRunConfiguration dotnetFirstRunConfiguration, DotnetFirstRunConfiguration dotnetFirstRunConfiguration,
IEnvironmentProvider environmentProvider) IEnvironmentProvider environmentProvider)
@ -249,15 +246,11 @@ namespace Microsoft.DotNet.Cli
using (PerfTrace.Current.CaptureTiming()) using (PerfTrace.Current.CaptureTiming())
{ {
var nugetPackagesArchiver = new NuGetPackagesArchiver(); var nugetPackagesArchiver = new NuGetPackagesArchiver();
var environmentPath = EnvironmentPathFactory.CreateEnvironmentPath( var environmentPath = EnvironmentPathFactory.CreateEnvironmentPath(hasSuperUserAccess, environmentProvider);
cliFolderPathCalculator,
hasSuperUserAccess,
environmentProvider);
var commandFactory = new DotNetCommandFactory(alwaysRunOutOfProc: true); var commandFactory = new DotNetCommandFactory(alwaysRunOutOfProc: true);
var nugetCachePrimer = new NuGetCachePrimer( var nugetCachePrimer = new NuGetCachePrimer(
nugetPackagesArchiver, nugetPackagesArchiver,
nugetCacheSentinel, nugetCacheSentinel);
cliFolderPathCalculator);
var aspnetCertificateGenerator = new AspNetCoreCertificateGenerator(); var aspnetCertificateGenerator = new AspNetCoreCertificateGenerator();
var dotnetConfigurer = new DotnetFirstTimeUseConfigurer( var dotnetConfigurer = new DotnetFirstTimeUseConfigurer(
nugetCachePrimer, nugetCachePrimer,
@ -268,7 +261,7 @@ namespace Microsoft.DotNet.Cli
toolPathSentinel, toolPathSentinel,
dotnetFirstRunConfiguration, dotnetFirstRunConfiguration,
Reporter.Output, Reporter.Output,
cliFolderPathCalculator.CliFallbackFolderPath, CliFolderPathCalculator.CliFallbackFolderPath,
environmentPath); environmentPath);
dotnetConfigurer.Configure(); dotnetConfigurer.Configure();

View file

@ -39,8 +39,8 @@ namespace Microsoft.DotNet.ShellShim
appHostSourcePath = Path.Combine(_appHostSourceDirectory, ApphostNameWithoutExtension); appHostSourcePath = Path.Combine(_appHostSourceDirectory, ApphostNameWithoutExtension);
} }
var appHostDestinationFilePath = shimPath.Value; var appHostDestinationFilePath = Path.GetFullPath(shimPath.Value);
var appBinaryFilePath = PathUtility.GetRelativePath(appHostDestinationFilePath, entryPoint.Value); var appBinaryFilePath = Path.GetRelativePath(Path.GetDirectoryName(appHostDestinationFilePath), Path.GetFullPath(entryPoint.Value));
EmbedAppNameInHost.EmbedAndReturnModifiedAppHostPath( EmbedAppNameInHost.EmbedAndReturnModifiedAppHostPath(
appHostSourceFilePath: appHostSourcePath, appHostSourceFilePath: appHostSourcePath,

View file

@ -14,15 +14,9 @@ namespace Microsoft.DotNet.ShellShim
internal static class EnvironmentPathFactory internal static class EnvironmentPathFactory
{ {
public static IEnvironmentPath CreateEnvironmentPath( public static IEnvironmentPath CreateEnvironmentPath(
CliFolderPathCalculator cliFolderPathCalculator = null,
bool hasSuperUserAccess = false, bool hasSuperUserAccess = false,
IEnvironmentProvider environmentProvider = null) IEnvironmentProvider environmentProvider = null)
{ {
if (cliFolderPathCalculator == null)
{
cliFolderPathCalculator = new CliFolderPathCalculator();
}
if (environmentProvider == null) if (environmentProvider == null)
{ {
environmentProvider = new EnvironmentProvider(); environmentProvider = new EnvironmentProvider();
@ -32,14 +26,14 @@ namespace Microsoft.DotNet.ShellShim
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{ {
environmentPath = new WindowsEnvironmentPath( environmentPath = new WindowsEnvironmentPath(
cliFolderPathCalculator.ToolsShimPath, CliFolderPathCalculator.ToolsShimPath,
Reporter.Output, Reporter.Output,
environmentProvider); environmentProvider);
} }
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && hasSuperUserAccess) else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && hasSuperUserAccess)
{ {
environmentPath = new LinuxEnvironmentPath( environmentPath = new LinuxEnvironmentPath(
cliFolderPathCalculator.ToolsShimPathInUnix, CliFolderPathCalculator.ToolsShimPathInUnix,
Reporter.Output, Reporter.Output,
environmentProvider, environmentProvider,
new FileWrapper()); new FileWrapper());
@ -47,7 +41,7 @@ namespace Microsoft.DotNet.ShellShim
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && hasSuperUserAccess) else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && hasSuperUserAccess)
{ {
environmentPath = new OSXEnvironmentPath( environmentPath = new OSXEnvironmentPath(
executablePath: cliFolderPathCalculator.ToolsShimPathInUnix, executablePath: CliFolderPathCalculator.ToolsShimPathInUnix,
reporter: Reporter.Output, reporter: Reporter.Output,
environmentProvider: environmentProvider, environmentProvider: environmentProvider,
fileSystem: new FileWrapper()); fileSystem: new FileWrapper());
@ -57,10 +51,9 @@ namespace Microsoft.DotNet.ShellShim
} }
public static IEnvironmentPathInstruction CreateEnvironmentPathInstruction( public static IEnvironmentPathInstruction CreateEnvironmentPathInstruction(
CliFolderPathCalculator cliFolderPathCalculator = null,
IEnvironmentProvider environmentProvider = null) IEnvironmentProvider environmentProvider = null)
{ {
return CreateEnvironmentPath(cliFolderPathCalculator, true, environmentProvider); return CreateEnvironmentPath(true, environmentProvider);
} }
} }
} }

View file

@ -15,8 +15,7 @@ namespace Microsoft.DotNet.ShellShim
private static DirectoryPath GetShimLocation() private static DirectoryPath GetShimLocation()
{ {
var cliFolderPathCalculator = new CliFolderPathCalculator(); return new DirectoryPath(CliFolderPathCalculator.ToolsShimPath);
return new DirectoryPath(cliFolderPathCalculator.ToolsShimPath);
} }
} }
} }

View file

@ -30,7 +30,7 @@ namespace Microsoft.DotNet.Cli.Telemetry
_hasher = hasher ?? Sha256Hasher.Hash; _hasher = hasher ?? Sha256Hasher.Hash;
_getMACAddress = getMACAddress ?? MacAddressGetter.GetMacAddress; _getMACAddress = getMACAddress ?? MacAddressGetter.GetMacAddress;
_dockerContainerDetector = dockerContainerDetector ?? new DockerContainerDetectorForTelemetry(); _dockerContainerDetector = dockerContainerDetector ?? new DockerContainerDetectorForTelemetry();
_userLevelCacheWriter = userLevelCacheWriter ?? new UserLevelCacheWriter(new CliFolderPathCalculator()); _userLevelCacheWriter = userLevelCacheWriter ?? new UserLevelCacheWriter();
} }
private readonly IDockerContainerDetector _dockerContainerDetector; private readonly IDockerContainerDetector _dockerContainerDetector;

View file

@ -34,8 +34,7 @@ namespace Microsoft.DotNet.ToolPackage
private static DirectoryPath GetPackageLocation() private static DirectoryPath GetPackageLocation()
{ {
var cliFolderPathCalculator = new CliFolderPathCalculator(); return new DirectoryPath(CliFolderPathCalculator.ToolsPackagePath);
return new DirectoryPath(cliFolderPathCalculator.ToolsPackagePath);
} }
} }
} }

View file

@ -28,7 +28,7 @@ namespace Microsoft.DotNet.ToolPackage
_store = store ?? throw new ArgumentNullException(nameof(store)); _store = store ?? throw new ArgumentNullException(nameof(store));
_projectRestorer = projectRestorer ?? throw new ArgumentNullException(nameof(projectRestorer)); _projectRestorer = projectRestorer ?? throw new ArgumentNullException(nameof(projectRestorer));
_tempProject = tempProject; _tempProject = tempProject;
_offlineFeed = offlineFeed ?? new DirectoryPath(new CliFolderPathCalculator().CliFallbackFolderPath); _offlineFeed = offlineFeed ?? new DirectoryPath(CliFolderPathCalculator.CliFallbackFolderPath);
} }
public IToolPackage InstallPackage(PackageId packageId, public IToolPackage InstallPackage(PackageId packageId,

View file

@ -14,7 +14,7 @@ namespace Microsoft.DotNet.Tools.MSBuild
public sealed class MSBuildLogger : INodeLogger public sealed class MSBuildLogger : INodeLogger
{ {
private readonly IFirstTimeUseNoticeSentinel _sentinel = private readonly IFirstTimeUseNoticeSentinel _sentinel =
new FirstTimeUseNoticeSentinel(new CliFolderPathCalculator()); new FirstTimeUseNoticeSentinel();
private readonly ITelemetry _telemetry; private readonly ITelemetry _telemetry;
private const string NewEventName = "msbuild"; private const string NewEventName = "msbuild";
private const string TargetFrameworkTelemetryEventName = "targetframeworkeval"; private const string TargetFrameworkTelemetryEventName = "targetframeworkeval";

View file

@ -31,8 +31,7 @@ namespace Microsoft.DotNet.Tools.New
{ {
var sessionId = var sessionId =
Environment.GetEnvironmentVariable(MSBuildForwardingApp.TelemetrySessionIdEnvironmentVariableName); Environment.GetEnvironmentVariable(MSBuildForwardingApp.TelemetrySessionIdEnvironmentVariableName);
var telemetry = var telemetry = new Telemetry(new FirstTimeUseNoticeSentinel(), sessionId);
new Telemetry(new FirstTimeUseNoticeSentinel(new CliFolderPathCalculator()), sessionId);
var logger = new TelemetryLogger(null); var logger = new TelemetryLogger(null);
if (telemetry.Enabled) if (telemetry.Enabled)

View file

@ -60,8 +60,6 @@ namespace Microsoft.DotNet.Tools.Tool.Install
_verbosity = appliedCommand.SingleArgumentOrDefault("verbosity"); _verbosity = appliedCommand.SingleArgumentOrDefault("verbosity");
_toolPath = appliedCommand.SingleArgumentOrDefault("tool-path"); _toolPath = appliedCommand.SingleArgumentOrDefault("tool-path");
var cliFolderPathCalculator = new CliFolderPathCalculator();
_createToolPackageStoreAndInstaller = createToolPackageStoreAndInstaller ?? ToolPackageFactory.CreateToolPackageStoreAndInstaller; _createToolPackageStoreAndInstaller = createToolPackageStoreAndInstaller ?? ToolPackageFactory.CreateToolPackageStoreAndInstaller;
_environmentPathInstruction = environmentPathInstruction _environmentPathInstruction = environmentPathInstruction

View file

@ -34,8 +34,6 @@ namespace Microsoft.DotNet.Tools.Tool.Uninstall
IReporter reporter = null) IReporter reporter = null)
: base(result) : base(result)
{ {
var pathCalculator = new CliFolderPathCalculator();
_options = options ?? throw new ArgumentNullException(nameof(options)); _options = options ?? throw new ArgumentNullException(nameof(options));
_reporter = reporter ?? Reporter.Output; _reporter = reporter ?? Reporter.Output;
_errorReporter = reporter ?? Reporter.Error; _errorReporter = reporter ?? Reporter.Error;

View file

@ -26,7 +26,6 @@ namespace Microsoft.DotNet.Configurer.UnitTests
private Mock<INuGetPackagesArchiver> _nugetPackagesArchiverMock; private Mock<INuGetPackagesArchiver> _nugetPackagesArchiverMock;
private Mock<INuGetCacheSentinel> _nugetCacheSentinel; private Mock<INuGetCacheSentinel> _nugetCacheSentinel;
private CliFolderPathCalculator _cliFolderPathCalculator;
public GivenANuGetCachePrimer() public GivenANuGetCachePrimer()
{ {
@ -40,12 +39,9 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_nugetCacheSentinel = new Mock<INuGetCacheSentinel>(); _nugetCacheSentinel = new Mock<INuGetCacheSentinel>();
_cliFolderPathCalculator = new CliFolderPathCalculator();
var nugetCachePrimer = new NuGetCachePrimer( var nugetCachePrimer = new NuGetCachePrimer(
_nugetPackagesArchiverMock.Object, _nugetPackagesArchiverMock.Object,
_nugetCacheSentinel.Object, _nugetCacheSentinel.Object,
_cliFolderPathCalculator,
_fileSystemMock.File); _fileSystemMock.File);
nugetCachePrimer.PrimeCache(); nugetCachePrimer.PrimeCache();
@ -63,7 +59,6 @@ namespace Microsoft.DotNet.Configurer.UnitTests
var nugetCachePrimer = new NuGetCachePrimer( var nugetCachePrimer = new NuGetCachePrimer(
nugetPackagesArchiverMock.Object, nugetPackagesArchiverMock.Object,
_nugetCacheSentinel.Object, _nugetCacheSentinel.Object,
_cliFolderPathCalculator,
fileSystemMock.File); fileSystemMock.File);
nugetCachePrimer.PrimeCache(); nugetCachePrimer.PrimeCache();
@ -75,7 +70,7 @@ namespace Microsoft.DotNet.Configurer.UnitTests
public void It_extracts_the_archive_to_the_fallback_folder() public void It_extracts_the_archive_to_the_fallback_folder()
{ {
_nugetPackagesArchiverMock.Verify(n => _nugetPackagesArchiverMock.Verify(n =>
n.ExtractArchive(_cliFolderPathCalculator.CliFallbackFolderPath), n.ExtractArchive(CliFolderPathCalculator.CliFallbackFolderPath),
Times.Exactly(1)); Times.Exactly(1));
} }
@ -95,7 +90,6 @@ namespace Microsoft.DotNet.Configurer.UnitTests
var nugetCachePrimer = new NuGetCachePrimer( var nugetCachePrimer = new NuGetCachePrimer(
nugetPackagesArchiveMock.Object, nugetPackagesArchiveMock.Object,
nugetCacheSentinel.Object, nugetCacheSentinel.Object,
_cliFolderPathCalculator,
_fileSystemMock.File); _fileSystemMock.File);
Action action = () => nugetCachePrimer.PrimeCache(); Action action = () => nugetCachePrimer.PrimeCache();

View file

@ -15,9 +15,8 @@ namespace Microsoft.DotNet.Configurer.UnitTests
public void It_does_not_return_same_path_for_tools_package_and_tool_shim() public void It_does_not_return_same_path_for_tools_package_and_tool_shim()
{ {
// shim name will conflict with the folder that is PackageId, if commandName and packageId are the same. // shim name will conflict with the folder that is PackageId, if commandName and packageId are the same.
var cliFolderPathCalculator = new CliFolderPathCalculator(); CliFolderPathCalculator.ToolsPackagePath.Should().NotBe(CliFolderPathCalculator.ToolsShimPath);
cliFolderPathCalculator.ToolsPackagePath.Should().NotBe(cliFolderPathCalculator.ToolsShimPath); CliFolderPathCalculator.ToolsPackagePath.Should().NotBe(CliFolderPathCalculator.ToolsShimPathInUnix.Path);
cliFolderPathCalculator.ToolsPackagePath.Should().NotBe(cliFolderPathCalculator.ToolsShimPathInUnix.Path);
} }
} }
} }

View file

@ -45,6 +45,27 @@ namespace Microsoft.DotNet.ShellShim.Tests
stdOut.Should().Contain("Hello World"); stdOut.Should().Contain("Hello World");
} }
// Reproduce https://github.com/dotnet/cli/issues/9319
[Fact]
public void GivenAnExecutableAndRelativePathToShimPathItCanGenerateShimFile()
{
var outputDll = MakeHelloWorldExecutableDll("GivenAnExecutableAndRelativePath");
// To reproduce the bug, dll need to be nested under the shim
var parentPathAsShimPath = outputDll.GetDirectoryPath().GetParentPath().GetParentPath().Value;
var relativePathToShim = Path.GetRelativePath(
Directory.GetCurrentDirectory(),
parentPathAsShimPath);
ShellShimRepository shellShimRepository = ConfigBasicTestDependecyShellShimRepository(relativePathToShim);
var shellCommandName = nameof(ShellShimRepositoryTests) + Path.GetRandomFileName();
shellShimRepository.CreateShim(outputDll, shellCommandName);
var stdOut = ExecuteInShell(shellCommandName, relativePathToShim);
stdOut.Should().Contain("Hello World");
}
private static ShellShimRepository ConfigBasicTestDependecyShellShimRepository(string pathToShim) private static ShellShimRepository ConfigBasicTestDependecyShellShimRepository(string pathToShim)
{ {
string stage2AppHostTemplateDirectory = GetAppHostTemplateFromStage2(); string stage2AppHostTemplateDirectory = GetAppHostTemplateFromStage2();
@ -473,13 +494,19 @@ namespace Microsoft.DotNet.ShellShim.Tests
return stage2AppHostTemplateDirectory; return stage2AppHostTemplateDirectory;
} }
private static FilePath MakeHelloWorldExecutableDll() private static FilePath MakeHelloWorldExecutableDll(string instanceName = null)
{ {
const string testAppName = "TestAppSimple"; const string testAppName = "TestAppSimple";
const string emptySpaceToTestSpaceInPath = " "; const string emptySpaceToTestSpaceInPath = " ";
const string directoryNamePostFix = "Test"; const string directoryNamePostFix = "Test";
if (instanceName == null)
{
instanceName = testAppName + emptySpaceToTestSpaceInPath + directoryNamePostFix;
}
TestAssetInstance testInstance = TestAssets.Get(testAppName) TestAssetInstance testInstance = TestAssets.Get(testAppName)
.CreateInstance(testAppName + emptySpaceToTestSpaceInPath + directoryNamePostFix) .CreateInstance(instanceName)
.UseCurrentRuntimeFrameworkVersion() .UseCurrentRuntimeFrameworkVersion()
.WithRestoreFiles() .WithRestoreFiles()
.WithBuildFiles(); .WithBuildFiles();

View file

@ -5,9 +5,12 @@ using System;
using System.IO; using System.IO;
using FluentAssertions; using FluentAssertions;
using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Configurer;
using Microsoft.DotNet.Tools.Test.Utilities; using Microsoft.DotNet.Tools.Test.Utilities;
using Xunit; using Xunit;
using LocalizableStrings = Microsoft.DotNet.Cli.Utils.LocalizableStrings;
namespace Microsoft.DotNet.Tests namespace Microsoft.DotNet.Tests
{ {
public class GivenThatDotNetRunsCommands : TestBase public class GivenThatDotNetRunsCommands : TestBase
@ -32,5 +35,19 @@ namespace Microsoft.DotNet.Tests
.Should().Fail() .Should().Fail()
.And.HaveStdErrContaining(string.Format(LocalizableStrings.NoExecutableFoundMatchingCommand, "dotnet-crash")); .And.HaveStdErrContaining(string.Format(LocalizableStrings.NoExecutableFoundMatchingCommand, "dotnet-crash"));
} }
[Theory]
[InlineData("")]
[InlineData(null)]
public void GivenAMissingHomeVariableItPrintsErrorMessage(string value)
{
new TestCommand("dotnet")
.WithEnvironmentVariable(CliFolderPathCalculator.PlatformHomeVariableName, value)
.ExecuteWithCapturedOutput("--help")
.Should()
.Fail()
.And
.HaveStdErrContaining(CliFolderPathCalculator.DotnetHomeVariableName);
}
} }
} }

View file

@ -59,20 +59,6 @@ namespace Microsoft.DotNet.Tests
.Should().BeFalse("Because multicore JIT is disabled"); .Should().BeFalse("Because multicore JIT is disabled");
} }
[Fact]
public void WhenTheProfileRootIsUndefinedThenDotnetDoesNotCrash()
{
var testDirectory = TestAssets.CreateTestDirectory();
var testStartTime = GetTruncatedDateTime();
var optimizationProfileFilePath = GetOptimizationProfileFilePath(testDirectory.FullName);
new TestCommand("dotnet")
.WithUserProfileRoot("")
.ExecuteWithCapturedOutput("--help")
.Should().Pass();
}
[Fact] [Fact]
public void WhenCliRepoBuildsThenDotnetWritesOptimizationDataToTheDefaultProfileRoot() public void WhenCliRepoBuildsThenDotnetWritesOptimizationDataToTheDefaultProfileRoot()
{ {

View file

@ -213,7 +213,7 @@ namespace Microsoft.DotNet.Tests
File.Exists(profiled).Should().BeTrue(); File.Exists(profiled).Should().BeTrue();
File.ReadAllText(profiled).Should().Be( File.ReadAllText(profiled).Should().Be(
$"export PATH=\"$PATH:{new CliFolderPathCalculator().ToolsShimPathInUnix.PathWithDollar}\""); $"export PATH=\"$PATH:{CliFolderPathCalculator.ToolsShimPathInUnix.PathWithDollar}\"");
} }
[MacOsOnlyFact] [MacOsOnlyFact]
@ -234,7 +234,7 @@ namespace Microsoft.DotNet.Tests
command.ExecuteWithCapturedOutput("internal-reportinstallsuccess test").Should().Pass(); command.ExecuteWithCapturedOutput("internal-reportinstallsuccess test").Should().Pass();
File.Exists(pathsd).Should().BeTrue(); File.Exists(pathsd).Should().BeTrue();
File.ReadAllText(pathsd).Should().Be(new CliFolderPathCalculator().ToolsShimPathInUnix.PathWithTilde); File.ReadAllText(pathsd).Should().Be(CliFolderPathCalculator.ToolsShimPathInUnix.PathWithTilde);
} }
[Fact] [Fact]