Fix issue when isPrerelease is not available

This commit is contained in:
Alexander Karatarakis 2018-02-28 18:06:54 -08:00
parent f3463c4867
commit d979d9b491
2 changed files with 15 additions and 2 deletions

View File

@ -3,6 +3,11 @@ function vcpkgHasModule([Parameter(Mandatory=$true)][string]$moduleName)
return [bool](Get-Module -ListAvailable -Name $moduleName)
}
function vcpkgHasProperty([Parameter(Mandatory=$true)]$object, [Parameter(Mandatory=$true)]$propertyName)
{
return [bool]($object.psobject.Properties | where { $_.Name -eq "$propertyName"})
}
function vcpkgCreateDirectoryIfNotExists([Parameter(Mandatory=$true)][string]$dirPath)
{
if (!(Test-Path $dirPath))

View File

@ -2,8 +2,10 @@
param(
)
Set-StrictMode -Version Latest
$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition
. "$scriptsDir\VcpkgPowershellUtils.ps1"
$vswhereExe = (& $scriptsDir\fetchTool.ps1 "vswhere") -replace "<sol>::" -replace "::<eol>"
$output = & $vswhereExe -prerelease -legacy -products * -format xml
@ -14,7 +16,13 @@ foreach ($instance in $asXml.instances.instance)
{
$installationPath = $instance.InstallationPath -replace "\\$" # Remove potential trailing backslash
$installationVersion = $instance.InstallationVersion
$isPrerelease = $instance.IsPrerelease
$isPrerelease = -7
if (vcpkgHasProperty -object $instance -propertyName "isPrerelease")
{
$isPrerelease = $instance.isPrerelease
}
if ($isPrerelease -eq 0)
{
$releaseType = "PreferenceWeight3::StableRelease"