cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
farukhsharipov
Level 4

LaunchAppAndWait with msiexec doesn't wait

Hi All

I have Basic MSI Project where I am trying to uninstall previous version of the product that was created by different developed.

I was thinking using msiexec since it seems to work fine from command line.

I created InstallScript function and set it to:

Synchronous (Check exit code)
Immediate Execution
Always execute
After File Cost

[HTML]
function UninstallSilently(hMSI)
NUMBER nResult;

begin

if(LaunchAppAndWait("msiexec", "/uninstall {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} /passive", WAIT | LAAW_OPTION_WAIT_INCL_CHILD) < 0)then
MessageBox ("Failed to uninstall",SEVERE);

endif;

end;
[/HTML]

I can see that it starts uninstalling previous product, but it exits before it's done uninstalling.

So my question is how to make sure that LaunchAppAndWait will wait for product uninstall and then continue?

Or if you have better way to uninstall previous product I will be happy to hear it.


Thank you in advance.
Labels (1)
0 Kudos

(4) Replies
DLee65
Level 13

Why are you not just simply authoring the uninstall table to remove the previous version? Essentially that is the purpose for this table. It can even have a different upgrade code and specify version ranges.

One problem that might occur using your approach is that only one MSI installer can run at a time. If you are sequencing this in the EXECUTE sequence, then it should error out.
0 Kudos
farukhsharipov
Level 4

DLee65 wrote:
Why are you not just simply authoring the uninstall table to remove the previous version? Essentially that is the purpose for this table. It can even have a different upgrade code and specify version ranges.

One problem that might occur using your approach is that only one MSI installer can run at a time. If you are sequencing this in the EXECUTE sequence, then it should error out.


Thank you for response, can you point me where I can find how to use "uninstall table to remove the previous version"?
0 Kudos
DLee65
Level 13

I am sorry, I mistyped. You need to configure the upgrade table.
You will want to get familiar with this table and the values you need to know. The help file has a section regarding the upgrade table, just open help, type in 'Upgrade Table' in the Index. This will give an explanation of the columns, their data types, etc.
Below is an example of what I use to upgrade a previous version that was created by someone else:
UpgradeCode MinVer MaxVer Attributes ActionProperty ISDisplayName
{10817CA8-89D1-11D6-B3F4-00034721ED1B} 1.0.1 ***ALL_VERSIONS*** 772 UPGRADE_EARLY_AC_APP1 NewUpgradeEntry1

You will need to get the upgrade code from your previous MSI installer. You will also want to figure out what the absolute minimum version you want to support for upgrade. IF the upgrade code is the same between yours and the previous version, then you can simply insert {00000000-0000-0000-0000-000000000000} and at compile time the current UPGRADECODE will be inserted.

InstallShield also has a UI section for creating a new upgrade event. In the view list, scroll down to 'Media' and click on 'Upgrades'. You want to author a new major upgrade for each previous UpgradeCode. In most cases you can simply specify 'Any earlier version' for the Product Version.
Read up on the advanced settings. You may want to migrate feature states, OR ignore them entirely; especially if you have restructured the features within your new install.

Hopefully this helps.
0 Kudos
farukhsharipov
Level 4

DLee65 wrote:
I am sorry, I mistyped. You need to configure the upgrade table.
You will want to get familiar with this table and the values you need to know. The help file has a section regarding the upgrade table, just open help, type in 'Upgrade Table' in the Index. This will give an explanation of the columns, their data types, etc.
Below is an example of what I use to upgrade a previous version that was created by someone else:
UpgradeCode MinVer MaxVer Attributes ActionProperty ISDisplayName
{10817CA8-89D1-11D6-B3F4-00034721ED1B} 1.0.1 ***ALL_VERSIONS*** 772 UPGRADE_EARLY_AC_APP1 NewUpgradeEntry1

You will need to get the upgrade code from your previous MSI installer. You will also want to figure out what the absolute minimum version you want to support for upgrade. IF the upgrade code is the same between yours and the previous version, then you can simply insert {00000000-0000-0000-0000-000000000000} and at compile time the current UPGRADECODE will be inserted.

InstallShield also has a UI section for creating a new upgrade event. In the view list, scroll down to 'Media' and click on 'Upgrades'. You want to author a new major upgrade for each previous UpgradeCode. In most cases you can simply specify 'Any earlier version' for the Product Version.
Read up on the advanced settings. You may want to migrate feature states, OR ignore them entirely; especially if you have restructured the features within your new install.

Hopefully this helps.



Hi again,

I followed your advice, but it doesn't seem to do anything. Below is my Upgrade Table:



I made sure that my upgrade code is correct.

Any ideas why?

Thank you for your help.

//---Update---//

I didn't had any components in my example so it wasn't working. I added component and followed your advice and it seems to work. Thank you very much.
0 Kudos