From 5e444258cbc75de10ba590f12a62c77c10e39379 Mon Sep 17 00:00:00 2001 From: William Li Date: Fri, 8 Nov 2019 13:58:10 -0800 Subject: [PATCH] Set DOTNET_ROOT in tests (#5584) --- .../Commands/TestCommand.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/TestCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/TestCommand.cs index a82872429..c25fcd533 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/TestCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/TestCommand.cs @@ -145,6 +145,17 @@ namespace Microsoft.DotNet.Tools.Test.Utilities psi.Environment["DOTNET_MULTILEVEL_LOOKUP"] = "0"; psi.Environment["DOTNET_SKIP_FIRST_TIME_EXPERIENCE"] = "1"; + // Set DOTNET_ROOT to ensure sub process find the same host fxr + string dotnetDirectoryPath = Path.GetDirectoryName(RepoDirectoriesProvider.DotnetUnderTest); + if (System.Environment.Is64BitProcess) + { + psi.Environment.Add("DOTNET_ROOT", dotnetDirectoryPath); + } + else + { + psi.Environment.Add("DOTNET_ROOT(x86)", dotnetDirectoryPath); + } + AddEnvironmentVariablesTo(psi); AddWorkingDirectoryTo(psi);