开发者

Add multiString registry value using WiX?

开发者 https://www.devze.com 2023-01-17 06:48 出处:网络
Now I use something like this: <Component Id=\"RegistryEntries\" Guid=\"<开发者_运维百科guid>\" KeyPath=\"yes\">

Now I use something like this:

<Component Id="RegistryEntries" Guid="<开发者_运维百科guid>" KeyPath="yes">  
  <RegistryKey Root="HKCU" Key="<path>" Action="createAndRemoveOnUninstall">  
    <RegistryValue Name="myStrings" Action="append" Type="multiString">  
      1  
    </RegistryValue>  
    <RegistryValue Name="myStrings" Action="append" Type="multiString">  
      2
    </RegistryValue>  
    <RegistryValue Name="myStrings" Action="append" Type="multiString">  
      3
    </RegistryValue>  
    <RegistryValue Name="myString" Value="x" Type="string"/>  
  </RegistryKey>  
</Component>  

But I have the next error:

The primary key "reg<key>" is duplicated in table 'Registry'. Please remove one of the entries or rename a part of the primary key to avoid the collision.

ANSWER: After Yan's answer my xml looks like:

<Component Id="RegistryEntries" Guid="<guid>">
  <RegistryKey Root="HKCU" Key="<path>" Action="createAndRemoveOnUninstall">
    <RegistryValue Name="myStrings" Action="append" Type="multiString">
      <MultiStringValue Name="myStrings" Action="append" Type="multiString">  
        1
      </MultiStringValue>
      <MultiStringValue Name="myStrings" Action="append" Type="multiString">  
        2
      </MultiStringValue>
      <MultiStringValue Name="myStrings" Action="append" Type="multiString">  
        3
      </MultiStringValue>
    </RegistryValue>
    <RegistryValue Name="myString" Value="x" Type="string"/>
  </RegistryKey>
</Component>


Actually all it needs to be is this:

<RegistryValue Type="multiString" Name="Value Name">
  <MultiStringValue>1</MultiStringValue>
  <MultiStringValue>2 &lt; 3</MultiStringValue>   <!-- Stands for 2 < 3 -->
  <MultiStringValue>33</MultiStringValue>
</RegistryValue>


Use MultiStringValue element.

0

精彩评论

暂无评论...
验证码 换一张
取 消