ionut.boronea
Posts: 10
Joined: Fri Dec 14, 2018 4:14 pm

Apply patch based on condition

Fri Dec 14, 2018 4:21 pm

Hello,

I've created a patch for an existing application version.
I want to be able to apply this patch only when a certain condition is met (eg. license expired).
Also, this condition needs to be a c# console application that makes several checks.
Based on the response of the console app the patch will be applied or not.
Any way I can make this happen?

Thank you.

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: Apply patch based on condition

Sat Dec 15, 2018 5:58 pm

Hello Ionut,

To implement such behavior you could create your own custom action which will run the C# app during the patch installation. To abort the patch installation you should just return an exit code different than 0 within you C# app. Any custom action exit code different than 0 is interpreted by Windows Installer as a failure and the installation is aborted and rolled back.

For more info have a look on our "How to create a patch that runs a custom action" and "How to create fully fledged C# custom actions".

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

ionut.boronea
Posts: 10
Joined: Fri Dec 14, 2018 4:14 pm

Re: Apply patch based on condition

Mon Dec 17, 2018 3:43 pm

Hello Daniel,

Thank you for the reply.
Unfortunately the solution you proposed does not seem to work with patches.
Indeed, using your solution I've managed to create a custom action using a c# application, but it only works when running the installer and not the patch.
I've followed the exact steps from the documentation, I've even watched the videos to make sure I'm not doing something wrong.
For some reason, the patch completes without executing the custom action which has the PATCH condition set.

Any idea why this might happen?

Thank you.

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: Apply patch based on condition

Thu Dec 20, 2018 2:47 pm

Hello Ionut,

I apologize for the delayed reply.

I cannot say why this happens. Can you send us your AIPs (project files) and a verbose log of the installation to support at advancedinstaller dot com? We need the following projects:

1. of the old setup version
2. of the new setup version
3. of the patch project

If you cannot share with us your project file, then you can try to isolate the behavior in a buildable sample (.aip + its referenced files) which we can build and test on our side.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”