public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch 0/2] Fix the issue to set VS2017 and VS2019 prefix env
@ 2020-08-13  6:40 Liming Gao
  2020-08-13  6:40 ` [Patch 1/2] BaseTools: Move VS2019 env setting after VS2017 env setting Liming Gao
  2020-08-13  6:40 ` [Patch 2/2] BaseTools: Fix the issue in VS prefix setting for VS2017/VS2019 Liming Gao
  0 siblings, 2 replies; 5+ messages in thread
From: Liming Gao @ 2020-08-13  6:40 UTC (permalink / raw)
  To: devel; +Cc: Bob Feng, Yuwei Chen

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2896

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Yuwei Chen <yuwei.chen@intel.com>

Liming Gao (2):
  BaseTools: Move VS2019 env setting after VS2017 env setting
  BaseTools: Fix the issue in VS prefix setting for VS2017/VS2019

 BaseTools/set_vsprefix_envs.bat | 52 ++++++++++++++++++---------------
 1 file changed, 29 insertions(+), 23 deletions(-)

-- 
2.27.0.windows.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Patch 1/2] BaseTools: Move VS2019 env setting after VS2017 env setting
  2020-08-13  6:40 [Patch 0/2] Fix the issue to set VS2017 and VS2019 prefix env Liming Gao
@ 2020-08-13  6:40 ` Liming Gao
  2020-08-14  1:05   ` Bob Feng
  2020-08-13  6:40 ` [Patch 2/2] BaseTools: Fix the issue in VS prefix setting for VS2017/VS2019 Liming Gao
  1 sibling, 1 reply; 5+ messages in thread
From: Liming Gao @ 2020-08-13  6:40 UTC (permalink / raw)
  To: devel; +Cc: Bob Feng, Yuwei Chen

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2896

Keep the latest VS version as the last one

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 | 46 ++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/BaseTools/set_vsprefix_envs.bat b/BaseTools/set_vsprefix_envs.bat
index 9966a5a4ed..38fb0eb260 100644
--- a/BaseTools/set_vsprefix_envs.bat
+++ b/BaseTools/set_vsprefix_envs.bat
@@ -3,7 +3,7 @@
 @REM   however it may be executed directly from the BaseTools project folder
 @REM   if the file is not executed within a WORKSPACE\BaseTools folder.
 @REM
-@REM Copyright (c) 2016-2019, Intel Corporation. All rights reserved.<BR>
+@REM Copyright (c) 2016-2020, Intel Corporation. All rights reserved.<BR>
 @REM
 @REM SPDX-License-Identifier: BSD-2-Clause-Patent
 @REM
@@ -108,45 +108,45 @@ if defined VS140COMNTOOLS (
 )
 if /I "%1"=="VS2015" goto SetWinDDK
 
-:SetVS2019
-if not defined VS160COMNTOOLS (
+:SetVS2017
+if not defined VS150COMNTOOLS (
   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
+    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
       for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
         if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
       )
       del vswhereInfo
     ) else (
-      call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17 > vswhereInfo
+      call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
       for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
         if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
       )
       del vswhereInfo
     )
   ) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
-    if exist "%ProgramFiles%\Microsoft Visual Studio\2019\BuildTools" (
-      call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 16,17 > vswhereInfo
+    if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" (
+      call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo
       for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
         if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
       )
       del vswhereInfo
     ) else (
-      call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17 > vswhereInfo
+      call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
       for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
         if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
       )
       del vswhereInfo
     )
   ) else (
-    if /I "%1"=="VS2019" goto ToolNotInstall
+    if /I "%1"=="VS2017" goto ToolNotInstall
     goto SetWinDDK
   )
 )
 
 if defined VCToolsInstallDir (
-  if not defined VS2019_PREFIX (
-    set "VS2019_PREFIX=%VCToolsInstallDir%"
+  if not defined VS2017_PREFIX (
+    set "VS2017_PREFIX=%VCToolsInstallDir%"
   )
   if not defined WINSDK10_PREFIX (
     if defined WindowsSdkVerBinPath (
@@ -164,45 +164,45 @@ if not defined WINSDK_PATH_FOR_RC_EXE (
   )
 )
 
-:SetVS2017
-if not defined VS150COMNTOOLS (
+:SetVS2019
+if not defined VS160COMNTOOLS (
   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
+    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
       for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
         if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
       )
       del vswhereInfo
     ) else (
-      call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
+      call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17 > vswhereInfo
       for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
         if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
       )
       del vswhereInfo
     )
   ) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
-    if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" (
-      call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo
+    if exist "%ProgramFiles%\Microsoft Visual Studio\2019\BuildTools" (
+      call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 16,17 > vswhereInfo
       for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
         if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
       )
       del vswhereInfo
     ) else (
-      call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
+      call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17 > vswhereInfo
       for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
         if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
       )
       del vswhereInfo
     )
   ) else (
-    if /I "%1"=="VS2017" goto ToolNotInstall
+    if /I "%1"=="VS2019" goto ToolNotInstall
     goto SetWinDDK
   )
 )
 
 if defined VCToolsInstallDir (
-  if not defined VS2017_PREFIX (
-    set "VS2017_PREFIX=%VCToolsInstallDir%"
+  if not defined VS2019_PREFIX (
+    set "VS2019_PREFIX=%VCToolsInstallDir%"
   )
   if not defined WINSDK10_PREFIX (
     if defined WindowsSdkVerBinPath (
-- 
2.27.0.windows.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Patch 2/2] BaseTools: Fix the issue in VS prefix setting for VS2017/VS2019
  2020-08-13  6:40 [Patch 0/2] Fix the issue to set VS2017 and VS2019 prefix env Liming Gao
  2020-08-13  6:40 ` [Patch 1/2] BaseTools: Move VS2019 env setting after VS2017 env setting Liming Gao
