[wix-users] Question about RegistryValue and Private Properties.

Nick Elmer Nick.Elmer at veritas.com
Mon Apr 17 08:55:59 PDT 2017

Found the problem after some more digging. Looking at the verbose log, the RegistryValue item is being used in a merge module. That merge module had INSTALLDIR.ID defined in the directory table. That's why INSTALLDIR was being resolved. When I switched over to using CommonAppDataFolder, it was not getting resolved by MSI since it was not defined anywhere in the merge module. So thus property was null when the registry value was written. The fix was to add a directory reference so that MSI added it to the directory table, then it was resolved during the install and written to the registry as expected. The documentation on MSDN makes it seem that it will get resolved, but apparently is doesn't. https://msdn.microsoft.com/en-us/library/windows/desktop/aa370905%28v=vs.85%29.aspx

The fix:
<!-- Need CommonAppDataFolder defined in directory table to resolve for the RegistryValue item. -->
<Directory Id="CommonAppDataFolder" SourceName="All Users" />
    <RegistryValue Type="string" Name="SomeFolder" Value="[CommonAppDataFolder]Path\To\Some\Folder" />

From: Nick Elmer
Sent: Friday, April 14, 2017 2:29 PM
To: 'wix-users at lists.wixtoolset.org' <wix-users at lists.wixtoolset.org>
Subject: Question about RegistryValue and Private Properties.

Hi All,
I have a simple question regarding using private properties (specifically a System Folder Property) in a RegistryValue. When I use INSTALLDIR it resolves and gets set correctly. However, when I use CommonAppDataFolder, the result is empty for the variable. Is this allowed or am I missing something? I have looked for documentation on using properties in the RegistryValue element, but I don't find any documentation discussing limits. Thus the reason for my question.

<RegistryValue Type="string" Name="SomeFolder" Value="[CommonAppDataFolder]Path\To\Some\Folder" />

Thanks in advance.

More information about the wix-users mailing list