Skip to content

Commit

Permalink
chocolatey-visualstudio.extension: Install-VSInstaller: improve resul…
Browse files Browse the repository at this point in the history
…t messages
  • Loading branch information
jberezanski committed May 15, 2018
1 parent fb56a84 commit b444158
Showing 1 changed file with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function Install-VSInstaller
# --update must be last
$silentArgs = ConvertTo-ArgumentString -InitialUnstructuredArguments @('--quiet') -Arguments $packageParameters -FinalUnstructuredArguments @('--update') -Syntax 'Willow'
$arguments = @{
packageName = $PackageName
packageName = 'Visual Studio Installer'
silentArgs = $silentArgs
url = $Url
checksum = $Checksum
Expand All @@ -132,21 +132,35 @@ function Install-VSInstaller

if ($updated.Version -ne $null)
{
if ($RequiredVersion -ne $null)
{
if ($updated.Version -lt $RequiredVersion)
if ($existing -eq $null -or $existing.Version -eq $null -or $existing.Version -lt $updated.Version)
{
if ($RequiredVersion -ne $null)
{
if ($updated.Version -lt $RequiredVersion)
{
Write-Warning "The Visual Studio Installer got updated to version $($updated.Version), which is still lower than the requirement of version $RequiredVersion or later."
}
else
{
Write-Verbose "The Visual Studio Installer got updated to version $($updated.Version), which satisfies the requirement of version $RequiredVersion or later."
}
}
else
{
Write-Verbose "The Visual Studio Installer got updated to version $($updated.Version)."
}
}
else
{
if ($existing.Version -eq $updated.Version)
{
Write-Warning "The Visual Studio Installer got updated to version $($updated.Version), which is still lower than the requirement of version $RequiredVersion or later."
Write-Verbose "The Visual Studio Installer version $($updated.Version) was reinstalled."
}
else
{
Write-Verbose "The Visual Studio Installer got updated to version $($updated.Version), which satisfies the requirement of version $RequiredVersion or later."
Write-Warning "The Visual Studio Installer got updated, but its version after update ($($updated.Version)) is lower than the version before update ($($existing.Version))."
}
}
else
{
Write-Verbose "The Visual Studio Installer got updated to version $($updated.Version)."
}
}
}
else
{
Expand Down

0 comments on commit b444158

Please sign in to comment.