xObay
Posts: 27
Joined: Sat Jan 06, 2024 4:56 pm

Bug in PowerShell AddDeprecateUpdate

Hello,

There is a bug in PowerShell module in the method AddDeprecateUpdate. The following two blocks of code don't work the same way.

Code: Select all

$advinst = New-Object -ComObject AdvancedInstaller
$xUpdateProject = $advinst.LoadProject($UpdateProjectFilePath)


# Replace all previous updates --> This works correctly
foreach ($update in $xUpdateProject.Updates) {
    if ($update.Installer.ProductVersion -ne $releaseVersion) {
        $NewUpdate.AddReplaceUpdate($update)
    }
}

# Deprecate all previous updates --> This breaks the configuration and generates wrong entries in the AIP file
foreach ($update in $xUpdateProject.Updates) {
    if ($update.Installer.ProductVersion -ne $releaseVersion) {
        $NewUpdate.AddDeprecateUpdate($update)
    }
}

Please confirm the correct way of adding the deprecated updates if the above code is wrong.
xObay
Posts: 27
Joined: Sat Jan 06, 2024 4:56 pm

Re: Bug in PowerShell AddDeprecateUpdate

If you add one update only, it works fine. If you start adding more, it doesn't.
Catalin
Posts: 6721
Joined: Wed Jun 13, 2018 7:49 am

Re: Bug in PowerShell AddDeprecateUpdate

Hello,

If possible, could you please provide a sample project (Updates Config File) against which I can run the above script snippets?

If so, please send it by email at support at advancedinstaller dot com together with what the expected outcome should be vs what the actual outcome is.

Looking forward to hearing from you.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”