cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
clayton
Level 3

What is the best way to delete Cached MSI packages

What is the best way to delete a cached MSI package on uninstall in a Basic MSI setup?

In order to make use of the Modify function when a user clicks Change in And or Remove Programs, I had to cache the MSI package locally setting the options on the releases Setup.exe tab fpr Cache MSI Locally and defining Cache Path as [CommonAppDataFolder]Company Name. If I don’t cache the package locally, when a user makes modifications such as installing an additional feature, of course, the installer complains that it cannot find the MSI package.

It appears that the MSI is placed under a random GUID. When I specify the path [CommonAppDataFolder]Company Name. The actual path turns out to be [CommonAppDataFolder]Company Name\{GUID}. I don’t know how this GUID is derived. It does not appear to be any of the package, product or components GUIDs.

I’ve noticed that when our application is uninstalled, this cached MSI package is not removed. Over time, with our clients uninstalling and installing new versions of our software, I can see this getting polluted.

With this random GUID, I cannot predict the location where it's installed so I can't add a row to the RemoveFiles table. Is there any property for this folder I can add to the RemoveFiles table? Is there logic I can use to derive the path and add that as a property? I thought of trying a System Search to retrieve the path but my package is mostly generated via vbscript and I don’t see anything exposed to access System Searches from scripts so that I can define the file name and version information since my MSI file name is dynamic based on version. Even if I didn’t have a dynamic file name, I don’t want to trip over other versions installed that it may find first.

Thanks
Clayton
Labels (1)
0 Kudos
(2) Replies
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

The GUID for the cache path is the package code for the MSI package being installed (which is stored in the summary information stream on the MSI and in setup.ini streamed into the setup.exe). Since the package code changes with every build (by default), it may appear to not match what is in the General Information view.

You should be able to log the install and search for the PackageCode property that MSI sets and compare this GUID to the cache folder path. Reading this property through a custom action should also allow you to always have the correct GUID for the cache path if you wanted to delete it.
0 Kudos
clayton
Level 3

joshstechnij wrote:
The GUID for the cache path is the package code for the MSI package being installed (which is stored in the summary information stream on the MSI and in setup.ini streamed into the setup.exe). Since the package code changes with every build (by default), it may appear to not match what is in the General Information view.

You should be able to log the install and search for the PackageCode property that MSI sets and compare this GUID to the cache folder path. Reading this property through a custom action should also allow you to always have the correct GUID for the cache path if you wanted to delete it.


Hi Josh,

Thanks for your response.

Clayton
0 Kudos