Merge branch 'master' into merges/release/15.5-to-master-20171120-080035

This commit is contained in:
Livar 2017-11-30 09:40:47 -08:00 committed by GitHub
commit d48654afe7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
128 changed files with 2670 additions and 274 deletions

View file

@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.0
VisualStudioVersion = 15.0.27004.2008
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ED2FE3E2-F7E7-4389-8231-B65123F2076F}"
EndProject
@ -230,6 +230,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.TestFramew
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Msbuild.Tests.Utilities", "test\Msbuild.Tests.Utilities\Msbuild.Tests.Utilities.csproj", "{E7C72EF2-8480-48B4-AAE8-A596F1A6048E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.ToolPackageObtainer.Tests", "test\Microsoft.DotNet.ToolPackageObtainer.Tests\Microsoft.DotNet.ToolPackageObtainer.Tests.csproj", "{F0D50831-9468-4ACB-8FD8-E9883DD553FB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.ShellShimMaker.Tests", "test\Microsoft.DotNet.ShellShimMaker.Tests\Microsoft.DotNet.ShellShimMaker.Tests.csproj", "{20376E28-68EB-4BE5-81A5-51500F1235E2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -1614,6 +1618,54 @@ Global
{E7C72EF2-8480-48B4-AAE8-A596F1A6048E}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{E7C72EF2-8480-48B4-AAE8-A596F1A6048E}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU
{E7C72EF2-8480-48B4-AAE8-A596F1A6048E}.RelWithDebInfo|x86.Build.0 = Release|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.Debug|x64.ActiveCfg = Debug|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.Debug|x64.Build.0 = Debug|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.Debug|x86.ActiveCfg = Debug|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.Debug|x86.Build.0 = Debug|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.MinSizeRel|x64.Build.0 = Debug|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.MinSizeRel|x86.ActiveCfg = Debug|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.MinSizeRel|x86.Build.0 = Debug|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.Release|Any CPU.Build.0 = Release|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.Release|x64.ActiveCfg = Release|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.Release|x64.Build.0 = Release|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.Release|x86.ActiveCfg = Release|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.Release|x86.Build.0 = Release|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU
{F0D50831-9468-4ACB-8FD8-E9883DD553FB}.RelWithDebInfo|x86.Build.0 = Release|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.Debug|x64.ActiveCfg = Debug|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.Debug|x64.Build.0 = Debug|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.Debug|x86.ActiveCfg = Debug|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.Debug|x86.Build.0 = Debug|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.MinSizeRel|x64.Build.0 = Debug|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.MinSizeRel|x86.ActiveCfg = Debug|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.MinSizeRel|x86.Build.0 = Debug|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.Release|Any CPU.Build.0 = Release|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.Release|x64.ActiveCfg = Release|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.Release|x64.Build.0 = Release|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.Release|x86.ActiveCfg = Release|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.Release|x86.Build.0 = Release|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU
{20376E28-68EB-4BE5-81A5-51500F1235E2}.RelWithDebInfo|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -1686,6 +1738,8 @@ Global
{B4EE3671-C103-4A37-8DEB-C74E0134104E} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{44759218-B558-4AF0-8991-515F1100DCF5} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{E7C72EF2-8480-48B4-AAE8-A596F1A6048E} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{F0D50831-9468-4ACB-8FD8-E9883DD553FB} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{20376E28-68EB-4BE5-81A5-51500F1235E2} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B526D2CE-EE2D-4AD4-93EF-1867D90FF1F5}

View file

@ -0,0 +1,44 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27110.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "App", "App\App.csproj", "{BB02B949-F6BD-4872-95CB-96A05B1FE026}"
ProjectSection(ProjectDependencies) = postProject
{4E952B56-841D-461D-89A9-7977DDCC0625} = {4E952B56-841D-461D-89A9-7977DDCC0625}
{D53E177A-8ECF-43D5-A01E-98B884D53CA6} = {D53E177A-8ECF-43D5-A01E-98B884D53CA6}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "First", "First\First.csproj", "{D53E177A-8ECF-43D5-A01E-98B884D53CA6}"
ProjectSection(ProjectDependencies) = postProject
{4E952B56-841D-461D-89A9-7977DDCC0625} = {4E952B56-841D-461D-89A9-7977DDCC0625}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Second", "Second\Second.csproj", "{4E952B56-841D-461D-89A9-7977DDCC0625}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BB02B949-F6BD-4872-95CB-96A05B1FE026}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BB02B949-F6BD-4872-95CB-96A05B1FE026}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB02B949-F6BD-4872-95CB-96A05B1FE026}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB02B949-F6BD-4872-95CB-96A05B1FE026}.Release|Any CPU.Build.0 = Release|Any CPU
{D53E177A-8ECF-43D5-A01E-98B884D53CA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D53E177A-8ECF-43D5-A01E-98B884D53CA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D53E177A-8ECF-43D5-A01E-98B884D53CA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D53E177A-8ECF-43D5-A01E-98B884D53CA6}.Release|Any CPU.Build.0 = Release|Any CPU
{4E952B56-841D-461D-89A9-7977DDCC0625}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4E952B56-841D-461D-89A9-7977DDCC0625}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4E952B56-841D-461D-89A9-7977DDCC0625}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4E952B56-841D-461D-89A9-7977DDCC0625}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F6D9A973-1CFD-41C9-84F2-1471C0FE67DF}
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,12 @@
using System;
namespace App
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}

View file

@ -0,0 +1,8 @@
using System;
namespace First
{
public class Class1
{
}
}

View file

@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,8 @@
using System;
namespace Second
{
public class Class1
{
}
}

View file

@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>

View file

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CLI_SharedFrameworkVersion>2.1.0-preview1-25919-02</CLI_SharedFrameworkVersion>
<CLI_SharedFrameworkVersion>2.1.0-preview1-25929-02</CLI_SharedFrameworkVersion>
<CLI_MSBuild_Version>15.5.179</CLI_MSBuild_Version>
<CLI_Roslyn_Version>2.6.0-beta3-62309-01</CLI_Roslyn_Version>
<CLI_DiaSymNative_Version>1.6.0-beta2-25304</CLI_DiaSymNative_Version>
<CLI_FSharp_Version>4.2.0-rtm-171104-0</CLI_FSharp_Version>
<CLI_FSharp_Version>4.2.0-rtm-171122-0</CLI_FSharp_Version>
<CLI_Deps_Satellites_Build>pre-20171012-1</CLI_Deps_Satellites_Build>
<CLI_Roslyn_Satellites_Version>2.6.0-$(CLI_Deps_Satellites_Build)</CLI_Roslyn_Satellites_Version>
<CLI_FSharp_Satellites_Version>4.4.1-$(CLI_Deps_Satellites_Build)</CLI_FSharp_Satellites_Version>
@ -13,7 +13,7 @@
<!-- We'll usually want to keep these versions in sync, but we may want to diverge in some
cases, so use separate properties but derive one from the other unless we want to
explicitly use different versions. -->
<CLI_NETSDK_Version>15.5.0-preview-20171116-1</CLI_NETSDK_Version>
<CLI_NETSDK_Version>2.1.0-preview1-20171121-1</CLI_NETSDK_Version>
<CLI_MSBuildExtensions_Version>$(CLI_NETSDK_Version)</CLI_MSBuildExtensions_Version>
<CLI_NuGet_Version>4.5.0-rtm-4651</CLI_NuGet_Version>
@ -23,12 +23,12 @@
<SharedFrameworkVersion>$(CLI_SharedFrameworkVersion)</SharedFrameworkVersion>
<SharedHostVersion>$(CLI_SharedFrameworkVersion)</SharedHostVersion>
<HostFxrVersion>$(CLI_SharedFrameworkVersion)</HostFxrVersion>
<TemplateEngineVersion>1.0.0-beta3-20171110-312</TemplateEngineVersion>
<TemplateEngineVersion>1.0.0-beta3-20171117-314</TemplateEngineVersion>
<TemplateEngineTemplateVersion>1.0.0-beta3-20171117-314</TemplateEngineTemplateVersion>
<TemplateEngineTemplate2_0Version>1.0.0-beta3-20171117-314</TemplateEngineTemplate2_0Version>
<AspnetTemplateVersion>1.0.0-beta2-20171004-309</AspnetTemplateVersion>
<PlatformAbstractionsVersion>2.1.0-preview1-25919-02</PlatformAbstractionsVersion>
<DependencyModelVersion>2.1.0-preview1-25919-02</DependencyModelVersion>
<PlatformAbstractionsVersion>2.1.0-preview1-25929-02</PlatformAbstractionsVersion>
<DependencyModelVersion>2.1.0-preview1-25929-02</DependencyModelVersion>
<CliCommandLineParserVersion>0.1.1-alpha-174</CliCommandLineParserVersion>
<CliMigrateVersion>1.2.1-alpha-002133</CliMigrateVersion>
<MicroBuildVersion>0.2.0</MicroBuildVersion>

View file

@ -13,9 +13,10 @@ done
REPO_ROOT="$( cd -P "$( dirname "$SOURCE" )/../" && pwd )"
if [ "$uname" = "Darwin" ]
uname=$(uname)
if [ "$(uname)" == "Darwin" ]
then
RID=osx-x64
RID=osx.10.13-x64
else
RID=linux-x64
fi

View file

@ -285,6 +285,14 @@ namespace Microsoft.DotNet.Cli.Sln.Internal
get { return _sections; }
}
public SlnSection Dependencies
{
get
{
return _sections.GetSection("ProjectDependencies", SlnSectionType.PostProcess);
}
}
internal void Read(TextReader reader, string line, ref int curLineNum)
{
Line = curLineNum;

View file

@ -0,0 +1,10 @@
// 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.
namespace Microsoft.DotNet.Cli.Utils
{
public interface IEnvironmentPath: IEnvironmentPathInstruction
{
void AddPackageExecutablePathToUserPath();
}
}

View file

@ -0,0 +1,7 @@
namespace Microsoft.DotNet.Cli.Utils
{
public interface IEnvironmentPathInstruction
{
void PrintAddPathInstructionIfPathDoesNotExist();
}
}

View file

@ -12,3 +12,4 @@ using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.DotNet.TestFramework, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.Tools.Tests.Utilities, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.ProjectJsonMigration, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.ShellShimMaker.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]

View file

@ -1,33 +0,0 @@
// 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;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.PlatformAbstractions;
using NuGet.Common;
namespace Microsoft.DotNet.Configurer
{
public class CliFallbackFolderPathCalculator
{
public string CliFallbackFolderPath =>
Environment.GetEnvironmentVariable("DOTNET_CLI_TEST_FALLBACKFOLDER") ??
Path.Combine(new DirectoryInfo(AppContext.BaseDirectory).Parent.FullName, "NuGetFallbackFolder");
public string DotnetUserProfileFolderPath
{
get
{
string profileDir = Environment.GetEnvironmentVariable(
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "USERPROFILE" : "HOME");
return Path.Combine(profileDir, ".dotnet");
}
}
public string NuGetUserSettingsDirectory =>
NuGetEnvironment.GetFolderPath(NuGetFolderPath.UserSettingsDirectory);
}
}

