Note that there are some explanatory texts on larger screens.

plurals
  1. POWiX RegistryValue setting to null (Value="")
    text
    copied!<p>I've been working on a WiX project for some time, and consuming the registry values that my setup initializes has proven to be "interesting". I am looking for a sanity check here, please.</p> <p>I have the following line in my WiX script that creates a registry value:</p> <pre><code>&lt;RegistryValue Type="multiString" Name="polling_manifest" Value="" /&gt; </code></pre> <p>This creates a registry value with the data that looks like this (from regedit/export):</p> <pre><code>"polling_manifest"=hex(7):00,00,00,00 </code></pre> <p>which, to me, looks like a string[2] with two null strings in it. In actuality, if you open this registry value with something like:</p> <pre><code> public static string[] pollingManifestValue { get { return (string[])RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64) .OpenSubKey(AppSettingsGet("RegPathKeyConary")) .GetValue(AppSettingsGet("rTISRegKeyPollingManifest")); } set { RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64) .OpenSubKey(AppSettingsGet("RegPathKeyConary"), true) .SetValue(AppSettingsGet("rTISRegKeyPollingManifest"), value); } } </code></pre> <p>pollingManifestValue comes back as null. Consequently, all my code that accesses this construct has to have the "check for null first, then access properties"-type code.</p> <p>I understand that those checks are the right thing to do, and I am not looking to be a more lazy programmer here. I am looking for thoughts and suggestions of those more experienced than I with the WiX deep magic, because it feels to me like I am not doing it optimally. Any code review / usage guidance is most welcome, and I thank you in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload