Skip to content

Commit

Permalink
BaseTools: Fix the issue in VS prefix setting for VS2017/VS2019
Browse files Browse the repository at this point in the history
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2896

When VS2017/VS2019 are both installed. VS prefix setting will
wrongly be set. VS2017_PREFIX is set to the same value of VS2019.

This patch clears VSINSTALLDIR and VCToolsVersion env, then
the different vcvars32 can set the correct VS env.

Signed-off-by: Liming Gao <[email protected]>
Cc: Bob Feng <[email protected]>
Cc: Yuwei Chen <[email protected]>
Reviewed-by: Bob Feng <[email protected]>
  • Loading branch information
lgao4 authored and mergify[bot] committed Aug 14, 2020
1 parent a5110b8 commit 24758e9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions BaseTools/set_vsprefix_envs.bat
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ if /I "%1"=="VS2015" goto SetWinDDK

:SetVS2017
if not defined VS150COMNTOOLS (
@REM clear two envs so that vcvars32.bat can run successfully.
set VSINSTALLDIR=
set VCToolsVersion=
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" (
call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo
Expand Down Expand Up @@ -166,6 +169,9 @@ if not defined WINSDK_PATH_FOR_RC_EXE (

:SetVS2019
if not defined VS160COMNTOOLS (
@REM clear two envs so that vcvars32.bat can run successfully.
set VSINSTALLDIR=
set VCToolsVersion=
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools" (
call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 16,17 > vswhereInfo
Expand Down

0 comments on commit 24758e9

Please sign in to comment.