View file

@ -0,0 +1,38 @@
// 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;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.PlatformAbstractions;
using NuGet.Common;
namespace Microsoft.DotNet.Configurer
{
public class CliFolderPathCalculator
{
private const string ToolsFolderName = "tools";
private const string DotnetProfileDirectoryName = ".dotnet";
public string CliFallbackFolderPath => Environment.GetEnvironmentVariable("DOTNET_CLI_TEST_FALLBACKFOLDER") ??
Path.Combine(new DirectoryInfo(AppContext.BaseDirectory).Parent.FullName, "NuGetFallbackFolder");
public string ExecutablePackagesPath => Path.Combine(DotnetUserProfileFolderPath, ToolsFolderName) ;
public readonly string ExecutablePackagesPathOnMacEnvPath = $"~/{DotnetProfileDirectoryName}/{ToolsFolderName}";
public static string DotnetUserProfileFolderPath
{
get
{
string profileDir = Environment.GetEnvironmentVariable(
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "USERPROFILE" : "HOME");
return Path.Combine(profileDir, DotnetProfileDirectoryName);
}
}
public string NuGetUserSettingsDirectory =>
NuGetEnvironment.GetFolderPath(NuGetFolderPath.UserSettingsDirectory);
}
}

View file

@ -1,7 +1,9 @@
// 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;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.Extensions.EnvironmentAbstractions;
@ -15,6 +17,7 @@ namespace Microsoft.DotNet.Configurer
private INuGetCacheSentinel _nugetCacheSentinel;
private IFirstTimeUseNoticeSentinel _firstTimeUseNoticeSentinel;
private string _cliFallbackFolderPath;
private readonly IEnvironmentPath _pathAdder;
public DotnetFirstTimeUseConfigurer(
INuGetCachePrimer nugetCachePrimer,
@ -22,7 +25,8 @@ namespace Microsoft.DotNet.Configurer
IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel,
IEnvironmentProvider environmentProvider,
IReporter reporter,
string cliFallbackFolderPath)
string cliFallbackFolderPath,
IEnvironmentPath pathAdder)
{
_nugetCachePrimer = nugetCachePrimer;
_nugetCacheSentinel = nugetCacheSentinel;
@ -30,10 +34,13 @@ namespace Microsoft.DotNet.Configurer
_environmentProvider = environmentProvider;
_reporter = reporter;
_cliFallbackFolderPath = cliFallbackFolderPath;
_pathAdder = pathAdder ?? throw new ArgumentNullException(nameof(pathAdder));
}
public void Configure()
{
AddPackageExecutablePath();
if (ShouldPrintFirstTimeUseNotice())
{
PrintFirstTimeUseNotice();
@ -54,6 +61,23 @@ namespace Microsoft.DotNet.Configurer
}
}
private void AddPackageExecutablePath()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
if (!_firstTimeUseNoticeSentinel.Exists())
{
// Invoke when Windows first run
_pathAdder.AddPackageExecutablePathToUserPath();
}
}
else
{
// Invoke during installer, otherwise, _pathAdder will be no op object that this point
_pathAdder.AddPackageExecutablePathToUserPath();
}
}
private bool ShouldPrintFirstTimeUseNotice()
{
var showFirstTimeUseNotice =

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,47 @@
// 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;
using System.IO;
namespace Microsoft.Extensions.EnvironmentAbstractions
{
public struct DirectoryPath
{
public string Value { get; }
public DirectoryPath(string value)
{
Value = value;
}
public DirectoryPath WithSubDirectories(params string[] paths)
{
string[] insertValueInFront = new string[paths.Length + 1];
insertValueInFront[0] = Value;
Array.Copy(paths, 0, insertValueInFront, 1, paths.Length);
return new DirectoryPath(Path.Combine(insertValueInFront));
}
public FilePath WithFile(string fileName)
{
return new FilePath(Path.Combine(Value, fileName));
}
public string ToQuotedString()
{
return $"\"{Value}\"";
}
public override string ToString()
{
return ToQuotedString();
}
public DirectoryPath GetParentPath()
{
return new DirectoryPath(Directory.GetParent(Path.GetFullPath(Value)).FullName);
}
}
}

View file

@ -0,0 +1,32 @@
// 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.IO;
namespace Microsoft.Extensions.EnvironmentAbstractions
{
public struct FilePath
{
public string Value { get; }
public FilePath(string value)
{
Value = value;
}
public string ToQuotedString()
{
return $"\"{Value}\"";
}
public override string ToString()
{
return ToQuotedString();
}
public DirectoryPath GetDirectoryPath()
{
return new DirectoryPath(Path.GetDirectoryName(Value));
}
}
}

View file

@ -6,6 +6,7 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyMetadataAttribute("Serviceable", "True")]
[assembly: InternalsVisibleTo("Microsoft.Extensions.DependencyModel, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("dotnet, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.Tools.Tests.Utilities, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.Extensions.DependencyModel.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.Configurer, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
@ -13,3 +14,4 @@ using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
[assembly: InternalsVisibleTo("dotnet-test.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100039ac461fa5c82c7dd2557400c4fd4e9dcdf7ac47e3d572548c04cd4673e004916610f4ea5cbf86f2b1ca1cb824f2a7b3976afecfcf4eb72d9a899aa6786effa10c30399e6580ed848231fec48374e41b3acf8811931343fc2f73acf72dae745adbcb7063cc4b50550618383202875223fc75401351cd89c44bf9b50e7fa3796")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.Tools.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.ShellShimMaker.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]

View file

@ -0,0 +1,21 @@
using System.Reflection;
using System.Runtime.Versioning;
using NuGet.Frameworks;
namespace Microsoft.DotNet.Cli
{
internal static class BundledTargetFramework
{
public static string GetTargetFrameworkMoniker()
{
TargetFrameworkAttribute targetFrameworkAttribute = typeof(BundledTargetFramework)
.GetTypeInfo()
.Assembly
.GetCustomAttribute<TargetFrameworkAttribute>();
return NuGetFramework
.Parse(targetFrameworkAttribute.FrameworkName)
.GetShortFolderName();
}
}
}

View file

@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Cli
private static void ConfigureCommandLineLocalizedStrings()
{
DefaultHelpViewText.AdditionalArgumentsSection =
$"{UsageCommandsAdditionalArgsHeader}:{NewLine} {LocalizableStrings.RunCommandAdditionalArgsHelpText}";
$"{UsageCommandsAdditionalArgsHeader}{NewLine} {LocalizableStrings.RunCommandAdditionalArgsHelpText}";
DefaultHelpViewText.ArgumentsSection.Title = UsageArgumentsHeader;
DefaultHelpViewText.CommandsSection.Title = UsageCommandsHeader;
DefaultHelpViewText.OptionsSection.Title = UsageOptionsHeader;

View file

@ -4,15 +4,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Cli.Telemetry;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Configurer;
using Microsoft.DotNet.PlatformAbstractions;
using Microsoft.DotNet.ShellShimMaker;
using Microsoft.DotNet.Tools.Help;
using Microsoft.Extensions.EnvironmentAbstractions;
using NuGet.Frameworks;
using Command = Microsoft.DotNet.Cli.Utils.Command;
using RuntimeEnvironment = Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment;
namespace Microsoft.DotNet.Cli
{
@ -80,8 +84,9 @@ namespace Microsoft.DotNet.Cli
var success = true;
var command = string.Empty;
var lastArg = 0;
var cliFallbackFolderPathCalculator = new CliFallbackFolderPathCalculator();
var cliFallbackFolderPathCalculator = new CliFolderPathCalculator();
TopLevelCommandParserResult topLevelCommandParserResult = TopLevelCommandParserResult.Empty;
using (INuGetCacheSentinel nugetCacheSentinel = new NuGetCacheSentinel(cliFallbackFolderPathCalculator))
using (IFirstTimeUseNoticeSentinel disposableFirstTimeUseNoticeSentinel =
new FirstTimeUseNoticeSentinel(cliFallbackFolderPathCalculator))
@ -120,22 +125,24 @@ namespace Microsoft.DotNet.Cli
{
// It's the command, and we're done!
command = args[lastArg];
if (string.IsNullOrEmpty(command))
{
command = "help";
}
topLevelCommandParserResult = new TopLevelCommandParserResult(args[lastArg]);
topLevelCommandParserResult = new TopLevelCommandParserResult(command);
var hasSuperUserAccess = false;
if (IsDotnetBeingInvokedFromNativeInstaller(topLevelCommandParserResult))
{
firstTimeUseNoticeSentinel = new NoOpFirstTimeUseNoticeSentinel();
hasSuperUserAccess = true;
}
ConfigureDotNetForFirstTimeUse(
nugetCacheSentinel,
firstTimeUseNoticeSentinel,
cliFallbackFolderPathCalculator);
cliFallbackFolderPathCalculator,
hasSuperUserAccess);
break;
}
@ -197,24 +204,29 @@ namespace Microsoft.DotNet.Cli
private static void ConfigureDotNetForFirstTimeUse(
INuGetCacheSentinel nugetCacheSentinel,
IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel,
CliFallbackFolderPathCalculator cliFallbackFolderPathCalculator)
CliFolderPathCalculator cliFolderPathCalculator,
bool hasSuperUserAccess)
{
var environmentProvider = new EnvironmentProvider();
using (PerfTrace.Current.CaptureTiming())
{
var nugetPackagesArchiver = new NuGetPackagesArchiver();
var environmentProvider = new EnvironmentProvider();
var environmentPath =
EnvironmentPathFactory.CreateEnvironmentPath(cliFolderPathCalculator, hasSuperUserAccess, environmentProvider);
var commandFactory = new DotNetCommandFactory(alwaysRunOutOfProc: true);
var nugetCachePrimer = new NuGetCachePrimer(
nugetPackagesArchiver,
nugetCacheSentinel,
cliFallbackFolderPathCalculator);
cliFolderPathCalculator);
var dotnetConfigurer = new DotnetFirstTimeUseConfigurer(
nugetCachePrimer,
nugetCacheSentinel,
firstTimeUseNoticeSentinel,
environmentProvider,
Reporter.Output,
cliFallbackFolderPathCalculator.CliFallbackFolderPath);
cliFolderPathCalculator.CliFallbackFolderPath,
environmentPath);
dotnetConfigurer.Configure();
}

View file

@ -17,3 +17,5 @@ using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("dotnet-sln-remove.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("dotnet-msbuild.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("dotnet-run.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.ToolPackageObtainer.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.ShellShimMaker.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]

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;
using System.Diagnostics;
using System.IO;
using System.Linq;
using Microsoft.DotNet.Cli.Utils;
namespace Microsoft.DotNet.ShellShimMaker
{
public class DoNothingEnvironmentPath : IEnvironmentPath
{
public void AddPackageExecutablePathToUserPath()
{
}
public void PrintAddPathInstructionIfPathDoesNotExist()
{
}
}
}

View file

@ -0,0 +1,66 @@
// 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;
using System.Linq;
using System.Runtime.InteropServices;
using System.Xml.Xsl;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Configurer;
using Microsoft.Extensions.EnvironmentAbstractions;
namespace Microsoft.DotNet.ShellShimMaker
{
internal static class EnvironmentPathFactory
{
public static IEnvironmentPath CreateEnvironmentPath(
CliFolderPathCalculator cliFolderPathCalculator = null,
bool hasSuperUserAccess = false,
IEnvironmentProvider environmentProvider = null)
{
if (cliFolderPathCalculator == null)
{
cliFolderPathCalculator = new CliFolderPathCalculator();
}
if (environmentProvider == null)
{
environmentProvider = new EnvironmentProvider();
}
IEnvironmentPath environmentPath = new DoNothingEnvironmentPath();
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
environmentPath = new WindowsEnvironmentPath(
cliFolderPathCalculator.ExecutablePackagesPath,
Reporter.Output,
environmentProvider);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && hasSuperUserAccess)
{
environmentPath = new LinuxEnvironmentPath(
cliFolderPathCalculator.ExecutablePackagesPath,
Reporter.Output,
environmentProvider, new FileWrapper());
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && hasSuperUserAccess)
{
environmentPath = new OSXEnvironmentPath(
packageExecutablePathWithTilde: cliFolderPathCalculator.ExecutablePackagesPathOnMacEnvPath,
fullPackageExecutablePath: cliFolderPathCalculator.ExecutablePackagesPath,
reporter: Reporter.Output,
environmentProvider: environmentProvider,
fileSystem: new FileWrapper());
}
return environmentPath;
}
public static IEnvironmentPathInstruction CreateEnvironmentPathInstruction(
CliFolderPathCalculator cliFolderPathCalculator = null,
IEnvironmentProvider environmentProvider = null)
{
return CreateEnvironmentPath(cliFolderPathCalculator, true, environmentProvider);
}
}
}

View file

@ -0,0 +1,78 @@
// 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;
using System.Linq;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.Extensions.EnvironmentAbstractions;
namespace Microsoft.DotNet.ShellShimMaker
{
internal class LinuxEnvironmentPath : IEnvironmentPath
{
private readonly IFile _fileSystem;
private readonly IEnvironmentProvider _environmentProvider;
private readonly IReporter _reporter;
private const string PathName = "PATH";
private readonly string _packageExecutablePath;
private readonly string _profiledDotnetCliToolsPath
= Environment.GetEnvironmentVariable("DOTNET_CLI_TEST_LINUX_PROFILED_PATH")
?? @"/etc/profile.d/dotnet-cli-tools-bin-path.sh";
internal LinuxEnvironmentPath(
string packageExecutablePath,
IReporter reporter,
IEnvironmentProvider environmentProvider,
IFile fileSystem)
{
_fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
_environmentProvider
= environmentProvider ?? throw new ArgumentNullException(nameof(environmentProvider));
_reporter
= reporter ?? throw new ArgumentNullException(nameof(reporter));
_packageExecutablePath
= packageExecutablePath ?? throw new ArgumentNullException(nameof(packageExecutablePath));
}
public void AddPackageExecutablePathToUserPath()
{
if (PackageExecutablePathExists())
{
return;
}
var script = $"export PATH=\"$PATH:{_packageExecutablePath}\"";
_fileSystem.WriteAllText(_profiledDotnetCliToolsPath, script);
}
private bool PackageExecutablePathExists()
{
return _environmentProvider
.GetEnvironmentVariable(PathName)
.Split(':').Contains(_packageExecutablePath);
}
public void PrintAddPathInstructionIfPathDoesNotExist()
{
if (!PackageExecutablePathExists())
{
if (_fileSystem.Exists(_profiledDotnetCliToolsPath))
{
_reporter.WriteLine("Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed.");
}
else
{
// similar to https://code.visualstudio.com/docs/setup/mac
_reporter.WriteLine(
$"Cannot find the tools executable path. Please ensure {_packageExecutablePath} is added to your PATH.{Environment.NewLine}" +
$"If you are using bash. You can do this by running the following command:{Environment.NewLine}{Environment.NewLine}" +
$"cat << EOF >> ~/.bash_profile{Environment.NewLine}" +
$"# Add .NET Core SDK tools{Environment.NewLine}" +
$"export PATH=\"$PATH:{_packageExecutablePath}\"{Environment.NewLine}" +
$"EOF");
}
}
}
}
}

View file

@ -0,0 +1,85 @@
// 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;
using System.Linq;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.Extensions.EnvironmentAbstractions;
namespace Microsoft.DotNet.ShellShimMaker
{
internal class OSXEnvironmentPath : IEnvironmentPath
{
private const string PathName = "PATH";
private readonly string _packageExecutablePathWithTilde;
private readonly string _fullPackageExecutablePath;
private readonly IFile _fileSystem;
private readonly IEnvironmentProvider _environmentProvider;
private readonly IReporter _reporter;
private static readonly string PathDDotnetCliToolsPath
= Environment.GetEnvironmentVariable("DOTNET_CLI_TEST_OSX_PATHSD_PATH")
?? @"/etc/paths.d/dotnet-cli-tools";
public OSXEnvironmentPath(
string packageExecutablePathWithTilde,
string fullPackageExecutablePath,
IReporter reporter,
IEnvironmentProvider environmentProvider,
IFile fileSystem
)
{
_fullPackageExecutablePath = fullPackageExecutablePath ??
throw new ArgumentNullException(nameof(fullPackageExecutablePath));
_packageExecutablePathWithTilde = packageExecutablePathWithTilde ??
throw new ArgumentNullException(nameof(packageExecutablePathWithTilde));
_fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
_environmentProvider
= environmentProvider ?? throw new ArgumentNullException(nameof(environmentProvider));
_reporter
= reporter ?? throw new ArgumentNullException(nameof(reporter));
}
public void AddPackageExecutablePathToUserPath()
{
if (PackageExecutablePathExists())
{
return;
}
var script = $"{_packageExecutablePathWithTilde}";
_fileSystem.WriteAllText(PathDDotnetCliToolsPath, script);
}
private bool PackageExecutablePathExists()
{
return _environmentProvider.GetEnvironmentVariable(PathName).Split(':')
.Contains(_packageExecutablePathWithTilde) ||
_environmentProvider.GetEnvironmentVariable(PathName).Split(':')
.Contains(_fullPackageExecutablePath);
}
public void PrintAddPathInstructionIfPathDoesNotExist()
{
if (!PackageExecutablePathExists())
{
if (_fileSystem.Exists(PathDDotnetCliToolsPath))
{
_reporter.WriteLine(
"Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed.");
}
else
{
// similar to https://code.visualstudio.com/docs/setup/mac
_reporter.WriteLine(
$"Cannot find the tools executable path. Please ensure {_fullPackageExecutablePath} is added to your PATH.{Environment.NewLine}" +
$"If you are using bash, You can do this by running the following command:{Environment.NewLine}{Environment.NewLine}" +
$"cat << EOF >> ~/.bash_profile{Environment.NewLine}" +
$"# Add .NET Core SDK tools{Environment.NewLine}" +
$"export PATH=\"$PATH:{_fullPackageExecutablePath}\"{Environment.NewLine}" +
$"EOF");
}
}
}
}
}

View file

@ -0,0 +1,89 @@
// 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;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.Extensions.EnvironmentAbstractions;
namespace Microsoft.DotNet.ShellShimMaker
{
public class ShellShimMaker
{
private readonly string _pathToPlaceShim;
public ShellShimMaker(string pathToPlaceShim)
{
_pathToPlaceShim =
pathToPlaceShim ?? throw new ArgumentNullException(nameof(pathToPlaceShim));
}
public void CreateShim(string packageExecutablePath, string shellCommandName)
{
var packageExecutable = new FilePath(packageExecutablePath);
var script = new StringBuilder();
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
script.AppendLine("@echo off");
script.AppendLine($"dotnet {packageExecutable.ToQuotedString()} %*");
}
else
{
script.AppendLine("#!/bin/sh");
script.AppendLine($"dotnet {packageExecutable.ToQuotedString()} \"$@\"");
}
FilePath scriptPath = GetScriptPath(shellCommandName);
File.WriteAllText(scriptPath.Value, script.ToString());
SetUserExecutionPermissionToShimFile(scriptPath);
}
public void EnsureCommandNameUniqueness(string shellCommandName)
{
if (File.Exists(Path.Combine(_pathToPlaceShim, shellCommandName)))
{
throw new GracefulException(
$"Failed to install tool {shellCommandName}. A command with the same name already exists.");
}
}
public void Remove(string shellCommandName)
{
File.Delete(GetScriptPath(shellCommandName).Value);
}
private FilePath GetScriptPath(string shellCommandName)
{
var scriptPath = Path.Combine(_pathToPlaceShim, shellCommandName);
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
scriptPath += ".cmd";
}
return new FilePath(scriptPath);
}
private static void SetUserExecutionPermissionToShimFile(FilePath scriptPath)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) return;
CommandResult result = new CommandFactory()
.Create("chmod", new[] {"u+x", scriptPath.Value})
.CaptureStdOut()
.CaptureStdErr()
.Execute();
if (result.ExitCode != 0)
{
throw new GracefulException(
"Failed to change permission:" +
$"{Environment.NewLine}Error: " + result.StdErr +
$"{Environment.NewLine}Output: " + result.StdOut);
}
}
}
}

