bjones8888
Posts: 5
Joined: Wed Jan 16, 2008 3:14 pm
Location: Kentucky
Contact: Website

How to delete a specific file

I have a new Office Outlook Add-In that I'm installing. It replaces two other Add-Ins that may or may not be installed on the current machine. If they are installed, they were done using "regsvr32" manually.

I want the new installer to remove them if they exist. How do I accomplish this?

Also, I want to delete the old DLLs themselves. I know specifically the folder they're located in.

(I'm using AI version 9.7)
Bogdan
Posts: 2791
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: How to delete a specific file

Hi,

You need to first create two searches in Search page, that will tell you if the add-ins are on the machine or not. Most probably, registry searches.

To unregister the add-ins I assume you need to run regsvr32 with an unregister command. For this you will need a custom action similar to the one from this thread. As an execution condition for the custom action you must also use the search that you have defined in the first step, so it does not get executed if the add-in is not on the machine.

To delete the files you can defined a File Remove operation in Files and Folders page.

Best regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
bjones8888
Posts: 5
Joined: Wed Jan 16, 2008 3:14 pm
Location: Kentucky
Contact: Website

Re: How to delete a specific file

I've created a separate exe (using Delphi) that does the unregistering and deleting files (very simple issue with Delphi). I know this is doable with AI, but I'm having trouble with custom actions, so I chose this route. I'm able to install my application files, including my "DelTools.exe" program (which does the file deletions and unregisters). However, I can't get my custom action to launch my exe. I have attached my aip file, if that is of any help.

I have added the custom action after Add Resources. But it doesn't seem to execute. But if I manually execute DelTools.exe after the setup runs, it works as it should. Obviously, I'm missing something simple.
Attachments
OutlookExportUtility.aip
Outlook add-in replacement setup program
(31.86 KiB) Downloaded 428 times
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to delete a specific file

Hello,

Please keep in mind that if you want to launch a file which will be installed by your package, then the related custom action should be scheduled after "Install Execution Stage -> Add Resources" action group and should run as deferred. So, from "Custom Action Properties" right pane you should enable the "When the system is being modified (deferred)" option for your custom action.

Also, you should set the "Full Path" field of your custom action like this:
  • Full Path: [#DelTools.exe]
Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
bjones8888
Posts: 5
Joined: Wed Jan 16, 2008 3:14 pm
Location: Kentucky
Contact: Website

Re: How to delete a specific file

Excellent. I had the sequence of the custom action correct, but the Full Path option wasn't correct. I had put the path to the default installation path in front of the [#DelTools.exe] and had double quotes around it.

This works as expected now. Thanks. :D
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to delete a specific file

You're welcome. Glad to help.

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

Return to “Building Installers”