@ 2020-08-13  6:40 ` Liming Gao
  2020-08-14  1:05   ` Bob Feng
  1 sibling, 1 reply; 5+ messages in thread
From: Liming Gao @ 2020-08-13  6:40 UTC (permalink / raw)
  To: devel; +Cc: Bob Feng, Yuwei Chen

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Patch 1/2] BaseTools: Move VS2019 env setting after VS2017 env setting
  2020-08-13  6:40 ` [Patch 1/2] BaseTools: Move VS2019 env setting after VS2017 env setting Liming Gao
@ 2020-08-14  1:05   ` Bob Feng
  0 siblings, 0 replies; 5+ messages in thread
From: Bob Feng @ 2020-08-14  1:05 UTC (permalink / raw)
  To: Gao, Liming, devel@edk2.groups.io; +Cc: Chen, Christine

Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: Gao, Liming <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 1/2] BaseTools: Move VS2019 env setting after VS2017 env setting

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2896

Keep the latest VS version as the last one

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 | 46 ++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/BaseTools/set_vsprefix_envs.bat b/BaseTools/set_vsprefix_envs.bat index 9966a5a4ed..38fb0eb260 100644
--- a/BaseTools/set_vsprefix_envs.bat
+++ b/BaseTools/set_vsprefix_envs.bat
@@ -3,7 +3,7 @@
 @REM   however it may be executed directly from the BaseTools project folder
 @REM   if the file is not executed within a WORKSPACE\BaseTools folder.
 @REM
-@REM Copyright (c) 2016-2019, Intel Corporation. All rights reserved.<BR>
+@REM Copyright (c) 2016-2020, Intel Corporation. All rights 
+reserved.<BR>
 @REM
 @REM SPDX-License-Identifier: BSD-2-Clause-Patent  @REM @@ -108,45 +108,45 @@ if defined VS140COMNTOOLS (
 )
 if /I "%1"=="VS2015" goto SetWinDDK
 
-:SetVS2019
-if not defined VS160COMNTOOLS (
+:SetVS2017
+if not defined VS150COMNTOOLS (
   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
+    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
       for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
         if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
       )
       del vswhereInfo
     ) else (
-      call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17 > vswhereInfo
+      call "%ProgramFiles(x86)%\Microsoft Visual 
+ Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
       for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
         if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
       )
       del vswhereInfo
     )
   ) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