View file

@ -0,0 +1,70 @@
// 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;
using System.Linq;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.Extensions.EnvironmentAbstractions;
namespace Microsoft.DotNet.ShellShimMaker
{
internal class WindowsEnvironmentPath : IEnvironmentPath
{
private readonly IReporter _reporter;
private readonly IEnvironmentProvider _environmentProvider;
private const string PathName = "PATH";
private readonly string _packageExecutablePath;
public WindowsEnvironmentPath(
string packageExecutablePath, IReporter reporter,
IEnvironmentProvider environmentProvider)
{
_packageExecutablePath
= packageExecutablePath ?? throw new ArgumentNullException(nameof(packageExecutablePath));
_environmentProvider
= environmentProvider ?? throw new ArgumentNullException(nameof(environmentProvider));
_reporter
= reporter ?? throw new ArgumentNullException(nameof(reporter));
}
public void AddPackageExecutablePathToUserPath()
{
if (PackageExecutablePathExists())
{
return;
}
var existingUserEnvPath = Environment.GetEnvironmentVariable(PathName, EnvironmentVariableTarget.User);
Environment.SetEnvironmentVariable(
PathName,
$"{existingUserEnvPath};{_packageExecutablePath}",
EnvironmentVariableTarget.User);
}
private bool PackageExecutablePathExists()
{
return _environmentProvider.GetEnvironmentVariable(PathName).Split(';').Contains(_packageExecutablePath);
}
public void PrintAddPathInstructionIfPathDoesNotExist()
{
if (!PackageExecutablePathExists())
{
if (Environment.GetEnvironmentVariable(PathName, EnvironmentVariableTarget.User).Split(';')
.Contains(_packageExecutablePath))
{
_reporter.WriteLine(
"Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed.");
}
else
{
_reporter.WriteLine(
$"Cannot find the tools executable path. Please ensure {_packageExecutablePath} is added to your PATH.{Environment.NewLine}" +
$"You can do this by running the following command:{Environment.NewLine}{Environment.NewLine}" +
$"setx PATH \\\"%PATH%;{_packageExecutablePath}\"{Environment.NewLine}");
}
}
}
}
}

