How to prevent Installshield from removing files?

3.3k Views Asked by At

I am developing a package using Installshield 2008 Primer Edition and Project type is Installscript MSI project.

The problem I am facing is during installation I am installing some of the files to the following location C:\Program Files\Company\SystemFiles from this location I am copying and adding the set of files into System32 folder, it contains DLLs and OCX files, copying into the System32 folder has been done using Installscript.

Due to this during uninstallation, the installed file is getting removed from System32 due to this other dependent application which requires the same set of DLLs have stopped working.

I have approached Installscript to copy files from ProgramFiles to System32 Folder rather than using built-in options because we have an issue during the upgrade in order to avoid that I am using Installscript.

Even I have tried several workarounds like setting the file attributes after file copies to System32 using Installscript like FILE_ATTR_SYSTEM which sets the system attribute but still files are getting removed during uninstallation.

Any idea how to give file attributes as PERMANENT or SHARED; will this help, and if it will, then how can I set it using Installscript?

4

There are 4 best solutions below

0
On

For InstallScript projects: To prevent the files in a particular Component from being removed during uninstall: 1-Select the Components view from within the Organization folder. 2-Select the component that contains the files you do not wish to remove during uninstall. 3-Change the "Uninstall" property in the right pane to a value of "No."

For MSI Projects: To prevent the files in a particular Component from being removed during uninstall: 1-Select the Components view from within the Organization folder. 2-Select the component that contains the files you do not wish to remove during uninstall. 3-Change the "Permanent" property in the right pane to a value of "Yes".

0
On

You can also disable logging from Install Script. This will make the installer "forget" that it installed specific files groups or features.

You should make sure to enable logging once again after you have copied the files that you want to permanently leave on the system.

If you don't remember to enable logging after you have disabled it, your uninstall process may not work correctly.

Syntax is as follows: Disable(LOGGING);

//Add code to copy your permanent files here Enable(LOGGING);

1
On

I have 2 ideas 1)I think you can use SHARED option as this wont remove the files while uninstallation.

2)Also when i was facing similar issue , what i did was putting all the required files in the installation directory itself so that while uninstalling only the installed files will be removed.(I know this is not a best solution)

(NOTE:I have worked on Install shield some 6 years back and so remember only certain things)

0
On

I see this is an old question but I just came across this. Seems to be a common problem. One good solution is to stage the files to a private directory mostly program files and then have a custom action do the copy and register (ocx etc). Installshield remembers what it copied so it tends to remove them. Do not disturb anything else like logging (my recommendation). Set conditions on the custom action so that it doesn't run during Uninstall. Although sometime back I did another weird implementation which only programmers are used to doing.. Packed the files as resources and created my own code to extract and deploy (Something that Process Explorer kind of tool does). There were certain use cases that warranted this kind of implementation. But again this is complicated and obviously reinventing the wheel. Unless you are good with C/C++ and Windows API this would be difficult. I would still suggest you stay away from this kind of implementation because it is also considered a "virulent behavior". Yet, so far I never got warnings from the Anti-malware products.