Ignore globally-installed .NET Core components (#18)

This commit is contained in:
Mike Harder 2018-08-29 16:37:50 -07:00 committed by GitHub
parent 941d94c907
commit 8e3d1f9e33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
@ -47,6 +47,11 @@ namespace Cli.FunctionalTests.Util
private static readonly HttpClient _httpClient = new HttpClient();
private static readonly IEnumerable<KeyValuePair<string, string>> _globalEnvironment = new KeyValuePair<string, string>[] {
// Ignore globally-installed .NET Core components
new KeyValuePair<string, string>("DOTNET_MULTILEVEL_LOOKUP", "false"),
};
private static (SemanticVersion SdkVersion, SemanticVersion RuntimeVersion) GetVersions()
{
var info = RunDotNet("--info", workingDirectory: null);
@ -151,7 +156,8 @@ namespace Cli.FunctionalTests.Util
private static (Process Process, ConcurrentStringBuilder OutputBuilder, ConcurrentStringBuilder ErrorBuilder) StartDotNet(
string arguments, string workingDirectory, IEnumerable<KeyValuePair<string, string>> environment = null)
{
return StartProcess("dotnet", arguments, workingDirectory, environment);
var env = _globalEnvironment.Concat(environment ?? Enumerable.Empty<KeyValuePair<string, string>>());
return StartProcess("dotnet", arguments, workingDirectory, env);
}
private static (Process Process, ConcurrentStringBuilder OutputBuilder, ConcurrentStringBuilder ErrorBuilder) StartProcess(