Luke
Posts: 22
Joined: Thu Oct 11, 2012 11:00 am

Prevent removal of INI entries during uninstall?

My installer sets some entries in an INI file during installation based on properties entered by the user and this works fine.

However, when I uninstall my application the installer attempts to remove these entries from the INI file. The problem is that at the point of uninstallation the INI file may be read-only which causes an error 'Could not update the ini file...verify that the file exists and you can access it'.

Is is possible to:
1) configure the installer so that it does not attempt to remove the INI entries during uninstallation? (this would be my preferred option)
or
2) have the uninstallation routine untick the 'read-only' tickbox from the INI file before attempting to update it?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Prevent removal of INI entries during uninstall?

Hello,
1) configure the installer so that it does not attempt to remove the INI entries during uninstallation? (this would be my preferred option)
In order to achieve this you can condition the execution of "RemoveIniValues" standard action during uninstall. You can proceed like this:
- Go to "Custom Actions" page, select the "Install Execution Stage -> Remove Resources" action group and from its context menu choose "Show standard action -> Remove Resources -> RemoveIniValues".
- In the "Execution Condition" field, from "Standard Action Properties" right pane, set the following condition:

Code: Select all

NOT ( REMOVE = "ALL")
- Build and run your project.
2) have the uninstallation routine untick the 'read-only' tickbox from the INI file before attempting to update it?
In order to achieve this you can create your own custom action which will set the desired permission rights for the related file. Also, the custom action should run on uninstall and should be scheduled before "Install Execution Stage -> Remove Resources" action group.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Luke
Posts: 22
Joined: Thu Oct 11, 2012 11:00 am

Re: Prevent removal of INI entries during uninstall?

Thank you for your post, I will have a look at both of those suggestions.

I had managed to come up with an alternative solution myself, which was to move the INI file update to a component that I have set as 'Permanent' in the 'Organization' panel. This seems to work but I was wondering whether this was a good solution or if I would be better off using the 'RemoveIniValues' approach you suggested?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Prevent removal of INI entries during uninstall?

Hello,

Yes, this is a suitable approach for your scenario also.

If you have any questions let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Luke
Posts: 22
Joined: Thu Oct 11, 2012 11:00 am

Re: Prevent removal of INI entries during uninstall?

Thank-you.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Prevent removal of INI entries during uninstall?

You're welcome. Glad to help.

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

Return to “Building Installers”