Skip to content

Commit

Permalink
Use bitness from process or OS (#2571)
Browse files Browse the repository at this point in the history
  • Loading branch information
nohwnd authored Sep 17, 2020
1 parent 1b1d0ca commit f2f8d72
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/vstest.console/TestPlatformHelpers/TestRequestManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,19 @@ private bool UpdateRunSettingsIfRequired(string runsettingsXml, List<string> sou
|| chosenFramework.Name.IndexOf("netcoreapp", StringComparison.OrdinalIgnoreCase) >= 0
|| chosenFramework.Name.IndexOf("net5", StringComparison.OrdinalIgnoreCase) >= 0)
{
defaultArchitecture = Environment.Is64BitOperatingSystem ? Architecture.X64 : Architecture.X86;
#if NETCOREAPP
// We are running in vstest.console that is either started via dotnet.exe or via vstest.console.exe .NET Core
// executable. For AnyCPU dlls this should resolve 32-bit SDK when running from 32-bit dotnet process and
// 64-bit SDK when running from 64-bit dotnet process.
defaultArchitecture = Environment.Is64BitProcess ? Architecture.X64 : Architecture.X86;
#else
// We are running in vstest.console.exe that was built against .NET Framework. This console prefers 32-bit
// because it needs to run as 32-bit to be compatible with QTAgent. It runs as 32-bit both under VS and
// in Developer console. Set the default architecture based on the OS architecture, to find 64-bit dotnet SDK
// when running AnyCPU dll on 64-bit system, and 32-bit SDK when running AnyCPU dll on 32-bit OS.
// We want to find 64-bit SDK because it is more likely to be installed.
defaultArchitecture = Environment.Is64BitOperatingSystem ? Architecture.X64 : Architecture.X86;
#endif
}

settingsUpdated |= this.UpdatePlatform(document, navigator, sources, sourcePlatforms, defaultArchitecture, out Architecture chosenPlatform);
Expand Down

0 comments on commit f2f8d72

Please sign in to comment.