mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-19 02:33:02 +08:00
Fix issue when isPrerelease is not available
This commit is contained in:
parent
f3463c4867
commit
d979d9b491
@ -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))
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user