Wix升级:预选功能

时间:2010-02-24 16:13:45

标签: wix wix3

我们正在使用Wix来创建我们的安装程序。我们正在使用UI,可以选择需要安装的功能。某些功能默认启用,其他功能已禁用。

但是,我们在运行升级时会保留这些默认值。我们希望安装程序记住安装了哪些功能,并在功能树中启用它们以进行升级。应禁用所有其他功能。

我们有这个代码,它似乎有用,但实际上,它没有:

<Feature Id="MainFeature" Level="1" ConfigurableDirectory="INSTALLDIR" Display="expand">
    <Feature Id="Feature1" Level="1" InstallDefault="local" AllowAdvertise="no">
        <ComponentGroupRef Id="Feature1ComponentGroup" />
        <Condition Level="3">(PROJECTUPGRADE AND NOT !Feature1=2)</Condition>
    </Feature>            
    <Feature Id="Feature2" Level="3" InstallDefault="local" AllowAdvertise="no">
        <ComponentGroupRef Id="Feature2ComponentGroup" />
        <Condition Level="1">(PROJECTUPGRADE AND !Feature2=2)</Condition>
    </Feature>
</Feature>

1 个答案:

答案 0 :(得分:2)

啊,看来我在找错了地方。 UpdgradeVersion标记上有一个名为“MigrateFeatures”的属性,用于指定:

<Upgrade Id="$(var.UpgradeCode)">
    <UpgradeVersion Minimum="$(var.ProductVersion)" IncludeMinimum="yes" OnlyDetect="yes" Property="PROJECTDOWNGRADE" />
    <UpgradeVersion Maximum="$(var.ProductVersion)" IncludeMaximum="no" Property="PROJECTUPGRADE" MigrateFeatures="yes" />
</Upgrade>