cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
datamine
Level 6

Problem with major upgrade where dynamic folders have been changed to components

We've recently removed a component which installed files from a dynamic folder to install each file as an individual component. We've set it to a major upgrade so that it completely uninstalls the old product and reinstalls the new, but we're finding that when the new components are reinstalled all the file have a ref count of 2, as if something has "remembered" the old files and assumes they were already installed. This obviously isn't a problem until the user uninstalls, at which point all these files are left behind. Manually uninstalling the old and then installing the new operates correctly.

Has anyone else come across this problem, and if so is there a solution please?
Labels (1)
0 Kudos
(2) Replies
Marek22
Level 5

Hi,
The ref counts are there because you have selected yes for "Shared" option on your component. I dont know why is this option yes by default since we dont need to share most files. So if you dont need the ref count, just set it to No. You can also try to uninstall your program, remove refcount from registry(just search for filename in registry) and try it with clear registry.

Hope it helps
0 Kudos
datamine
Level 6

Thanks for the reply 🙂

We do need the ref counts because these are shared components, and on a clean install they work fine (i.e. 1). However, we have had issues in the past with major upgrades because for some inexplicable reason Windows Installer evaluates what needs doing to components *before* it uninstalls the old products so we've sometimes had odd components not reinstalled after the upgrade etc. Thus it appears this evaluation was causing the dynamic files to be reinstalled and the new files on top of that, causing a ref count of 2.

The solution I have found (for anyone else who may have this problem) is this; it's not very elegant, and it's still a little unclear to me as to why it actually works:

After the SetupProgress custom action in Installation/User Interface, I have an InstallScript custom action which simply calls:

MsiSetFeatureState(hMSI, "", INSTALLSTATE_ABSENT);

Then just before the ProcessComponents custom action in Installation/Execute (and after RemoveExistingProducts) I call another InstallScript action which does:

MsiSetFeatureState(hMSI, "
This appears to fool Windows Installer into not pre-evaluating the components within this feature, and they are installed correctly with ref counts of 1.
0 Kudos