From 844e959e81c881fdcb7ac174e4c5c18f0e5ce804 Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Wed, 4 Jul 2018 14:13:09 +0200 Subject: [PATCH] set DOTNET_MULTILEVEL_LOOKUP=0 to get customDotNetCli path working, fixes #820 --- .../Toolchains/DotNetCli/DotNetCliCommandExecutor.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommandExecutor.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommandExecutor.cs index 73e13e618e..c777e5e496 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommandExecutor.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommandExecutor.cs @@ -96,6 +96,8 @@ internal static string GetDotNetSdkVersion() internal static ProcessStartInfo BuildStartInfo(string customDotNetCliPath, string workingDirectory, string arguments, IReadOnlyList environmentVariables = null, bool redirectStandardInput = false) { + const string dotnetMultiLevelLookupEnvVarName = "DOTNET_MULTILEVEL_LOOKUP"; + var startInfo = new ProcessStartInfo { FileName = customDotNetCliPath ?? "dotnet", @@ -112,6 +114,9 @@ internal static ProcessStartInfo BuildStartInfo(string customDotNetCliPath, stri foreach (var environmentVariable in environmentVariables) startInfo.EnvironmentVariables[environmentVariable.Key] = environmentVariable.Value; + if (!string.IsNullOrEmpty(customDotNetCliPath) && (environmentVariables == null || !environmentVariables.Any(envVar => envVar.Key == dotnetMultiLevelLookupEnvVarName))) + startInfo.EnvironmentVariables[dotnetMultiLevelLookupEnvVarName] = "0"; + return startInfo; } }