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 <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Yuwei Chen <yuwei.chen@intel.com>
---
BaseTools/set_vsprefix_envs.bat | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/BaseTools/set_vsprefix_envs.bat b/BaseTools/set_vsprefix_envs.bat
index 38fb0eb260..2627587ba3 100644
--- a/BaseTools/set_vsprefix_envs.bat
+++ b/BaseTools/set_vsprefix_envs.bat
@@ -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
@@ -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
--
2.27.0.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#64140): https://edk2.groups.io/g/devel/message/64140
Mute This Topic: https://groups.io/mt/76163156/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
-----Original Message-----
From: Liming Gao <liming.gao@intel.com>
Sent: Thursday, August 13, 2020 2:41 PM
To: devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Chen, Christine <yuwei.chen@intel.com>
Subject: [Patch 2/2] BaseTools: Fix the issue in VS prefix setting for VS2017/VS2019
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 <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Yuwei Chen <yuwei.chen@intel.com>
---
BaseTools/set_vsprefix_envs.bat | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/BaseTools/set_vsprefix_envs.bat b/BaseTools/set_vsprefix_envs.bat index 38fb0eb260..2627587ba3 100644
--- a/BaseTools/set_vsprefix_envs.bat
+++ b/BaseTools/set_vsprefix_envs.bat
@@ -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 @@ -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
--
2.27.0.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#64263): https://edk2.groups.io/g/devel/message/64263
Mute This Topic: https://groups.io/mt/76163156/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2026 Red Hat, Inc.