首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >对于Wix工具集和UpgradeVersion标记,属性已重置

问对于Wix工具集和UpgradeVersion标记,属性已重置
EN

Stack Overflow用户
提问于 2021-02-10 08:20:51
回答 1查看 49关注 0票数 1

我们有下面的Product.wxs代码。当安装程序运行时,我们可以看到BackupFiles自定义操作会运行,但RestoreFiles不会像日志文件中所示那样运行:

“跳过操作: RestoreFiles (条件为false)”

为什么在相同条件下,BackupFiles会运行,而RestoreFiles不会运行?OLDVERSIONFOUND是否已更改?

代码语言:javascript
复制
    <?xml version="1.0" encoding="UTF-8"?>
    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
         xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
         xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" >
    
    
      <Product Id="*" Name="My Product" Language="1033" Version="0.0.0.0" Manufacturer="MyCompany"
             UpgradeCode="{B55B9CB0-BA28-4BB3-834B-6075AD5D45E4}">
    
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
        <UIRef Id="WixUI_ErrorProgressText" />
    
    
        <!-- Specify UI -->
        <Property Id="WIXUI_INSTALLDIR" Value="INSTALL_FOLDER" />
        <Property Id="RestoreFiles" Value="INSTALL_FOLDER" />
    
    
    <Upgrade Id="{B55B9CB0-BA28-4BB3-834B-6075AD5D45E4}">
      <UpgradeVersion Minimum="1.0.0"
                      IncludeMinimum="yes"
                      OnlyDetect="no"
                      Maximum="0.0.0.0"
                      IncludeMaximum="no"
                      Property="OLDVERSIONFOUND" />
    </Upgrade>    
    
    <InstallExecuteSequence>
    
        <Custom Action="BackupFiles" After="InstallValidate" >OLDVERSIONFOUND</Custom>
        <Custom Action="SetRestoreFiles" Before="RestoreFiles" />
        <Custom Action="RestoreFiles" After="InstallFiles" >OLDVERSIONFOUND></Custom>
    
    
        <RemoveExistingProducts After="InstallInitialize" />    
    
      </InstallExecuteSequence>
    </Wix>
EN

回答 1

Stack Overflow用户

发布于 2021-02-10 12:45:31

并不推荐这样的自定义操作。They can be quite complicated to get right。查看底部“设置保存”的链接。

简而言之,不应该安装设置文件,而是由应用程序根据默认值或模板创建设置文件(这样安装程序就永远不会干扰它们),或者您可以将所有设置云化并在启动时从数据库中检索。See here, section "cloud-style approaches"。

主要升级-卸载和安装:主要升级有一个重要的奇怪之处。您必须记住,您启动新的安装程序,然后它将启动旧安装程序的卸载顺序,作为其自身操作的一部分。Hence a major upgrade will run the uninstall sequence of your old setup and the install sequence of your new setup (根据主要升级设置的配置可能会有不同的顺序)。

反直觉效果:这种组合的“安装/卸载”方法会对逻辑、调节、排序和属性值产生很大影响--有些变化非常不直观。除了“同时”(或在同一操作期间)运行两个不同的版本之外,您还必须记住,每个安装/卸载序列都以两种不同的模式运行:immediate (构建执行脚本)和deferred (执行脚本执行)。With poor conditioning the same custom action could run several times unexpectedly (including in the GUI sequence of the launched setup). Confusing. Debug using message boxes as described towards the bottom here.

详细解释:这种复杂性和在安装过程中属性值似乎发生变化的现象在这里进行了详细解释:Run Wix Custom action only during uninstall and not during Major upgrade -请阅读该答案(双源和全部)。我稍后会回头看,今晚运行测试已经太晚了。

添加一些进一步的链接:

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66129202

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档