View file

@ -247,6 +247,22 @@ namespace Microsoft.DotNet.Tools.Common
string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, slnProject.FilePath));
}
foreach (var project in slnFile.Projects)
{
var dependencies = project.Dependencies;
if (dependencies == null)
{
continue;
}
dependencies.SkipIfEmpty = true;
foreach (var removed in projectsToRemove)
{
dependencies.Properties.Remove(removed.Id);
}
}
projectRemoved = true;
}

View file

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

View file

@ -0,0 +1,12 @@
// 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 Microsoft.Extensions.EnvironmentAbstractions;
namespace Microsoft.DotNet.ToolPackageObtainer
{
internal interface IPackageToProjectFileAdder
{
void Add(FilePath projectPath, string packageId);
}
}

View file

@ -0,0 +1,15 @@
// 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 Microsoft.Extensions.EnvironmentAbstractions;
namespace Microsoft.DotNet.ToolPackageObtainer
{
internal interface IProjectRestorer
{
void Restore(
FilePath projectPath,
DirectoryPath assetJsonOutput,
FilePath? nugetconfig);
}
}

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.ToolPackageObtainer
{
internal class PackageObtainException : Exception
{
public PackageObtainException()
{
}
public PackageObtainException(string message) : base(message)
{
}
public PackageObtainException(string message, Exception innerException) : base(message, innerException)
{
}
}
}

View file

@ -0,0 +1,28 @@
// 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.IO;
namespace Microsoft.DotNet.ToolPackageObtainer
{
internal class PackageVersion
{
public PackageVersion(string packageVersion)
{
if (packageVersion == null)
{
Value = Path.GetRandomFileName();
IsPlaceholder = true;
}
else
{
Value = packageVersion;
IsPlaceholder = false;
}
}
public bool IsPlaceholder { get; }
public string Value { get; }
public bool IsConcreteValue => !IsPlaceholder;
}
}

View file

@ -0,0 +1,46 @@
// 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.ToolPackageObtainer
{
internal class ToolConfiguration
{
public ToolConfiguration(
string commandName,
string toolAssemblyEntryPoint)
{
if (string.IsNullOrWhiteSpace(commandName))
{
throw new ArgumentNullException(nameof(commandName), "Cannot be null or whitespace");
}
EnsureNoInvalidFilenameCharacters(commandName, nameof(toolAssemblyEntryPoint));
if (string.IsNullOrWhiteSpace(toolAssemblyEntryPoint))
{
throw new ArgumentNullException(nameof(toolAssemblyEntryPoint), "Cannot be null or whitespace");
}
CommandName = commandName;
ToolAssemblyEntryPoint = toolAssemblyEntryPoint;
}
private void EnsureNoInvalidFilenameCharacters(string commandName, string nameOfParam)
{
// https://stackoverflow.com/questions/1976007/what-characters-are-forbidden-in-windows-and-linux-directory-names
char[] invalidCharactors = {'/', '<', '>', ':', '"', '/', '\\', '|', '?', '*'};
if (commandName.IndexOfAny(invalidCharactors) != -1)
{
throw new ArgumentException(
paramName: nameof(nameOfParam),
message: "Cannot contain following character " + new string(invalidCharactors));
}
}
public string CommandName { get; }
public string ToolAssemblyEntryPoint { get; }
}
}

View file

@ -0,0 +1,21 @@
// 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 Microsoft.Extensions.EnvironmentAbstractions;
namespace Microsoft.DotNet.ToolPackageObtainer
{
internal class ToolConfigurationAndExecutableDirectory
{
public ToolConfigurationAndExecutableDirectory(
ToolConfiguration toolConfiguration,
DirectoryPath executableDirectory)
{
Configuration = toolConfiguration;
ExecutableDirectory = executableDirectory;
}
public ToolConfiguration Configuration { get; }
public DirectoryPath ExecutableDirectory { get; }
}
}

View file

@ -0,0 +1,13 @@
using System.Diagnostics;
using System.Xml.Serialization;
namespace Microsoft.DotNet.ToolPackageObtainer.ToolConfigurationDeserialization
{
[DebuggerStepThrough]
[XmlRoot(Namespace = "", IsNullable = false)]
public class DotNetCliTool
{
[XmlArrayItem("Command", IsNullable = false)]
public DotNetCliToolCommand[] Commands { get; set; }
}
}

View file

@ -0,0 +1,21 @@
using System;
using System.Diagnostics;
using System.Xml.Serialization;
namespace Microsoft.DotNet.ToolPackageObtainer.ToolConfigurationDeserialization
{
[Serializable]
[DebuggerStepThrough]
[XmlType(AnonymousType = true)]
public class DotNetCliToolCommand
{
[XmlAttribute]
public string Name { get; set; }
[XmlAttribute]
public string EntryPoint { get; set; }
[XmlAttribute]
public string Runner { get; set; }
}
}

View file

@ -0,0 +1,61 @@
// 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;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
using Microsoft.DotNet.ToolPackageObtainer.ToolConfigurationDeserialization;
namespace Microsoft.DotNet.ToolPackageObtainer
{
internal static class ToolConfigurationDeserializer
{
public static ToolConfiguration Deserialize(string pathToXml)
{
var serializer = new XmlSerializer(typeof(DotNetCliTool));
DotNetCliTool dotNetCliTool;
using (var fs = new FileStream(pathToXml, FileMode.Open))
{
var reader = XmlReader.Create(fs);
try
{
dotNetCliTool = (DotNetCliTool)serializer.Deserialize(reader);
}
catch (InvalidOperationException e) when (e.InnerException is XmlException)
{
throw new ToolConfigurationException(
"Failed to retrive tool configuration exception, configuration is malformed xml. " +
e.InnerException.Message);
}
}
if (dotNetCliTool.Commands.Length != 1)
{
throw new ToolConfigurationException(
"Failed to retrive tool configuration exception, one and only one command is supported.");
}
if (dotNetCliTool.Commands[0].Runner != "dotnet")
{
throw new ToolConfigurationException(
"Failed to retrive tool configuration exception, only dotnet as runner is supported.");
}
var commandName = dotNetCliTool.Commands[0].Name;
var toolAssemblyEntryPoint = dotNetCliTool.Commands[0].EntryPoint;
try
{
return new ToolConfiguration(commandName, toolAssemblyEntryPoint);
}
catch (ArgumentException e)
{
throw new ToolConfigurationException("Configuration content error. " + e.Message);
}
}
}
}

View file

@ -0,0 +1,14 @@
// 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.ToolPackageObtainer
{
internal class ToolConfigurationException : ArgumentException
{
public ToolConfigurationException(string message) : base(message)
{
}
}
}

View file

@ -0,0 +1,190 @@
using System;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using Microsoft.Extensions.EnvironmentAbstractions;
namespace Microsoft.DotNet.ToolPackageObtainer
{
internal class ToolPackageObtainer
{
private readonly Lazy<string> _bundledTargetFrameworkMoniker;
private readonly Func<FilePath> _getTempProjectPath;
private readonly IPackageToProjectFileAdder _packageToProjectFileAdder;
private readonly IProjectRestorer _projectRestorer;
private readonly DirectoryPath _toolsPath;
public ToolPackageObtainer(
DirectoryPath toolsPath,
Func<FilePath> getTempProjectPath,
Lazy<string> bundledTargetFrameworkMoniker,
IPackageToProjectFileAdder packageToProjectFileAdder,
IProjectRestorer projectRestorer
)
{
_getTempProjectPath = getTempProjectPath;
_bundledTargetFrameworkMoniker = bundledTargetFrameworkMoniker;
_projectRestorer = projectRestorer ?? throw new ArgumentNullException(nameof(projectRestorer));
_packageToProjectFileAdder = packageToProjectFileAdder ??
throw new ArgumentNullException(nameof(packageToProjectFileAdder));
_toolsPath = toolsPath;
}
public ToolConfigurationAndExecutableDirectory ObtainAndReturnExecutablePath(
string packageId,
string packageVersion = null,
FilePath? nugetconfig = null,
string targetframework = null)
{
if (packageId == null)
{
throw new ArgumentNullException(nameof(packageId));
}
if (targetframework == null)
{
targetframework = _bundledTargetFrameworkMoniker.Value;
}
var packageVersionOrPlaceHolder = new PackageVersion(packageVersion);
DirectoryPath individualToolVersion =
CreateIndividualToolVersionDirectory(packageId, packageVersionOrPlaceHolder);
FilePath tempProjectPath = CreateTempProject(
packageId,
packageVersionOrPlaceHolder,
targetframework,
individualToolVersion);
if (packageVersionOrPlaceHolder.IsPlaceholder)
{
InvokeAddPackageRestore(
nugetconfig,
tempProjectPath,
packageId);
}
InvokeRestore(nugetconfig, tempProjectPath, individualToolVersion);
if (packageVersionOrPlaceHolder.IsPlaceholder)
{
var concreteVersion =
new DirectoryInfo(
Directory.GetDirectories(
individualToolVersion.WithSubDirectories(packageId).Value).Single()).Name;
DirectoryPath concreteVersionIndividualToolVersion =
individualToolVersion.GetParentPath().WithSubDirectories(concreteVersion);
Directory.Move(individualToolVersion.Value, concreteVersionIndividualToolVersion.Value);
individualToolVersion = concreteVersionIndividualToolVersion;
packageVersion = concreteVersion;
}
ToolConfiguration toolConfiguration = GetConfiguration(packageId, packageVersion, individualToolVersion);
return new ToolConfigurationAndExecutableDirectory(
toolConfiguration,
individualToolVersion.WithSubDirectories(
packageId,
packageVersion,
"tools",
targetframework));
}
private static ToolConfiguration GetConfiguration(
string packageId,
string packageVersion,
DirectoryPath individualToolVersion)
{
FilePath toolConfigurationPath =
individualToolVersion
.WithSubDirectories(packageId, packageVersion, "tools")
.WithFile("DotnetToolsConfig.xml");
ToolConfiguration toolConfiguration =
ToolConfigurationDeserializer.Deserialize(toolConfigurationPath.Value);
return toolConfiguration;
}
private void InvokeRestore(
FilePath? nugetconfig,
FilePath tempProjectPath,
DirectoryPath individualToolVersion)
{
_projectRestorer.Restore(tempProjectPath, individualToolVersion, nugetconfig);
}
private FilePath CreateTempProject(
string packageId,
PackageVersion packageVersion,
string targetframework,
DirectoryPath individualToolVersion)
{
FilePath tempProjectPath = _getTempProjectPath();
if (Path.GetExtension(tempProjectPath.Value) != "csproj")
{
tempProjectPath = new FilePath(Path.ChangeExtension(tempProjectPath.Value, "csproj"));
}
EnsureDirectoryExists(tempProjectPath.GetDirectoryPath());
var tempProjectContent = new XDocument(
new XElement("Project",
new XAttribute("Sdk", "Microsoft.NET.Sdk"),
new XElement("PropertyGroup",
new XElement("TargetFramework", targetframework),
new XElement("RestorePackagesPath", individualToolVersion.Value),
new XElement("DisableImplicitFrameworkReferences", "true")
),
packageVersion.IsConcreteValue
? new XElement("ItemGroup",
new XElement("PackageReference",
new XAttribute("Include", packageId),
new XAttribute("Version", packageVersion.Value)
))
: null));
File.WriteAllText(tempProjectPath.Value,
tempProjectContent.ToString());
return tempProjectPath;
}
private void InvokeAddPackageRestore(
FilePath? nugetconfig,
FilePath tempProjectPath,
string packageId)
{
if (nugetconfig != null)
{
File.Copy(
nugetconfig.Value.Value,
tempProjectPath
.GetDirectoryPath()
.WithFile("nuget.config")
.Value);
}
_packageToProjectFileAdder.Add(tempProjectPath, packageId);
}
private DirectoryPath CreateIndividualToolVersionDirectory(
string packageId,
PackageVersion packageVersion)
{
DirectoryPath individualTool = _toolsPath.WithSubDirectories(packageId);
DirectoryPath individualToolVersion = individualTool.WithSubDirectories(packageVersion.Value);
EnsureDirectoryExists(individualToolVersion);
return individualToolVersion;
}
private static void EnsureDirectoryExists(DirectoryPath path)
{
if (!Directory.Exists(path.Value))
{
Directory.CreateDirectory(path.Value);
}
}
}
}

