IUpgradeCode

This interface is meant to edit the the “Upgrade Code” for specific languages present in the project.

DeclarationCopy link to this sectionLink to this section copied!

IUpgradeCode: IDispatch

PropertiesCopy link to this sectionLink to this section copied!

String UpgradeCode
Sets or gets the upgrade code.

String InstallOrder
Specifies the sequence in which the upgrade process occurs. Possible values:

  • "UninstallThenInstall" – Removes the old version completely before installing the new one.
  • "UninstallRebootThenInstall" – Uninstalls the old version, reboots the system, then installs the new one.
  • "InstallThenUninstall" – Installs the new version first, then removes the old one. If the removal fails, the entire upgrade is rolled back.

Bool UseOriginalInstallPath
Determines whether the upgrade should use the original installation path.

  • true – The new version is installed in the same folder as the old one.
  • false – The upgrade uses the default application folder defined in the installer settings, ignoring the original path.

String VersionInstallBehavior
Defines how different product versions are handled during installation. Possible values:

  • AutoUpgradeOldProdVersion – Automatically upgrades older product versions.
  • SideBySideInstallProd – Allows multiple versions of the application to be installed simultaneously on the same system.

MethodsCopy link to this sectionLink to this section copied!

GenerateUpgradeCode() returns UpgradeCode
Updates the upgrade code with a generated value for upgrade code and returns the new value.

ExampleCopy link to this sectionLink to this section copied!

$projPath = "C:\projtest.aip"
advinst.exe /REGSERVER
$advinst = new-object -comObject "AdvancedInstaller"
$proj = $advinst.CreateProject($advinst.ProjectTypes.Architect)
$proj.productDetails.UpgradeCode
$proj.productDetails.UpgradeCode.VersionInstallBehavior = "SideBySideInstallProd"
$proj.productDetails.UpgradeCode.InstallOrder = "UninstallRebootThenInstall"
$proj.SaveAs($projPath)