cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tcom36
Level 7

Local cached MSI does not get deleted when uninstalling

I have an InstallScript MSI Project. I activated the "Cache MSI locally" and indicated the "Cache Path" to "[LocalAppDataFolder]Downloaded Installations".

I had a look today into this cache path folder and was really surprised to find a list of folder, not only from the actual installed versions, but also uninstalled versions.

Does IS2008 not delete the cached MSI files when uninstalling a version?

How do I get IS2008 to delete the cached MSI files during uninstall?
Labels (1)
0 Kudos
(28) Replies
Superfreak3
Level 11

Most of this seems to center around removing old cache upon installing the new product.

In our situation, we always use Major upgrades. What I would like to do is always remove the old cache on uninstall so that the only cache that will exist will be for the most recent, installed product. If that is removed, the cache should be cleaned as well.

I was thinking of just creating a custom action widget to blow away the current cache location on uninstall (REMOVE="ALL").

This may be steering off topic, but what happens if I patch the current installation on a system? To create the patch, a new package (different package code) needs to be generated. Once patch is applied, what will the cache location look like? ...

Installed package cached in {Package Code 1}. Now I generate a patch from newly created package with {Package Code 2}. What happens in the Cache, is a new directory created with the original .msi patched with the deployed .msp?

Just wondering.
0 Kudos
ITI_Randy
Level 6

From what you describe, I believe you could use Chris Painter's code sample which is included in this post. Chris did a simple script to always remove all but the current install cache, unless uninstalling, in which case he removed them all.
0 Kudos
Superfreak3
Level 11

I guess I did what amounts to the same thing. Created a widget to run on uninstall that just whacks our cache directory.
0 Kudos
Marc75
Level 4

Randy,

I'm taking your approach, but there is a function called PackageTitle() and used in the function RemoveOldCache().

It seems that it is yet another user function to retriece the package code?
Would you be so kind to tell me how did you implement this?
Thank you.

Marc
0 Kudos
ITI_Randy
Level 6

Sure.

The PackageTitle() function is a private method we used to retrieve the product folder name where the cache is stored. In order to clean the cache, you will recall that you need to place it in a specific sub folder. In the "Releases" section of the InstallShield IDE, on the "Setup.exe" tab, there is a section for "Cache Msi Locally" ("Yes" by default), which has a "Cache Path" value where the cache will be stored. By default this will be "[LocalAppDataFolder]Downloaded Installations", however, this is not specific enough. To make it easy to find the cache for each product you install, you will change this to be "[LocalAppDataFolder]Downloaded Installations\[Your Product Name]. This is the value of "Product Name" in your general properties.

In your script, you will need a function that's something like this...

prototype STRING PackageTitle(HWND);

function STRING PackageTitle(hMSI)
STRING sProductName;
NUMBER nSize;
begin
try
MsiGetProperty(hMSI, "ProductName", sProductName, nSize);
if (nSize > 0) then
return sProductName;
endif;
catch
endcatch;
end;

You could hard-code this into your script, but it's better to grab it dynamically so your script will work with all installs without having to change it.

Hope that helps.
0 Kudos
Christopher_Pai
Level 16

I've used my PurgeCache CA for several customers now and it's pretty easy to implement it. I can post it again if you like.
0 Kudos
ITI_Randy
Level 6

Hi Chris.

I believe your code is already in the early part of this thread. However, it's been quite a while. Do you have an update to it?
0 Kudos
Christopher_Pai
Level 16

It's probably the same. I'd have to find it and compare to what's in my TFS.

The "code" of course is only the InstallScript function portion of the solution. The rest is the mechanics of scheduling the custom action and following a convention in the Product/Release configuration settings so that setup.exe will cache the MSI in the manner that the InstallScript is expecting.

Still, I've found it only takes me a few minutes to implement for each customer that wants a self extracting EXE. They usually don't even know I've done it for them... I just do it out of a respect forbest practices.
0 Kudos