View file

@ -0,0 +1,49 @@
// 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;
using System.Collections.Generic;
using Microsoft.DotNet.ToolPackageObtainer;
using Microsoft.Extensions.EnvironmentAbstractions;
namespace Microsoft.DotNet.Cli
{
internal class PackageToProjectFileAdder : IPackageToProjectFileAdder
{
public void Add(FilePath projectPath, string packageId)
{
if (packageId == null)
{
throw new ArgumentNullException(nameof(packageId));
}
var argsToPassToRestore = new List<string>
{
projectPath.Value,
"package",
packageId,
"--no-restore"
};
var command = new DotNetCommandFactory(alwaysRunOutOfProc: true)
.Create(
"add",
argsToPassToRestore)
.CaptureStdOut()
.CaptureStdErr();
var result = command.Execute();
if (result.ExitCode != 0)
{
throw new PackageObtainException("Failed to add package. " +
$"{Environment.NewLine}WorkingDirectory: " +
result.StartInfo.WorkingDirectory +
$"{Environment.NewLine}Arguments: " +
result.StartInfo.Arguments +
$"{Environment.NewLine}Output: " +
result.StdErr + result.StdOut);
}
}
}
}

View file

@ -0,0 +1,55 @@
// 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;
using System.Collections.Generic;
using Microsoft.DotNet.ToolPackageObtainer;
using Microsoft.DotNet.PlatformAbstractions;
using Microsoft.Extensions.EnvironmentAbstractions;
namespace Microsoft.DotNet.Cli
{
internal class ProjectRestorer : IProjectRestorer
{
public void Restore(
FilePath projectPath,
DirectoryPath assetJsonOutput,
FilePath? nugetconfig)
{
var argsToPassToRestore = new List<string>();
argsToPassToRestore.Add(projectPath.ToQuotedString());
if (nugetconfig != null)
{
argsToPassToRestore.Add("--configfile");
argsToPassToRestore.Add(nugetconfig.Value.ToQuotedString());
}
argsToPassToRestore.AddRange(new List<string>
{
"--runtime",
RuntimeEnvironment.GetRuntimeIdentifier(),
$"/p:BaseIntermediateOutputPath={assetJsonOutput.ToQuotedString()}"
});
var command = new DotNetCommandFactory(alwaysRunOutOfProc: true)
.Create(
"restore",
argsToPassToRestore)
.CaptureStdOut()
.CaptureStdErr();
var result = command.Execute();
if (result.ExitCode != 0)
{
throw new PackageObtainException("Failed to restore package. " +
$"{Environment.NewLine}WorkingDirectory: " +
result.StartInfo.WorkingDirectory +
$"{Environment.NewLine}Arguments: " +
result.StartInfo.Arguments +
$"{Environment.NewLine}Output: " +
result.StdErr + result.StdOut);
}
}
}
}

View file

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

View file

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

View file

@ -130,7 +130,7 @@
<value>Directory in which to place built packages.</value>
</data>
<data name="CmdNoBuildOptionDescription" xml:space="preserve">
<value>Skip building the project prior to packing. By default, the project will be built.</value>
<value>Do not build project before packing. Implies --no-restore.</value>
</data>
<data name="CmdIncludeSymbolsDescription" xml:space="preserve">
<value>Include packages with symbols in addition to regular packages in output directory.</value>

View file

