【问题标题】:How to make certain a Wix installer will override (upgrade) an older version and won't allow a downgrade如何确保 Wix 安装程序将覆盖(升级)旧版本并且不允许降级
【发布时间】:2016-09-21 10:39:40
【问题描述】:

我已经尝试了这个论坛和其他论坛中关于该主题的大部分答案,但我仍然有这个问题。

我想更新捆绑包版本,当我构建和安装安装程序时,它应该升级以前的安装,而不是在“程序和文件”中创建两条记录。

我在 Product.wxs 中使用以下代码。

<Product Id="*" Name="SetupProject1" Language="1033" Version="1.0.0.0" Manufacturer="miro" UpgradeCode="5ba49b49-25c4-47c0-82da-12bf5310af58">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

<MajorUpgrade AllowDowngrades="no" AllowSameVersionUpgrades="yes" IgnoreRemoveFailure="no" DowngradeErrorMessage="loc.NewerVersionInstalled" Schedule="afterInstallInitialize"/>
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="SetupProject1" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>

</Product>

<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="INSTALLFOLDER" Name="SetupProject1" />
        </Directory>
    </Directory>
</Fragment>

<Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
        <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
         <Component Id="ProductComponent">
     <File Id="file_Exefile" Source="..\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe">

     </File>
         </Component> 
    </ComponentGroup>
</Fragment>

我什至正在考虑根据安装程序进程及其 ProductVersion 属性编写自己的更新逻辑,但需要考虑的情况太多。

你能告诉我这个 Product.wxs 有什么问题吗,以便我修复它。

谢谢。

最好的问候, 叶夫根尼·杜尔格罗夫

【问题讨论】:

    标签: wix installation upgrade versions downgrade


    【解决方案1】:

    有几件事可能会阻止重大升级。您似乎有正确的 MajorUpgrade 逻辑,但是:

    如果您在前三个字段中增加您的产品版本会更好,这对于重大升级来说更正常。

    您当前的 UpgradeCode 与旧产品的相同并不明显,因此请检查是否相同。

    如果以前产品的安装范围是 perUser,则主要升级将不起作用,因为 Windows Installer 不允许跨上下文主要升级。

    安装详细日志并查看所有出现的 FindRelatedProducts。会有不止一个,但是看看升级安装中的那个是否能找到以前安装的产品。

    【讨论】:

      【解决方案2】:

      您必须将升级部分添加到您的产品部分。

      <Upgrade Id='5ba49b49-25c4-47c0-82da-12bf5310af58'>
         <UpgradeVersion OnlyDetect='no' Property='ISUPGRADE'
                            Minimum='0.0' IncludeMinimum='yes'
                            Maximum='1.0.0.0' IncludeMaximum='no' />     
      </Upgrade>
      

      结帐Upgrades and Modularization on Firegiant

      此外,WiX 文档 chm(在您的开始菜单中)也非常有用。

      【讨论】:

        猜你喜欢
        • 2014-02-10
        • 2012-03-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-12-27
        • 2021-12-09
        • 1970-01-01
        相关资源
        最近更新 更多