Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup tmp code for the --arch feature #3174

Merged
merged 2 commits into from
Nov 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions src/vstest.console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,47 +20,8 @@ public static class Program
public static int Main(string[] args)
{
DebuggerBreakpoint.WaitForDebugger("VSTEST_RUNNER_DEBUG");
ForwardDotnetRootEnvVarToNewVersion();
UILanguageOverride.SetCultureSpecifiedByUser();
return new Executor(ConsoleOutput.Instance).Execute(args);
}

/// <summary>
/// Forwarding of DOTNET_ROOT/DOTNET_ROOT(x86) env vars populted by SDK, this is needed to allow to --arch feature to work
/// as expected. If we use old SDK and new TP it won't work without env vars forwarding.
/// </summary>
private static void ForwardDotnetRootEnvVarToNewVersion()
{
// TODO: remove this and the console writes before publishing
var switchVars = Environment.GetEnvironmentVariable("VSTEST_TMP_SWITCH_DOTNETROOTS_ENVVARS");
if (switchVars != null && int.Parse(switchVars) == 1)
{
var dotnetRoot = Environment.GetEnvironmentVariable("DOTNET_ROOT");
if (dotnetRoot != null)
{
# if DEBUG
Console.WriteLine($"Forwarding DOTNET_ROOT to VSTEST_WINAPPHOST_DOTNET_ROOT '{dotnetRoot}'");
#endif
Environment.SetEnvironmentVariable("DOTNET_ROOT", null);
Environment.SetEnvironmentVariable("VSTEST_WINAPPHOST_DOTNET_ROOT", dotnetRoot);
#if DEBUG
Console.WriteLine($"Current DOTNET_ROOT '{Environment.GetEnvironmentVariable("DOTNET_ROOT")}'");
#endif
}

var dotnetRootX86 = Environment.GetEnvironmentVariable("DOTNET_ROOT(x86)");
if(dotnetRootX86 != null)
{
#if DEBUG
Console.WriteLine($"Forwarding DOTNET_ROOT(x86) to VSTEST_WINAPPHOST_DOTNET_ROOT(x86) '{dotnetRootX86}'");
#endif
Environment.SetEnvironmentVariable("DOTNET_ROOT(x86)", null);
Environment.SetEnvironmentVariable("VSTEST_WINAPPHOST_DOTNET_ROOT(x86)", dotnetRootX86);
#if DEBUG
Console.WriteLine($"Current DOTNET_ROOT(x86) '{Environment.GetEnvironmentVariable("DOTNET_ROOT(x86)")}'");
#endif
}
}
}
}
}