@ -43,7 +43,7 @@ namespace Microsoft.DotNet.Tools.Pack
msbuildArgs.AddRange(parsedPack.Arguments);
bool noRestore = parsedPack.HasOption("--no-restore");
bool noRestore = parsedPack.HasOption("--no-restore") || parsedPack.HasOption("--no-build");
return new PackCommand(
msbuildArgs,

View file

@ -23,8 +23,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildOptionDescription">
<source>Skip building the project prior to packing. By default, the project will be built.</source>
<target state="translated">Přeskočí sestavení projektu, dokud ho nezabalíte. Projekt se sestaví automaticky.</target>
<source>Do not build project before packing. Implies --no-restore.</source>
<target state="needs-review-translation">Přeskočí sestavení projektu, dokud ho nezabalíte. Projekt se sestaví automaticky.</target>
<note />
</trans-unit>
<trans-unit id="CmdIncludeSymbolsDescription">

View file

@ -23,8 +23,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildOptionDescription">
<source>Skip building the project prior to packing. By default, the project will be built.</source>
<target state="translated">Hiermit wird das Projekt nicht vor dem Packen erstellt. Standardmäßig wird das Projekt erstellt.</target>
<source>Do not build project before packing. Implies --no-restore.</source>
<target state="needs-review-translation">Hiermit wird das Projekt nicht vor dem Packen erstellt. Standardmäßig wird das Projekt erstellt.</target>
<note />
</trans-unit>
<trans-unit id="CmdIncludeSymbolsDescription">

View file

@ -23,8 +23,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildOptionDescription">
<source>Skip building the project prior to packing. By default, the project will be built.</source>
<target state="translated">Omita la compilación del proyecto antes de empaquetar. El proyecto se compilará de manera predeterminada.</target>
<source>Do not build project before packing. Implies --no-restore.</source>
<target state="needs-review-translation">Omita la compilación del proyecto antes de empaquetar. El proyecto se compilará de manera predeterminada.</target>
<note />
</trans-unit>
<trans-unit id="CmdIncludeSymbolsDescription">

View file

@ -23,8 +23,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildOptionDescription">
<source>Skip building the project prior to packing. By default, the project will be built.</source>
<target state="translated">Ignorez la génération du projet avant la compression. Par défaut, le projet est généré.</target>
<source>Do not build project before packing. Implies --no-restore.</source>
<target state="needs-review-translation">Ignorez la génération du projet avant la compression. Par défaut, le projet est généré.</target>
<note />
</trans-unit>
<trans-unit id="CmdIncludeSymbolsDescription">

View file

@ -23,8 +23,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildOptionDescription">
<source>Skip building the project prior to packing. By default, the project will be built.</source>
<target state="translated">Consente di ignorare la compilazione del progetto prima di creare il pacchetto. Per impostazione predefinita, il progetto verrà compilato.</target>
<source>Do not build project before packing. Implies --no-restore.</source>
<target state="needs-review-translation">Consente di ignorare la compilazione del progetto prima di creare il pacchetto. Per impostazione predefinita, il progetto verrà compilato.</target>
<note />
</trans-unit>
<trans-unit id="CmdIncludeSymbolsDescription">

View file

@ -23,8 +23,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildOptionDescription">
<source>Skip building the project prior to packing. By default, the project will be built.</source>
<target state="translated">パッキングの前に、プロジェクトの構築をスキップします。既定では、プロジェクトは構築されます。</target>
<source>Do not build project before packing. Implies --no-restore.</source>
<target state="needs-review-translation">パッキングの前に、プロジェクトの構築をスキップします。既定では、プロジェクトは構築されます。</target>
<note />
</trans-unit>
<trans-unit id="CmdIncludeSymbolsDescription">

View file

@ -23,8 +23,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildOptionDescription">
<source>Skip building the project prior to packing. By default, the project will be built.</source>
<target state="translated">압축하기 전에 프로젝트를 빌드하지 않습니다. 기본적으로 프로젝트가 빌드됩니다.</target>
<source>Do not build project before packing. Implies --no-restore.</source>
<target state="needs-review-translation">압축하기 전에 프로젝트를 빌드하지 않습니다. 기본적으로 프로젝트가 빌드됩니다.</target>
<note />
</trans-unit>
<trans-unit id="CmdIncludeSymbolsDescription">

View file

@ -23,8 +23,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildOptionDescription">
<source>Skip building the project prior to packing. By default, the project will be built.</source>
<target state="translated">Pomiń kompilację projektu przed pakowaniem. Domyślnie projekt zostanie skompilowany.</target>
<source>Do not build project before packing. Implies --no-restore.</source>
<target state="needs-review-translation">Pomiń kompilację projektu przed pakowaniem. Domyślnie projekt zostanie skompilowany.</target>
<note />
</trans-unit>
<trans-unit id="CmdIncludeSymbolsDescription">

View file

@ -23,8 +23,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildOptionDescription">
<source>Skip building the project prior to packing. By default, the project will be built.</source>
<target state="translated">Ignorar a compilação do projeto antes do empacotamento. Por padrão, o projeto será compilado.</target>
<source>Do not build project before packing. Implies --no-restore.</source>
<target state="needs-review-translation">Ignorar a compilação do projeto antes do empacotamento. Por padrão, o projeto será compilado.</target>
<note />
</trans-unit>
<trans-unit id="CmdIncludeSymbolsDescription">

View file

@ -23,8 +23,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildOptionDescription">
<source>Skip building the project prior to packing. By default, the project will be built.</source>
<target state="translated">Пропуск сборки проекта перед упаковкой. По умолчанию выполняется сборка проекта.</target>
<source>Do not build project before packing. Implies --no-restore.</source>
<target state="needs-review-translation">Пропуск сборки проекта перед упаковкой. По умолчанию выполняется сборка проекта.</target>
<note />
</trans-unit>
<trans-unit id="CmdIncludeSymbolsDescription">

View file

@ -23,8 +23,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildOptionDescription">
<source>Skip building the project prior to packing. By default, the project will be built.</source>
<target state="translated">Projeyi paketlemeden önce derlemeyi atlayın. Varsayılan olarak, proje derlenir.</target>
<source>Do not build project before packing. Implies --no-restore.</source>
<target state="needs-review-translation">Projeyi paketlemeden önce derlemeyi atlayın. Varsayılan olarak, proje derlenir.</target>
<note />
</trans-unit>
<trans-unit id="CmdIncludeSymbolsDescription">

View file

@ -23,8 +23,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildOptionDescription">
<source>Skip building the project prior to packing. By default, the project will be built.</source>
<target state="translated">在打包之前跳过生成项目。默认情况下,将生成项目。</target>
<source>Do not build project before packing. Implies --no-restore.</source>
<target state="needs-review-translation">在打包之前跳过生成项目。默认情况下,将生成项目。</target>
<note />
</trans-unit>
<trans-unit id="CmdIncludeSymbolsDescription">

View file

@ -23,8 +23,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildOptionDescription">
<source>Skip building the project prior to packing. By default, the project will be built.</source>
<target state="translated">在封裝前跳過建置專案。預設會建置專案。</target>
<source>Do not build project before packing. Implies --no-restore.</source>
<target state="needs-review-translation">在封裝前跳過建置專案。預設會建置專案。</target>
<note />
</trans-unit>
<trans-unit id="CmdIncludeSymbolsDescription">

View file

@ -124,14 +124,11 @@
<value>Command used to run .NET apps</value>
</data>
<data name="CommandOptionNoBuildDescription" xml:space="preserve">
<value>Skip building the project prior to running. By default, the project will be built.</value>
<value>Do not build project before running. Implies --no-restore.</value>
</data>
<data name="CommandOptionFrameworkDescription" xml:space="preserve">
<value>Build and run the app using the specified framework. The framework has to be specified in the project file. </value>
</data>
<data name="CommandOptionNoBuild" xml:space="preserve">
<value>Do not build the project before running.</value>
</data>
<data name="CommandOptionProjectDescription" xml:space="preserve">
<value>The path to the project file to run (defaults to the current directory if there is only one project).</value>
</data>

View file

@ -26,7 +26,7 @@ namespace Microsoft.DotNet.Cli
project: o.SingleArgumentOrDefault("--project"),
launchProfile: o.SingleArgumentOrDefault("--launch-profile"),
noLaunchProfile: o.HasOption("--no-launch-profile"),
noRestore: o.HasOption("--no-restore"),
noRestore: o.HasOption("--no-restore") || o.HasOption("--no-build"),
restoreArgs: o.OptionValuesToBeForwarded(),
args: o.Arguments
)),
@ -51,7 +51,8 @@ namespace Microsoft.DotNet.Cli
"--no-build",
LocalizableStrings.CommandOptionNoBuildDescription,
Accept.NoArguments()),
CommonOptions.NoRestoreOption()
CommonOptions.NoRestoreOption(),
CommonOptions.VerbosityOption()
});
}
}

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">Před spuštěním vynechá sestavení projektu. Standardně se projekt sestaví.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">Před spuštěním nesestavovat projekt</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">Před spuštěním vynechá sestavení projektu. Standardně se projekt sestaví.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">Überspringen Sie die Erstellung des Projekts vor dem Ausführen. Das Projekt wird standardmäßig erstellt.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">Erstellen Sie das Projekt nicht vor dem Ausführen.</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">Überspringen Sie die Erstellung des Projekts vor dem Ausführen. Das Projekt wird standardmäßig erstellt.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">Omite la compilación del proyecto antes de ejecutarlo. El proyecto se compilará de manera predeterminada.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">No se compila el proyecto antes de ejecutarlo.</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">Omite la compilación del proyecto antes de ejecutarlo. El proyecto se compilará de manera predeterminada.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">Ignorez la génération du projet avant l'exécution. Par défaut, le projet est généré.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">Ne générez pas le projet avant l'exécution.</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">Ignorez la génération du projet avant l'exécution. Par défaut, le projet est généré.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">Consente di ignorare la compilazione del progetto prima dell'esecuzione. Per impostazione predefinita, il progetto verrà compilato.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">Non compilare il progetto prima dell'esecuzione.</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">Consente di ignorare la compilazione del progetto prima dell'esecuzione. Per impostazione predefinita, il progetto verrà compilato.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">実行の前に、プロジェクトのビルドをスキップします。既定では、プロジェクトはビルドされます。</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">実行する前にプロジェクトをビルドしません。</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">実行の前に、プロジェクトのビルドをスキップします。既定では、プロジェクトはビルドされます。</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">실행하기 전에 프로젝트를 빌드하지 않습니다. 기본적으로 프로젝트가 빌드됩니다.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">실행하기 전에 프로젝트를 빌드하지 않습니다.</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">실행하기 전에 프로젝트를 빌드하지 않습니다. 기본적으로 프로젝트가 빌드됩니다.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">Pomiń kompilację projektu przed uruchomieniem. Domyślnie projekt zostanie skompilowany.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">Nie kompiluj projektu przed uruchomieniem.</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">Pomiń kompilację projektu przed uruchomieniem. Domyślnie projekt zostanie skompilowany.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">Ignorar a compilação do projeto antes da execução. Por padrão, o projeto será compilado.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">Não compilar o projeto antes da execução.</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">Ignorar a compilação do projeto antes da execução. Por padrão, o projeto será compilado.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">Пропуск сборки проекта перед запуском. По умолчанию выполняется сборка проекта.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">Не выполнять сборку проекта перед запуском.</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">Пропуск сборки проекта перед запуском. По умолчанию выполняется сборка проекта.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">Projeyi çalıştırmadan önce derlemeyi atlayın. Varsayılan olarak, proje derlenir.</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">Projeyi çalıştırmadan önce derleme.</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">Projeyi çalıştırmadan önce derlemeyi atlayın. Varsayılan olarak, proje derlenir.</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">在运行之前跳过项目生成操作。将默认生成项目。</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">运行之前不要生成项目。</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">在运行之前跳过项目生成操作。将默认生成项目。</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -33,13 +33,8 @@
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuildDescription">
<source>Skip building the project prior to running. By default, the project will be built.</source>
<target state="translated">在執行之前跳過建置該專案。根據預設,將會建置該專案。</target>
<note />
</trans-unit>
<trans-unit id="CommandOptionNoBuild">
<source>Do not build the project before running.</source>
<target state="translated">請勿在執行之前建置專案。</target>
<source>Do not build project before running. Implies --no-restore.</source>
<target state="needs-review-translation">在執行之前跳過建置該專案。根據預設,將會建置該專案。</target>
<note />
</trans-unit>
<trans-unit id="RunCommandExceptionUnableToRunSpecifyFramework">

View file

@ -193,7 +193,7 @@
Logs are written to the provided file.</value>
</data>
<data name="CmdNoBuildDescription" xml:space="preserve">
<value>Do not build project before testing.</value>
<value>Do not build project before testing. Implies --no-restore.</value>
</data>
<data name="CmdResultsDirectoryDescription" xml:space="preserve">
<value>The directory where the test results are going to be placed. The specified directory will be created if it does not exist.

View file