-    if exist "%ProgramFiles%\Microsoft Visual Studio\2019\BuildTools" (
-      call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 16,17 > vswhereInfo
+    if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" (
+      call "%ProgramFiles%\Microsoft Visual 
+ Studio\Installer\vswhere.exe" -products 
+ Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo
       for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
         if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
       )
       del vswhereInfo
     ) else (
-      call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17 > vswhereInfo
+      call "%ProgramFiles%\Microsoft Visual 
+ Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
       for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
         if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
       )
       del vswhereInfo
     )
   ) else (
-    if /I "%1"=="VS2019" goto ToolNotInstall
+    if /I "%1"=="VS2017" goto ToolNotInstall
     goto SetWinDDK
   )
 )
 
 if defined VCToolsInstallDir (
-  if not defined VS2019_PREFIX (
-    set "VS2019_PREFIX=%VCToolsInstallDir%"
+  if not defined VS2017_PREFIX (
+    set "VS2017_PREFIX=%VCToolsInstallDir%"
   )
   if not defined WINSDK10_PREFIX (
     if defined WindowsSdkVerBinPath (
@@ -164,45 +164,45 @@ if not defined WINSDK_PATH_FOR_RC_EXE (
   )
 )
 
-:SetVS2017
-if not defined VS150COMNTOOLS (
+:SetVS2019
+if not defined VS160COMNTOOLS (
   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
+    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
       for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
         if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
       )
       del vswhereInfo
     ) else (
-      call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
+      call "%ProgramFiles(x86)%\Microsoft Visual 
+ Studio\Installer\vswhere.exe" -version 16,17 > vswhereInfo
       for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
         if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
       )
       del vswhereInfo
     )
   ) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
-    if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" (
-      call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo
+    if exist "%ProgramFiles%\Microsoft Visual Studio\2019\BuildTools" (
+      call "%ProgramFiles%\Microsoft Visual 
+ Studio\Installer\vswhere.exe" -products 
+ Microsoft.VisualStudio.Product.BuildTools -version 16,17 > vswhereInfo
       for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
         if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
       )
       del vswhereInfo
     ) else (
-      call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
+      call "%ProgramFiles%\Microsoft Visual 
+ Studio\Installer\vswhere.exe" -version 16,17 > vswhereInfo
       for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
         if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
       )
       del vswhereInfo
     )
   ) else (
-    if /I "%1"=="VS2017" goto ToolNotInstall
+    if /I "%1"=="VS2019" goto ToolNotInstall
     goto SetWinDDK
   )
 )
 
 if defined VCToolsInstallDir (
-  if not defined VS2017_PREFIX (
-    set "VS2017_PREFIX=%VCToolsInstallDir%"
+  if not defined VS2019_PREFIX (
+    set "VS2019_PREFIX=%VCToolsInstallDir%"
   )
   if not defined WINSDK10_PREFIX (
     if defined WindowsSdkVerBinPath (
--
2.27.0.windows.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Patch 2/2] BaseTools: Fix the issue in VS prefix setting for VS2017/VS2019
  2020-08-13  6:40 ` [Patch 2/2] BaseTools: Fix the issue in VS prefix setting for VS2017/VS2019 Liming Gao
@ 2020-08-14  1:05   ` Bob Feng
  0 siblings, 0 replies; 5+ messages in thread
From: Bob Feng @ 2020-08-14  1:05 UTC (permalink / raw)
  To: Gao, Liming, devel@edk2.groups.io; +Cc: Chen, Christine

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-08-14  1:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-13  6:40 [Patch 0/2] Fix the issue to set VS2017 and VS2019 prefix env Liming Gao
2020-08-13  6:40 ` [Patch 1/2] BaseTools: Move VS2019 env setting after VS2017 env setting Liming Gao
2020-08-14  1:05   ` Bob Feng
2020-08-13  6:40 ` [Patch 2/2] BaseTools: Fix the issue in VS prefix setting for VS2017/VS2019 Liming Gao
2020-08-14  1:05   ` Bob Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox