WIX安装程序升级

时间:2012-09-18 20:02:25

标签: wix windows-installer upgrade

我正在尝试使用WIX创建一个MSI,我似乎偶然发现了一个让我在升级方面有点困惑的小问题。我已经关注了这个主题的大约3个教程,每个都给了我相同的结果。当我尝试升级应用程序时,我得到了一个通用的

  

此产品的另一个版本已经安装。

消息。环顾四周后,我看到为了成功升级,我需要指定一个新的产品GUID。这对我来说似乎很奇怪,因为主要的WiX网站说这只是主要安装所需要的。由于我运气不好,所以我决定坚持下去。 Lo并且看到它成功执行了安装程序,但是当我签入“添加/删除程序”时,我现在已经安装了2个应用程序副本。这真让我抓狂。请参阅下面的.wxs,如果适用,请告诉我我的错误。

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
        
<Product Id="PRODUCT-GUID-GOES-HERE-B86BCC79EEFD" Name="Sample Application" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Sample Inc." UpgradeCode="$(var.UpgradeCode)">
    <Package Id="*" Keywords="Installer" Platform="x64" InstallerVersion="200" InstallPrivileges="elevated" InstallScope="perMachine" Compressed="yes" />

<Upgrade Id="$(var.UpgradeCode)">
  <UpgradeVersion Minimum="$(var.ProductVersion)" IncludeMinimum="no" OnlyDetect="yes" Language="1033" Property="NEWPRODUCTFOUND" />
  <UpgradeVersion Minimum="$(var.RTMProductVersion)" IncludeMinimum="no" Maximum="$(var.ProductVersion)" IncludeMaximum="no" Language="1033" Property="UPGRADEFOUND" />
</Upgrade>

    <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />

    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFiles64Folder">
    <Directory Id="Sample" Name="Sample">
      <Directory Id="INSTALLLOCATION" Name="Sample Application">
        <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
        <Component Id="SampleApplication" Guid="APPLICATION-GUID-GOES-HERE-c7247f5d1b42" Win64="yes">
        <!-- TODO: Insert files, registry keys, and other resources here. -->
          <File Id="SampleEXE" Name="Sample.exe" Source="Sample.exe" ProcessorArchitecture="x64" KeyPath="yes" />
        </Component>
      </Directory>
    </Directory>
        </Directory>
    </Directory>

    <Feature Id="Complete" Title="sample64" Level="1">
        <!-- TODO: Remove the comments around this ComponentRef element and the Component above in order to add resources to this installer. -->
        <ComponentRef Id="SampleApplication" />

        <!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. -->
        <ComponentGroupRef Id="Product.Generated" />
    </Feature>

<CustomAction Id="NoDowngrade" Error="A later version of [ProductName] is already installed." />

<InstallExecuteSequence>
  <Custom Action="NoDowngrade" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
  <RemoveExistingProducts After="InstallFinalize" />
</InstallExecuteSequence>

<InstallUISequence>
  <Custom Action="NoDowngrade" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
</InstallUISequence>

</Product>
</Wix>

提前感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

将Product / @ Id设置为“*”以获得自动更改产品代码并使用MajorUpgrade element。有关更多背景信息,请参阅my blog

相关问题