Fix VS2022 Build Tools installation removing VS2019, fixes #1175#4288
Fix VS2022 Build Tools installation removing VS2019, fixes #1175#4288atalman merged 1 commit intopytorch:mainfrom
Conversation
|
@Blackhex is attempting to deploy a commit to the Meta Open Source Team on Vercel. A member of the Team first needs to authorize it. |
|
|
||
| if (Test-Path "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe") { | ||
| $existingPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -products "Microsoft.VisualStudio.Product.BuildTools" -version "[${env:VS_VERSION}, ${VS_VERSION_major + 1})" -property installationPath | ||
| $existingPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -products "Microsoft.VisualStudio.Product.BuildTools" -version "[${env:VS_VERSION}, $($VS_VERSION_major + 1))" -property installationPath |
There was a problem hiding this comment.
The former syntax was incorrect. The "${env:VS_VERSION}, ${VS_VERSION_major + 1}" expression evaluates to "". See https://www.pdq.com/blog/using-subexpressions-within-strings/ for more details.
| exit 1 | ||
| } | ||
|
|
||
| if ($pathToRemove -ne $null) { |
There was a problem hiding this comment.
Swapping $null and $pathToRemove order is a VSCode lint suggestion.
| # Install the Visual Studio 2019 | ||
| provisioner "powershell" { | ||
| environment_vars = ["INSTALL_WINDOWS_SDK=1", "VS_YEAR=2019", "VS_VERSION=16.11.21"] | ||
| environment_vars = ["INSTALL_WINDOWS_SDK=1", "VS_YEAR=2019", "VS_VERSION=16.11.21", "VS_UNINSTALL_PREVIOUS=1"] |
There was a problem hiding this comment.
Although the introduced VS_UNINSTALL_PREVIOUS variable logic breaks the current behavior, IMO, it's better to keep the VS installation by default. It does not seem that the Install-VS.ps1 script is used anywhere else so it should not be an issue anyway.
There was a problem hiding this comment.
@Blackhex should we add VS_UNINSTALL_PREVIOUS=0 to Visual Studio 2022 install ?
f4857bd to
4103bfe
Compare
|
Merging this - tested in canary with success |
Fixes issue that the VS2022 Build Tools installation is removing VS2019 Build Tools installation. This is a follow up fix of already merged #1175.