Custom Actions conditional for Upgrade / Repair - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

stevejonesuk
Posts: 16
Joined: Mon Aug 10, 2009 11:43 am

Custom Actions conditional for Upgrade / Repair

Hi guys, I need to run some custom actions, each one a function in a DLL. They need to be able to stop the system being modified, according to some checks they need to run. The actions are one which should be run if an upgrade is occurring (install the same UpgradeCode with a new ProductCode), and one which needs to be run if a repair operation is occurring.
These actions will each need to be able to abort the operation with no change to the system.
Can you please tell me: 1. When they should be run - under which heading in the Install Sequence? and 2. What the Execution Condition expression should be in each case?
And does it matter if the DLL is attached or installed?
Thanks.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Custom Actions conditional for Upgrade / Repair

Hello,

I am not sure what you mean by "stop the system being modified". Can you give me more details and perhaps an example?

You can configure your custom actions to return one of the return values specified in msnd.
They must be placed before InstallInitialize in the InstallExecuteSequence to insure the installation is cancelled before any changes are done to the system.
For an Upgrade, you can place the following in the condition:

Code: Select all

UPGRADINGPRODUCTCODE
while canceling a repair can be done using

Code: Select all

NOT ( REMOVE = "ALL" )
The DLL should be attached to ensure it is always there to be executed.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
stevejonesuk
Posts: 16
Joined: Mon Aug 10, 2009 11:43 am

Re: Custom Actions conditional for Upgrade / Repair

Hi,

> I am not sure what you mean by "stop the system being modified"

This is very simple, I think I confused you by stating something you'd take for granted.

Case 1:
Repair is attempted and my custom action determines a need to abort. Repair carries on and changes my system. This is bad because the custom action has tried to stop the system being modified, but the system has been modified.

Case 2:
Repair is attempted and my custom action determines a need to abort. Repair aborts as required, but too late in the repair process - after it's made some changes which it can't roll back. This is bad because the custom action has tried to stop the system being modified, but the system has been modified.

Case 3:
Repair is attempted and my custom action determines a need to abort. Repair aborts as required and my system is the same as it was before. This is good because my custom action has stopped the system being modified as I'd hope.

That's all. I spelled it out in my original query because I'm conscious that repair and upgrade are destructive actions and if the custom action runs too late in the attempted operation, even if my abort is successful, changes may be made which cannot be undone.

> Cancelling a repair can be done using NOT ( REMOVE = "ALL" )

I tried this on a dummy user action which launched a browser at a URL and it seemed to be triggered when I was actually doing a fresh install. Perhaps it needs some further qualification? Maybe "Installed" or similar?

Thanks,
- Steve.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Custom Actions conditional for Upgrade / Repair

Hello

Indeed, the proper condition is:

Code: Select all

Installed AND NOT (REMOVE = "ALL")
sorry about that.
Other than that, well, just make sure the custom action that is responsible with canceling the repair is placed before any custom action that changes the system. This is usually before InstallInitialize, unless you placed some other custom actions that change the system before then.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
stevejonesuk
Posts: 16
Joined: Mon Aug 10, 2009 11:43 am

Re: Custom Actions conditional for Upgrade / Repair

The repair case seems to work well, except but the upgrade case gives me a 2869 error. Running so early in the process doesn't seem to give me a "no impersonation" option, how can I fix this problem? Thanks.
stevejonesuk
Posts: 16
Joined: Mon Aug 10, 2009 11:43 am

Re: Custom Actions conditional for Upgrade / Repair

It's OK, I've fixed that, it was to do with what I was doing inside the custom action.
stevejonesuk
Posts: 16
Joined: Mon Aug 10, 2009 11:43 am

Re: Custom Actions conditional for Upgrade / Repair

Sorry, but it isn't working for me.
I've changed the product version number - either the first or the third digits, it makes no difference - and answered "yes" to "do you want to generate a new Product Code", but if I run my custom action with no execution condition, it happens, whereas if I do it with UPGRADINGPRODUCTCODE condition, it doesn't.
This is using:
InstallValidate action sequence
Function call from DLL
Synchronous execution, check return code
Immediate execution
Always execute

Please advise. Thanks.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Custom Actions conditional for Upgrade / Repair

Hello,

Please note that the custom action must be placed in the package that is being upgraded, not the new one. This being said, I have tested the condition and it works.
For more details, you can check our FAQ on Upgrades and updates.
If you still can not troubleshoot the issue, please send the two .aip project files you are testing with to support at advancedinstaller dot com so we can further investigate the issue.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”