Use vswhere to find the location of Visual Studio

vswhere tool is included since Visual Studio 2017 and is always located
at the same path thus making it a more convenient way to find Visual
Studio install directory.

Pick-to: 6.5
Change-Id: I680af8f88779841108b436223b4667f8a7c91aba
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
This commit is contained in:
Pavel Dubsky
2023-03-07 14:35:24 +01:00
parent 8b12598bf8
commit f58afd5476
2 changed files with 10 additions and 2 deletions

View File

@@ -274,3 +274,12 @@ function DeleteSchedulerTask {
Write-Host "Disabling $Task from Task Scheduler"
SCHTASKS /DELETE /TN "Microsoft\Windows\$Task" /F
}
function GetVSPath {
Param (
[string]$VSWhere = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe",
[string]$Component = "Microsoft.VisualStudio.Component.VC.Tools.x86.x64"
)
return (& $VSWhere -nologo -latest -products * -requires $Component -property installationPath)
}

View File

@@ -107,8 +107,7 @@ function InstallMingwFfmpeg {
function InstallMsvcFfmpeg {
$vsPath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"
#$vsPath = "C:\Program Files\Microsoft Visual Studio\2022\Professional"
$vsPath = GetVSPath
Write-Host "Enter VisualStudio developer shell"
try {