Skip to content

Commit

Permalink
Use VS 2022 for building solution
Browse files Browse the repository at this point in the history
  • Loading branch information
yashagarwal23 committed Nov 16, 2023
1 parent a1acfe6 commit 5aa9ad7
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,36 +33,31 @@ if($MSBuildFullPath -ne "")
}
}

# msbuild path not provided, find msbuild for VS2019
# msbuild path not provided, find msbuild for VS2022
if($MSBuildFullPath -eq "")
{
if (Test-Path "env:\ProgramFiles(x86)")
$progFilesPaths = ${env:\ProgramFiles(x86)}, ${env:\ProgramFiles}
foreach ($progFilesPath in $progFilesPaths)
{
$progFilesPath = ${env:ProgramFiles(x86)}
}
elseif (Test-Path "env:\ProgramFiles")
{
$progFilesPath = ${env:ProgramFiles}
}

$VS2019InstallPath = join-path $progFilesPath "Microsoft Visual Studio\2019"
$versions = 'Community', 'Professional', 'Enterprise'
$VS2022InstallPath = join-path $progFilesPath "Microsoft Visual Studio\2022"
$versions = 'Preview', 'Community', 'Professional', 'Enterprise'

foreach ($version in $versions)
{
$VS2019VersionPath = join-path $VS2019InstallPath $version
$MSBuildFullPath = join-path $VS2019VersionPath "MSBuild\Current\Bin\MSBuild.exe"

if (Test-Path $MSBuildFullPath)
foreach ($version in $versions)
{
break
$VS2022VersionPath = join-path $VS2022InstallPath $version
$testPath = join-path $VS2022VersionPath "MSBuild\Current\Bin\MSBuild.exe"

if (Test-Path $testPath)
{
$MSBuildFullPath = $testPath
}
}
}
}

if (!(Test-Path $MSBuildFullPath))
{
throw "Unable to find MSBuild installed on this machine. Please install Visual Studio 2019 or if its installed at non-default location, provide the full ppath to msbuild using -MSBuildFullPath parameter."
throw "Unable to find MSBuild installed on this machine. Please install Visual Studio 2022 or if its installed at non-default location, provide the full ppath to msbuild using -MSBuildFullPath parameter."
}


Expand Down

0 comments on commit 5aa9ad7

Please sign in to comment.