2010-02-24 110 views
2

我们使用Wix创建我们的安装程序。我们正在使用用户界面来选择需要安装的功能。某些功能默认启用,其他功能被禁用。Wix升级:预选功能

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

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

<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> 

回答

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>