When I install an application which has a file somet.txt
it installs it to a certain location C:\temp
and windows keeps a register that it has been installed 1 time.
If another application installs the same file with the same id to the same location the install count is incremented to 2.
This is so that if you want to completely remove that file you have to uninstall both applications before the file is removed.
I am looking for the ability to read this count/edit this count/etc.
Does anybody know how to do this, either manually/via wix/via c#?
I found this info
the installer increments the reference count in the shared DLL registry of the component's key file
There are two separate reference counting mechanisms in windows installer, and the other answers each refer to different ones:
Components (not files) are reference counted by the number of installed products that refer to them. This requires that the component has the same GUID and keypath in the different products that refer to it.
There is also a legacy SharedDllRefCount
mechanism which can be enabled for the keypath of a component. This does operate on file paths so it will work even if Component GUIDs don't match. However, products are not required to properly increment/decrement this reference count, so using this is not recommended. The default behavior in wix is to increment this reference count only if it is already present.
These reference counts are used internally in windows installer: when they both reach zero the component is uninstalled. AFAIK the Windows Installer API doesn't expose this reference count anywhere because there shouldn't be a need for you to read or edit them directly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With