@ -70,7 +70,7 @@ namespace Microsoft.DotNet.Tools.Test
}
}
bool noRestore = parsedTest.HasOption("--no-restore");
bool noRestore = parsedTest.HasOption("--no-restore") || parsedTest.HasOption("--no-build");
return new TestCommand(
msbuildArgs,

View file

@ -125,8 +125,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildDescription">
<source>Do not build project before testing.</source>
<target state="translated">Nesestavujte projekt dříve, než ho otestujete.</target>
<source>Do not build project before testing. Implies --no-restore.</source>
<target state="needs-review-translation">Nesestavujte projekt dříve, než ho otestujete.</target>
<note />
</trans-unit>
<trans-unit id="CmdTestAdapterPath">

View file

@ -125,8 +125,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildDescription">
<source>Do not build project before testing.</source>
<target state="translated">Erstellen Sie das Projekt nicht vor dem Testen.</target>
<source>Do not build project before testing. Implies --no-restore.</source>
<target state="needs-review-translation">Erstellen Sie das Projekt nicht vor dem Testen.</target>
<note />
</trans-unit>
<trans-unit id="CmdTestAdapterPath">

View file

@ -125,8 +125,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildDescription">
<source>Do not build project before testing.</source>
<target state="translated">El proyecto no se compila antes de probarlo.</target>
<source>Do not build project before testing. Implies --no-restore.</source>
<target state="needs-review-translation">El proyecto no se compila antes de probarlo.</target>
<note />
</trans-unit>
<trans-unit id="CmdTestAdapterPath">

View file

@ -125,8 +125,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildDescription">
<source>Do not build project before testing.</source>
<target state="translated">Ne générez pas le projet avant les tests.</target>
<source>Do not build project before testing. Implies --no-restore.</source>
<target state="needs-review-translation">Ne générez pas le projet avant les tests.</target>
<note />
</trans-unit>
<trans-unit id="CmdTestAdapterPath">

View file

@ -125,8 +125,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildDescription">
<source>Do not build project before testing.</source>
<target state="translated">Il progetto non viene compilato prima del test.</target>
<source>Do not build project before testing. Implies --no-restore.</source>
<target state="needs-review-translation">Il progetto non viene compilato prima del test.</target>
<note />
</trans-unit>
<trans-unit id="CmdTestAdapterPath">

View file

@ -125,8 +125,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildDescription">
<source>Do not build project before testing.</source>
<target state="translated">テストする前にプロジェクトを構築しないでください。</target>
<source>Do not build project before testing. Implies --no-restore.</source>
<target state="needs-review-translation">テストする前にプロジェクトを構築しないでください。</target>
<note />
</trans-unit>
<trans-unit id="CmdTestAdapterPath">

View file

@ -125,8 +125,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildDescription">
<source>Do not build project before testing.</source>
<target state="translated">테스트하기 전에 프로젝트를 빌드하지 않습니다.</target>
<source>Do not build project before testing. Implies --no-restore.</source>
<target state="needs-review-translation">테스트하기 전에 프로젝트를 빌드하지 않습니다.</target>
<note />
</trans-unit>
<trans-unit id="CmdTestAdapterPath">

View file

@ -125,8 +125,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildDescription">
<source>Do not build project before testing.</source>
<target state="translated">Nie kompiluj projektu przed przeprowadzeniem testów.</target>
<source>Do not build project before testing. Implies --no-restore.</source>
<target state="needs-review-translation">Nie kompiluj projektu przed przeprowadzeniem testów.</target>
<note />
</trans-unit>
<trans-unit id="CmdTestAdapterPath">

View file

@ -125,8 +125,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildDescription">
<source>Do not build project before testing.</source>
<target state="translated">Não compile o projeto antes de testar.</target>
<source>Do not build project before testing. Implies --no-restore.</source>
<target state="needs-review-translation">Não compile o projeto antes de testar.</target>
<note />
</trans-unit>
<trans-unit id="CmdTestAdapterPath">

View file

@ -125,8 +125,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildDescription">
<source>Do not build project before testing.</source>
<target state="translated">Не выполнять сборку проектов перед тестированием.</target>
<source>Do not build project before testing. Implies --no-restore.</source>
<target state="needs-review-translation">Не выполнять сборку проектов перед тестированием.</target>
<note />
</trans-unit>
<trans-unit id="CmdTestAdapterPath">

View file

@ -125,8 +125,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildDescription">
<source>Do not build project before testing.</source>
<target state="translated">Projeyi derlemeden önce test edin.</target>
<source>Do not build project before testing. Implies --no-restore.</source>
<target state="needs-review-translation">Projeyi derlemeden önce test edin.</target>
<note />
</trans-unit>
<trans-unit id="CmdTestAdapterPath">

View file

@ -125,8 +125,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildDescription">
<source>Do not build project before testing.</source>
<target state="translated">测试之前不要生成项目。</target>
<source>Do not build project before testing. Implies --no-restore.</source>
<target state="needs-review-translation">测试之前不要生成项目。</target>
<note />
</trans-unit>
<trans-unit id="CmdTestAdapterPath">

View file

@ -125,8 +125,8 @@
<note />
</trans-unit>
<trans-unit id="CmdNoBuildDescription">
<source>Do not build project before testing.</source>
<target state="translated">請勿在測試前建置專案。</target>
<source>Do not build project before testing. Implies --no-restore.</source>
<target state="needs-review-translation">請勿在測試前建置專案。</target>
<note />
</trans-unit>
<trans-unit id="CmdTestAdapterPath">

View file

@ -219,7 +219,7 @@
<Target Name="CrossgenPublishDir"
Condition=" '$(DISABLE_CROSSGEN)' == '' "
AfterTargets="GenerateCliRuntimeConfigurationFiles">
AfterTargets="PublishSdks">
<ItemGroup>
<RoslynFiles Include="$(PublishDir)Roslyn\bincore\**\*" />
<FSharpFiles Include="$(PublishDir)FSharp\**\*" Exclude="$(PublishDir)FSharp\FSharp.Build.dll" />
@ -230,12 +230,13 @@
<RemainingFiles Remove="$(PublishDir)Sdks\**\*" />
<RemainingFiles Remove="$(PublishDir)**\Microsoft.TestPlatform.Extensions.EventLogCollector.dll" />
<!-- Add back the .NET Core assemblies in the Sdks folder -->
<RemainingFiles Include="$(PublishDir)Sdks\Microsoft.NET.Sdk\tools\netcoreapp2.0\**\*" />
<RemainingFiles Include="$(PublishDir)Sdks\NuGet.Build.Tasks.Pack\CoreCLR\**\*" />
<!-- Don't try to CrossGen .NET Framework support assemblies for .NET Standard -->
<RemainingFiles Remove="$(PublishDir)Microsoft\Microsoft.NET.Build.Extensions\net*\**\*" />
<!-- Don't try to CrossGen tasks and supporting DLLs compiled for .NET Framework -->
<RemainingFiles Remove="$(PublishDir)Microsoft\Microsoft.NET.Build.Extensions\tools\net*\**\*" />
<!-- Don't crossgen satellite assemblies -->
<RoslynFiles Remove="$(PublishDir)Roslyn\bincore\**\*.resources.dll" />
<FSharpFiles Remove="$(PublishDir)FSharp\**\*.resources.dll" />
@ -297,7 +298,7 @@
CreateSymbols="$(CreateCrossgenSymbols)"
DiasymReaderPath="@(DiasymReaderPath)"
PlatformAssemblyPaths="@(PlatformAssemblies);@(FSharpFolders);$(SharedFrameworkNameVersionPath)" />
<Crossgen
SourceAssembly="%(RemainingTargets.FullPath)"
DestinationPath="%(RemainingTargets.FullPath)"

View file

@ -13,6 +13,7 @@
<PackageReference Include="Microsoft.NetCore.App" Version="$(CLI_SharedFrameworkVersion)" />
<PackageReference Include="Microsoft.FSharp.Compiler" Version="$(CLI_FSharp_Version)" />
<PackageReference Include="CliDeps.Satellites.FSharp" Version="$(CLI_FSharp_Satellites_Version)" />
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
@ -35,10 +36,15 @@
SectionName="%(AssetsToRemoveFromDeps.SectionName)"
AssetPath="%(AssetsToRemoveFromDeps.Identity)" />
<!-- Deploy deps and runtime config for fsc.exe and fsi.exe. Both apps have exactly the same dependencies so this is Ok -->
<Copy SourceFiles="$(PublishDir)/$(TargetName).runtimeconfig.json;
$(PublishDir)/$(TargetName).deps.json;"
DestinationFiles="$(PublishDir)/fsc.runtimeconfig.json;
$(PublishDir)/fsc.deps.json;"/>
<Copy SourceFiles="$(PublishDir)/$(TargetName).runtimeconfig.json;
$(PublishDir)/$(TargetName).deps.json;"
DestinationFiles="$(PublishDir)/fsi.runtimeconfig.json;
$(PublishDir)/fsi.deps.json;"/>
</Target>
<Target Name="RemoveFilesAfterPublish"

View file

@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26419.0
VisualStudioVersion = 15.0.27004.2008
MinimumVisualStudioVersion = 10.0.40219.1
Project("{13B669BE-BB05-4DDF-9536-439F39A36129}") = "dotnet-add-reference.Tests", "dotnet-add-reference.Tests\dotnet-add-reference.Tests.csproj", "{AB63A3E5-76A3-4EE9-A380-8E0C7B7644DC}"
EndProject
@ -74,13 +74,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-store.Tests", "dotne
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-back-compat.Tests", "dotnet-back-compat.Tests\dotnet-back-compat.Tests.csproj", "{27351B2F-325B-4843-9F4C-BC53FD06A7B5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnet-remove-package.Tests", "dotnet-remove-package.Tests\dotnet-remove-package.Tests.csproj", "{CF517B15-B307-4660-87D5-CC036ADECD4B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-remove-package.Tests", "dotnet-remove-package.Tests\dotnet-remove-package.Tests.csproj", "{CF517B15-B307-4660-87D5-CC036ADECD4B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.MSBuildSdkResolver.Tests", "Microsoft.DotNet.MSBuildSdkResolver.Tests\Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj", "{42A0CAB4-FFAD-47D4-9880-C0F4EDCF93DE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnet-clean.Tests", "dotnet-clean.Tests\dotnet-clean.Tests.csproj", "{D9A582B8-1FE2-45D5-B139-0BA828FE3691}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-clean.Tests", "dotnet-clean.Tests\dotnet-clean.Tests.csproj", "{D9A582B8-1FE2-45D5-B139-0BA828FE3691}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.DotNet.TestFramework", "Microsoft.DotNet.TestFramework\Microsoft.DotNet.TestFramework.csproj", "{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.TestFramework", "Microsoft.DotNet.TestFramework\Microsoft.DotNet.TestFramework.csproj", "{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.ToolPackageObtainer.Tests", "Microsoft.DotNet.ToolPackageObtainer.Tests\Microsoft.DotNet.ToolPackageObtainer.Tests.csproj", "{C2A907A3-677B-4C73-9AA4-E53613E13C78}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.ShellShimMaker.Tests", "Microsoft.DotNet.ShellShimMaker.Tests\Microsoft.DotNet.ShellShimMaker.Tests.csproj", "{1146EAAC-E434-404A-8198-B4F0CB23BC57}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -490,16 +494,16 @@ Global
{27351B2F-325B-4843-9F4C-BC53FD06A7B5}.Release|x86.Build.0 = Release|Any CPU
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Debug|x64.ActiveCfg = Debug|x64
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Debug|x64.Build.0 = Debug|x64
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Debug|x86.ActiveCfg = Debug|x86
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Debug|x86.Build.0 = Debug|x86
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Debug|x64.ActiveCfg = Debug|Any CPU
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Debug|x64.Build.0 = Debug|Any CPU
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Debug|x86.ActiveCfg = Debug|Any CPU
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Debug|x86.Build.0 = Debug|Any CPU
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Release|Any CPU.Build.0 = Release|Any CPU
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Release|x64.ActiveCfg = Release|x64
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Release|x64.Build.0 = Release|x64
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Release|x86.ActiveCfg = Release|x86
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Release|x86.Build.0 = Release|x86
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Release|x64.ActiveCfg = Release|Any CPU
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Release|x64.Build.0 = Release|Any CPU
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Release|x86.ActiveCfg = Release|Any CPU
{CF517B15-B307-4660-87D5-CC036ADECD4B}.Release|x86.Build.0 = Release|Any CPU
{42A0CAB4-FFAD-47D4-9880-C0F4EDCF93DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{42A0CAB4-FFAD-47D4-9880-C0F4EDCF93DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42A0CAB4-FFAD-47D4-9880-C0F4EDCF93DE}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -514,28 +518,52 @@ Global
{42A0CAB4-FFAD-47D4-9880-C0F4EDCF93DE}.Release|x86.Build.0 = Release|Any CPU
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Debug|x64.ActiveCfg = Debug|x64
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Debug|x64.Build.0 = Debug|x64
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Debug|x86.ActiveCfg = Debug|x86
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Debug|x86.Build.0 = Debug|x86
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Debug|x64.ActiveCfg = Debug|Any CPU
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Debug|x64.Build.0 = Debug|Any CPU
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Debug|x86.ActiveCfg = Debug|Any CPU
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Debug|x86.Build.0 = Debug|Any CPU
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Release|Any CPU.Build.0 = Release|Any CPU
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Release|x64.ActiveCfg = Release|x64
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Release|x64.Build.0 = Release|x64
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Release|x86.ActiveCfg = Release|x86
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Release|x86.Build.0 = Release|x86
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Release|x64.ActiveCfg = Release|Any CPU
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Release|x64.Build.0 = Release|Any CPU
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Release|x86.ActiveCfg = Release|Any CPU
{D9A582B8-1FE2-45D5-B139-0BA828FE3691}.Release|x86.Build.0 = Release|Any CPU
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Debug|x64.ActiveCfg = Debug|x64
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Debug|x64.Build.0 = Debug|x64
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Debug|x86.ActiveCfg = Debug|x86
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Debug|x86.Build.0 = Debug|x86
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Debug|x64.ActiveCfg = Debug|Any CPU
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Debug|x64.Build.0 = Debug|Any CPU
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Debug|x86.ActiveCfg = Debug|Any CPU
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Debug|x86.Build.0 = Debug|Any CPU
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Release|Any CPU.Build.0 = Release|Any CPU
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Release|x64.ActiveCfg = Release|x64
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Release|x64.Build.0 = Release|x64
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Release|x86.ActiveCfg = Release|x86
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Release|x86.Build.0 = Release|x86
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Release|x64.ActiveCfg = Release|Any CPU
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Release|x64.Build.0 = Release|Any CPU
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Release|x86.ActiveCfg = Release|Any CPU
{D23AFC9C-8FD5-45DD-A84C-0E6528C42F0E}.Release|x86.Build.0 = Release|Any CPU
{C2A907A3-677B-4C73-9AA4-E53613E13C78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C2A907A3-677B-4C73-9AA4-E53613E13C78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C2A907A3-677B-4C73-9AA4-E53613E13C78}.Debug|x64.ActiveCfg = Debug|Any CPU
{C2A907A3-677B-4C73-9AA4-E53613E13C78}.Debug|x64.Build.0 = Debug|Any CPU
{C2A907A3-677B-4C73-9AA4-E53613E13C78}.Debug|x86.ActiveCfg = Debug|Any CPU
{C2A907A3-677B-4C73-9AA4-E53613E13C78}.Debug|x86.Build.0 = Debug|Any CPU
{C2A907A3-677B-4C73-9AA4-E53613E13C78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C2A907A3-677B-4C73-9AA4-E53613E13C78}.Release|Any CPU.Build.0 = Release|Any CPU
{C2A907A3-677B-4C73-9AA4-E53613E13C78}.Release|x64.ActiveCfg = Release|Any CPU
{C2A907A3-677B-4C73-9AA4-E53613E13C78}.Release|x64.Build.0 = Release|Any CPU
{C2A907A3-677B-4C73-9AA4-E53613E13C78}.Release|x86.ActiveCfg = Release|Any CPU
{C2A907A3-677B-4C73-9AA4-E53613E13C78}.Release|x86.Build.0 = Release|Any CPU
{1146EAAC-E434-404A-8198-B4F0CB23BC57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1146EAAC-E434-404A-8198-B4F0CB23BC57}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1146EAAC-E434-404A-8198-B4F0CB23BC57}.Debug|x64.ActiveCfg = Debug|Any CPU
{1146EAAC-E434-404A-8198-B4F0CB23BC57}.Debug|x64.Build.0 = Debug|Any CPU
{1146EAAC-E434-404A-8198-B4F0CB23BC57}.Debug|x86.ActiveCfg = Debug|Any CPU
{1146EAAC-E434-404A-8198-B4F0CB23BC57}.Debug|x86.Build.0 = Debug|Any CPU
{1146EAAC-E434-404A-8198-B4F0CB23BC57}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1146EAAC-E434-404A-8198-B4F0CB23BC57}.Release|Any CPU.Build.0 = Release|Any CPU
{1146EAAC-E434-404A-8198-B4F0CB23BC57}.Release|x64.ActiveCfg = Release|Any CPU
{1146EAAC-E434-404A-8198-B4F0CB23BC57}.Release|x64.Build.0 = Release|Any CPU
{1146EAAC-E434-404A-8198-B4F0CB23BC57}.Release|x86.ActiveCfg = Release|Any CPU
{1146EAAC-E434-404A-8198-B4F0CB23BC57}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -545,4 +573,7 @@ Global
{5767D8F0-4ED9-4083-8BDC-ED9E65AA86EF} = {15DDC326-69C3-4081-8AA1-B578B2BDE2C6}
{92BA9F90-E25B-4A1C-9598-2295D3DFC12F} = {BB393A93-1770-4753-B7D6-56F0DD378177}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7AF6777A-0133-453A-B302-FDD974B8F39C}
EndGlobalSection
EndGlobal

View file

@ -20,6 +20,7 @@ namespace Microsoft.DotNet.Configurer.UnitTests
private Mock<IFirstTimeUseNoticeSentinel> _firstTimeUseNoticeSentinelMock;
private Mock<IEnvironmentProvider> _environmentProviderMock;
private Mock<IReporter> _reporterMock;
private Mock<IEnvironmentPath> _pathAdder;
public GivenADotnetFirstTimeUseConfigurer()
{
@ -28,6 +29,7 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_firstTimeUseNoticeSentinelMock = new Mock<IFirstTimeUseNoticeSentinel>();
_environmentProviderMock = new Mock<IEnvironmentProvider>();
_reporterMock = new Mock<IReporter>();
_pathAdder = new Mock<IEnvironmentPath>();
_environmentProviderMock
.Setup(e => e.GetEnvironmentVariableAsBool("DOTNET_SKIP_FIRST_TIME_EXPERIENCE", false))
@ -48,7 +50,8 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_firstTimeUseNoticeSentinelMock.Object,
_environmentProviderMock.Object,
_reporterMock.Object,
CliFallbackFolderPath);
CliFallbackFolderPath,
_pathAdder.Object);
dotnetFirstTimeUseConfigurer.Configure();
@ -70,7 +73,8 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_firstTimeUseNoticeSentinelMock.Object,
_environmentProviderMock.Object,
_reporterMock.Object,
CliFallbackFolderPath);
CliFallbackFolderPath,
_pathAdder.Object);
dotnetFirstTimeUseConfigurer.Configure();
@ -92,7 +96,8 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_firstTimeUseNoticeSentinelMock.Object,
_environmentProviderMock.Object,
_reporterMock.Object,
CliFallbackFolderPath);
CliFallbackFolderPath,
_pathAdder.Object);
dotnetFirstTimeUseConfigurer.Configure();
@ -111,7 +116,8 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_firstTimeUseNoticeSentinelMock.Object,
_environmentProviderMock.Object,
_reporterMock.Object,
CliFallbackFolderPath);
CliFallbackFolderPath,
_pathAdder.Object);
dotnetFirstTimeUseConfigurer.Configure();
@ -130,7 +136,8 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_firstTimeUseNoticeSentinelMock.Object,
_environmentProviderMock.Object,
_reporterMock.Object,
CliFallbackFolderPath);
CliFallbackFolderPath,
_pathAdder.Object);
dotnetFirstTimeUseConfigurer.Configure();
@ -148,7 +155,8 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_firstTimeUseNoticeSentinelMock.Object,
_environmentProviderMock.Object,
_reporterMock.Object,
CliFallbackFolderPath);
CliFallbackFolderPath,
_pathAdder.Object);
dotnetFirstTimeUseConfigurer.Configure();
@ -166,7 +174,8 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_firstTimeUseNoticeSentinelMock.Object,
_environmentProviderMock.Object,
_reporterMock.Object,
CliFallbackFolderPath);
CliFallbackFolderPath,
_pathAdder.Object);
dotnetFirstTimeUseConfigurer.Configure();
@ -187,7 +196,8 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_firstTimeUseNoticeSentinelMock.Object,
_environmentProviderMock.Object,
_reporterMock.Object,
CliFallbackFolderPath);
CliFallbackFolderPath,
_pathAdder.Object);
dotnetFirstTimeUseConfigurer.Configure();
@ -205,7 +215,8 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_firstTimeUseNoticeSentinelMock.Object,
_environmentProviderMock.Object,
_reporterMock.Object,
CliFallbackFolderPath);
CliFallbackFolderPath,
_pathAdder.Object);
dotnetFirstTimeUseConfigurer.Configure();
@ -224,7 +235,8 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_firstTimeUseNoticeSentinelMock.Object,
_environmentProviderMock.Object,
_reporterMock.Object,
CliFallbackFolderPath);
CliFallbackFolderPath,
_pathAdder.Object);
dotnetFirstTimeUseConfigurer.Configure();
@ -246,7 +258,8 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_firstTimeUseNoticeSentinelMock.Object,
_environmentProviderMock.Object,
_reporterMock.Object,
CliFallbackFolderPath);
CliFallbackFolderPath,
_pathAdder.Object);
dotnetFirstTimeUseConfigurer.Configure();
@ -258,6 +271,26 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_reporterMock.Verify(r => r.Write(It.IsAny<string>()), Times.Never);
}
[Fact]
public void It_adds_executable_package_path_to_environment_path_when_the_first_notice_sentinel_does_not_exist()
{
_nugetCacheSentinelMock.Setup(n => n.Exists()).Returns(true);
_firstTimeUseNoticeSentinelMock.Setup(n => n.Exists()).Returns(false);
var dotnetFirstTimeUseConfigurer = new DotnetFirstTimeUseConfigurer(
_nugetCachePrimerMock.Object,
new FakeCreateWillExistNuGetCacheSentinel(false, true),
new FakeCreateWillExistFirstTimeUseNoticeSentinel(false),
_environmentProviderMock.Object,
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdder.Object);
dotnetFirstTimeUseConfigurer.Configure();
_pathAdder.Verify(p => p.AddPackageExecutablePathToUserPath(), Times.AtLeastOnce);
}
[Fact]
public void It_prints_the_unauthorized_notice_if_the_cache_sentinel_reports_Unauthorized()
{
@ -269,7 +302,8 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_firstTimeUseNoticeSentinelMock.Object,
_environmentProviderMock.Object,
_reporterMock.Object,
CliFallbackFolderPath);
CliFallbackFolderPath,
_pathAdder.Object);
dotnetFirstTimeUseConfigurer.Configure();
@ -295,11 +329,69 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_firstTimeUseNoticeSentinelMock.Object,
_environmentProviderMock.Object,
_reporterMock.Object,
CliFallbackFolderPath);
CliFallbackFolderPath,
_pathAdder.Object);
dotnetFirstTimeUseConfigurer.Configure();
_nugetCachePrimerMock.Verify(r => r.PrimeCache(), Times.Never);
}
private class FakeCreateWillExistFirstTimeUseNoticeSentinel : IFirstTimeUseNoticeSentinel
{
private bool _exists;
public FakeCreateWillExistFirstTimeUseNoticeSentinel(bool exists)
{
_exists = exists;
}
public void Dispose()
{
}
public bool Exists()
{
return _exists;
}
public void CreateIfNotExists()
{
_exists = true;
}
}
private class FakeCreateWillExistNuGetCacheSentinel : INuGetCacheSentinel
{
private bool _inProgressSentinelAlreadyExists;
private bool _exists;
public FakeCreateWillExistNuGetCacheSentinel(bool inProgressSentinelAlreadyExists, bool exists)
{
_inProgressSentinelAlreadyExists = inProgressSentinelAlreadyExists;
_exists = exists;
}
public void Dispose()
{
}
public bool InProgressSentinelAlreadyExists()
{
return _inProgressSentinelAlreadyExists;
}
public bool Exists()
{
return _exists;
}
public void CreateIfNotExists()
{
_exists = true;
}
public bool UnauthorizedAccess { get; set; }
}
}
}

Some files were not shown because too many files have changed in this diff Show more