如何将功能状态写入注册表项

时间:2012-12-13 19:15:18

标签: wix wix3.5 wix3.6

如果在安装过程中安装了某项功能,那么写入注册码的最佳方法是什么?

1 个答案:

答案 0 :(得分:0)

您应该使用具有条件的组件。条件可以引用要素状态(当前或请求 - 有关详细信息,请参阅this link)。我用'&'符号 - 它被请求(应该通过安装实现)功能状态。

<Component Id="MyComponentSpecificReg" Guid="YOURGUID">
    <Condition>&MyFeatureId = 3</Condition> <!--install this component only of feature requested state is LOCAL (You may need other condition - please read the link I posted above)-->
    <RegistryKey Root="YOUR REG ROOT" Key="YOUR REGISTRY PATH" Action="create">
        <RegistryValue Name="YourKeyName" Type="string" Value="[YOUR_PROPERTY]"/>
    </RegistryKey>
</Component>