Create registry entry only if not exists - Advanced Installer Community
aeplengg
Posts: 76
Joined: Mon May 05, 2014 5:31 am

Create registry entry only if not exists

Hello

I have a installer setup with registry entries.
I want to know which option is set if registry value already exists.?

Best regards,
Swati
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Create registry entry only if not exists

HI Swati,

In the Registry Value Dialog you can edit the properties of a new registry value or change the properties of an already existing one. The default option is replace existing value.

Please let me know if that helped.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
aeplengg
Posts: 76
Joined: Mon May 05, 2014 5:31 am

Re: Create registry entry only if not exists

Hello Dan

Thanks for your quick response.
But I don't want to replace the existing registry value. For this, which option should I set, Prepend or Append?

regards,
Swati
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Create registry entry only if not exists

Hi Swati,
  • append puts data after the existing value
  • prepend puts the data before the existing value
Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
aeplengg
Posts: 76
Joined: Mon May 05, 2014 5:31 am

Re: Create registry entry only if not exists

Hello Dan,

Just for clarity..
We have two setup, setup1 with registry abc = false and another setup2 with abc = true, both sharing the same registry key.
Now suppose I installed setup1 and then followed by setup2, we don't want the registry to be modified at all. It should keep abc = false.

Note: If we removed the registry entry from the setup2, it deletes abc = false. We want setup2 to keep abc = false.
What could be done for the same?

Regards,
Swati
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Create registry entry only if not exists

Hi Swati,
We have two setup, setup1 with registry abc = false and another setup2 with abc = true, both sharing the same registry key.
You can use the shared mechanism. Just make sure that:
- the file is installed in the same location by all packages which use it
- the component of the file (in the Organization page) uses the same GUID and the same name in all packages

This way, Windows Installer will see the component as shared between packages and it will use a reference count for it. Installing a package with the shared component will increase the reference count and uninstalling one will decrease the reference count. The component is removed when the reference count reaches 0 (the last package which contains the shared component is uninstalled).

Let me know if that helped.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
aeplengg
Posts: 76
Joined: Mon May 05, 2014 5:31 am

Re: Create registry entry only if not exists

Hello Dan,

Do we have to chceck "Component Properties -> Attributes -> Shared dll reference count" option, to try this solution?

Regards,
Naina
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Create registry entry only if not exists

Hi Naina,

No, there is no need to enable the related option. Just make sure that the related component uses the same GUID and the same name in all packages.

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”