2012-09-18 73 views
1

我正在尝试使用WIX创建MSI,并且我似乎偶然发现了一个小问题,这个问题让我对升级感到困惑。我跟随了大约3个关于这个主题的教程,每个教程都给出了相同的结果。当我尝试升级应用程序时,我得到一个通用的WIX安装程序升级

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

消息。环顾四周后,我看到为了成功升级,我需要指定一个新的产品GUID。这对我来说似乎很奇怪,因为主要的WiX网站说这只是主要安装所必需的。由于我运气不好,我决定和它一起去。请注意它成功执行了安装程序,但是当我检入添加/删除程序时,我现在已安装了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

将产品/ @ Id设置为“*”可以自动更改产品代码并使用MajorUpgrade element。有关更多上下文,请参阅my blog

+0

我试过你的方法,但是这给了我错误。它似乎并不知道'InstallValidate'是什么。另外,通过使用MajorUpgrade元素我是否必须递增主要版本构建,还是可以通过增加次要构建和小型构建来摆脱困境? – Seb

+0

您对Schedule属性值使用“afterInstallValidate”吗?您可以更改前三个版本字段中的任何一个;见http://www.joyofsetup.com/2008/12/29/neither-more-nor-less/。 –

+0

经过多次测试,我终于找到了工作。似乎我混合了太多类似的属性,并且一旦我将所有东西都剥下来并从头开始,我就开始工作了。谢谢。 – Seb

相关问题