Often you want to cache installation files on the user’s hard drive so they are available during a Maintenance installation initiated by the user going to Programs & Features in Win 7 or Vista, or Add/Remove Programs in XP.
When we say we want to cache installation files, we are really talking about caching the MSI files locally. To do this, you go to the Releases view in your project and select the Setup.exe tab. In the property sheet, you will notice the Cache MSI Locally property. Here is a screenshot of that:
Setup.exe tab in the Releases view of an InstallShield project
To cache the files, you should set the Cache MSI Locally property to Yes. For the Cache Path, you can accept the default location. However, be aware that when you uninstall your product, the cached files MAY be left on the user’s hard drive. In my experience they are generally left behind, but sometimes they are uninstalled. And I haven’t figured out why this behavior is inconsistent.
For whatever cache location you choose, a GUID folder will be created corresponding to the Package Code of your installation. That is how you know the folder belongs to your installation.
If leaving the cache files behind after an uninstall is unacceptable to you, then there is some cleanup you can perform. To do this, you need to write an InstallScript function that deletes the cached folder. It can be called directly in an InstallScript installation, or through an InstallScript custom action in a Basic MSI or InstallScript MSI installation.
For example, you can use the DeleteDir( ) function.
Be aware that if you are using the default value of the Cache Path, which is [LocalAppDataFolder]Downloaded Installations, you may inadvertently cause some problems if you delete the wrong folder. Thereby breaking other product’s installations and making your users not very happy.
An alternative method I prefer to use, because it has the least amount of problems, is to cache the files locally in a subfolder of the installation folder. For example, if your product is installed to the Program Files folder, you could set the Cache Path to [ProgramFilesFolder]ABC Company\Product X. A GUID folder will be created under that contains the cached files. On an uninstall, you can run your script and the cached folder will be deleted.
Be aware that some clients and companies do not want to cache their product’s installation files under the installation folder. In that case, you’ll have to cache them somewhere else.