0
votes

I have created installer "Sample Product". During first installation attempt installation was successful and install location was "c://Program files//Sample Product".

In windows installed program list, one entry has been added named "Sample Product".

During re-installation, I have selected different installation path (D://Sample Product). Installation is successful.

However when I checked windows installed program list, one mo""re duplicate entry has been added "Sample Product".

How can i stop creating two instances in windows installed program list.

If I repeat the installations with different location, it keeps on adding one more instance in windows Programs list.

enter image description here enter image description here

enter image description here

1

1 Answers

0
votes

You can uninstall the previous installation when you run the installer.

To find the previous installation directory, add a "Set a variable" action to the "Startup" node of the installer with the variable name "previousInstallationDir" following script:

ApplicationRegistry.ApplicationInfo[] applicationInfos =
    ApplicationRegistry.getApplicationInfoById(context.getApplicationId());

if (applicationInfos.length > 1) {
    return applicationInfos[0].getInstallationDirectory().getPath();
} else {
    return "";
}

Then, add an "Uninstall previous installation" action to the "Installation" screen with the "Installation directory" property set to

${installer:previousInstallationDir}