如何确定Wix安装程序将覆盖(升级)旧版本,并且不允许降级

时间:2016-09-21 10:39:40

标签: wix installer upgrade versions downgrade

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

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

我在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有什么问题,所以我可以解决它。

感谢。

祝你好运, Evgeni Dyulgerov

2 个答案:

答案 0 :(得分:2)

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

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

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

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

安装是否采用详细日志并查看所有出现的FindRelatedProducts。将有多个,但请查看升级安装中的那个是否找到以前安装的产品。

答案 1 :(得分:0)

您必须在产品部分添加升级部分。

<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(在“开始”菜单中)非常有帮助。

相关问题