Page 1 of 1

Shared vs Permanent Components Dilemma !!!

Posted: Wed Mar 25, 2009 8:51 pm
by speedmovin
Dear Gurus,

Need to have more convincing opinions....

My seniors collegue advised to set Registry_HKLM component as permanent reasons because the intention is to ensure that shared registry keys will not be removed. For example if 2-3 different application use the same bunch of registry keys then we can cause problems by deleting those keys during removal of one of the applications.

My opinion:
1. Installing components permanently means we have to use 16 as the attribute of the compenents. 16 stands for permanent component but 8 is an other option that means the component is shared. if it is installed by 2-3 different apps like a shared component then removing one of them will not cause any harm. Well it requires that all application would be installed properly with setting the required components' attribute 8.

2. if you removed those reg keys and it results in an other application to be broken, you still can reinstall/repair the other application

Wouldn't be just good enough setting only as shared instead of permanent? I notice if we had to set as permanent, cleaning up is also tough job !!! Therefore, why we need to have permanent whereby shared is sufficient.

Thanks in advance your reply.

Posted: Thu Mar 26, 2009 4:06 pm
by MichaelNesmith
Sharing a registry component doesn't work. Try it. You'll see that MSI still uninstalls it. So, it looks like you have to implement your own reference counting for the registry.

What you can do is, in pseudo-code:

Code: Select all

//install time:
Read Registry ShareCount
ShareCount +=1
Write Registry Permanent

//uninstall time:
Read Registry ShareCount
ShareCount -= 1
If ShareCount = 0 then Delete Registry

Posted: Thu Mar 26, 2009 7:55 pm
by speedmovin
Hi Michael

Thanks for your reply, do you think it's better to avoid using more Permanent Component in setting RegKey coz cleaning up when uninstall having problem would be minimize?

Posted: Fri Mar 27, 2009 10:03 am
by MichaelNesmith
It's really up to your taste! There's no right or wrong way to do anything, especially with a tool as flexible as InstallAware. Just do whatever you feel you're most comfortable with - as that will naturally be the fastest and safest route for you.