88[CmdletBinding ()]
99param (
1010 [System.String []] $Release ,
11+ [System.String []] $Architecture = @ (" x64" , " x86" ),
1112 [System.String ] $Path ,
1213 [System.String ] $VcManifest
1314)
@@ -21,31 +22,33 @@ process {
2122
2223 $Output = @ ()
2324 $FoundNewVersion = $false
24- foreach ($Item in $Release ) {
25+ foreach ($Arch in $Architecture ) {
26+ foreach ($Rls in $Release ) {
2527
26- Write-Host " `t Installing VcRedist $Item ." - ForegroundColor " Cyan"
27- Get-VcList - Release $Item | Save-VcRedist - Path $Path | Install-VcRedist - Silent
28- $InstalledVcRedists = Get-InstalledVcRedist | Where-Object { $_.Name -notmatch " Debug Runtime" }
28+ Write-Host " `t Installing VcRedist $Rls ." - ForegroundColor " Cyan"
29+ Get-VcList - Release $Rls - Architecture $Arch | Save-VcRedist - Path $Path | Install-VcRedist - Silent
30+ $InstalledVcRedists = Get-InstalledVcRedist | Where-Object { $_.Name -notmatch " Debug Runtime" }
2931
30- # Filter the VcRedists for the target version and compare against what has been installed
31- foreach ($ManifestVcRedist in ($CurrentManifest.Supported | Where-Object { $_.Release -eq $Item })) {
32- $InstalledItem = $InstalledVcRedists | Where-Object { ($_.Release -eq $ManifestVcRedist.Release ) -and ($_.Architecture -eq $ManifestVcRedist.Architecture ) }
32+ # Filter the VcRedists for the target version and compare against what has been installed
33+ foreach ($ManifestVcRedist in ($CurrentManifest.Supported | Where-Object { $_.Release -eq $Rls -and $_ .Architecture -eq $Arch })) {
34+ $InstalledItem = $InstalledVcRedists | Where-Object { ($_.Release -eq $ManifestVcRedist.Release ) -and ($_.Architecture -eq $ManifestVcRedist.Architecture ) }
3335
34- # If the manifest version of the VcRedist is lower than the installed version, the manifest is out of date
35- if ([System.Version ]$InstalledItem.Version -gt [System.Version ]$ManifestVcRedist.Version ) {
36- Write-Host - ForegroundColor " Cyan" " `t VcRedist manifest is out of date."
37- Write-Host - ForegroundColor " Cyan" " `t Installed version:`t $ ( $InstalledItem.Version ) "
38- Write-Host - ForegroundColor " Cyan" " `t Manifest version:`t $ ( $ManifestVcRedist.Version ) "
36+ # If the manifest version of the VcRedist is lower than the installed version, the manifest is out of date
37+ if ([System.Version ]$InstalledItem.Version -gt [System.Version ]$ManifestVcRedist.Version ) {
38+ Write-Host - ForegroundColor " Cyan" " `t VcRedist manifest is out of date."
39+ Write-Host - ForegroundColor " Cyan" " `t Installed version:`t $ ( $InstalledItem.Version ) "
40+ Write-Host - ForegroundColor " Cyan" " `t Manifest version:`t $ ( $ManifestVcRedist.Version ) "
3941
40- # Find the index of the VcRedist in the manifest and update it's properties
41- $Index = $CurrentManifest.Supported ::IndexOf($CurrentManifest.Supported.ProductCode , $ManifestVcRedist.ProductCode )
42- $CurrentManifest.Supported [$Index ].ProductCode = $InstalledItem.ProductCode
43- $CurrentManifest.Supported [$Index ].Version = $InstalledItem.Version
42+ # Find the index of the VcRedist in the manifest and update it's properties
43+ $Index = $CurrentManifest.Supported ::IndexOf($CurrentManifest.Supported.ProductCode , $ManifestVcRedist.ProductCode )
44+ $CurrentManifest.Supported [$Index ].ProductCode = $InstalledItem.ProductCode
45+ $CurrentManifest.Supported [$Index ].Version = $InstalledItem.Version
4446
45- # Create output variable
46- # $NewVersion = $InstalledItem.Version
47- $FoundNewVersion = $true
48- $Output += $Item
47+ # Create output variable
48+ # $NewVersion = $InstalledItem.Version
49+ $FoundNewVersion = $true
50+ $Output += $Rls
51+ }
4952 }
5053 }
5154 }
0 commit comments