cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JoderCoder
Level 8

Removing files after installation

My installer installs some other files other than my actual files of the installation. At build time, InstallShield finds some dependencies and includes those files along with my actual files. I want to remove those files from the installation as they will definitely exist on some other location on the target machines.

Also there is a 3rd party exe that use to do some configuration on the target machine. I first copy that to the installdir and call it in a Custom Action.

I want to remove those files after installation. What is the best practice for that in InstallShield? Or do I have to write a Custom Action for this?

Thanks in advance.
Labels (1)
0 Kudos
(7) Replies
RobertDickau
Flexera Alumni

Adding records to the RemoveFile table (exposed in the Direct Editor view) is one common approach. The MSI help has information about what goes in that table.
0 Kudos
JoderCoder
Level 8

Robert, this is not doing what I want I am afraid. Documentation says RemoveFile Table is taken into account by RemoveFiles action which is called before InstallFiles; so the file that I want to remove is not at the file system yet. I want to remove a file that I installed, making sense?
0 Kudos
Apoorv_Jain
Level 5

If you are using InstallScript, you can write a function to delete files post installation manually. For example:

function CA_DeleteFiles(hMSI)

begin
DeleteFile("path of the file" ^ "filename");
end;


Create a custom action, assign the above function to it and schedule it to execute in Deferred mode after InstallFiles or wherever you want to.

This will help you. I make use of this in my installation quite a time to delete files that get created at runtime of the software but I execute this during uninstallation so I add condition for Custom Action to execute during Removal. You can put condition during Installation or Removal as required.
0 Kudos
JoderCoder
Level 8

Thanks! I am not using InstallScript but looks like I will have to do something similiar to yours in a C++ dll unless I get a solution within InstallShield IDE.
0 Kudos
RobertDickau
Flexera Alumni

If you don't need to worry about dependencies, an action that uses the Binary table for storage might do the trick...
0 Kudos
Sairen
Level 7

Also, you can use an InstallScript custom action to supplement your Basic MSI project. That way you can still do the coding (without a C++ DLL) AND use an MSI based project. It's hot stuff.
0 Kudos
JoderCoder
Level 8

RobertDickau wrote:
If you don't need to worry about dependencies, an action that uses the Binary table for storage might do the trick...


Robert, could you elaborate on this please? What exactly do you mean by "an action that uses the Binary table"?
0 Kudos