我将ProductVersion更改为其他格式时msi升级失败

时间:2016-08-11 09:08:58

标签: wix windows-installer

我有以下问题,我试图了解正在发生的事情。我有这段代码:

...
<Product Name="My Service"
       Id="*"
       UpgradeCode="$(var.UpgradeCode)"
       Language="$(var.Language)"
       Codepage="$(var.CodePage)"
       Version="$(var.ProductVersion)"
       Manufacturer="$(var.Manufacturer)">

    <Package Id="*"
         Keywords="Installer"
         Description="My Service Installer"
         Comments="Service Installer"
         Manufacturer="$(var.Manufacturer)"
         InstallerVersion="300"
         Languages="$(var.Language)"
         Compressed="yes"
         SummaryCodepage="$(var.CodePage)" />

     <Upgrade Id="$(var.UpgradeCode)">

     <!-- Populate NEWERVERSIONDETECTED if there is an installed
       package with the same upgrade code
       and version is > the version being installed -->
       <UpgradeVersion Minimum="$(var.ProductVersion)"
                  IncludeMinimum="no"
                  OnlyDetect="no"
                  Property="NEWERVERSIONDETECTED" />

     <!-- Populate UPGRADEFOUND if there is an installed
       package with the same upgrade code
       and the version is between the earliest version defined
       and the version being installed -->
       <UpgradeVersion Minimum="$(var.FirstVersion)"
                  IncludeMinimum="yes"
                  Maximum="$(var.ProductVersion)"
                  IncludeMaximum="no"
                  Property="PREVIOUSVERSIONSINSTALLED" />
     </Upgrade>

     <Condition Message="A newer version is already installed.">NOT NEWERVERSIONDETECTED</Condition>

     <InstallExecuteSequence>
       <RemoveExistingProducts Before="InstallInitialize" />
     </InstallExecuteSequence>

<!-- Step 1: Define the directory structure -->
...
<!-- Step 2: Add files to your installer package -->
...
<!-- Step 3: Tell WiX to install the files -->
...

ProductVersion和FirstVersion具有x.x.x格式。因为msi只包含3个文件,所以我更喜欢卸载所有内容并将新文件放在适当位置(如主要升级)。 以下是它发生的事情: FirstVersion定义为&#34; 0.0.1&#34 ;;我构建了两次我的项目(用ProductVersion生成两个msi&#34;第一个版本生成0.0.2&#34;第二个版本生成&#34; 0.0.3&#34;第二个生成)当我在0.0.2之上安装0.0.3时,一切都很顺利。在添加/删除程序中,我看到安装了新版本,&#34;我的服务&#34;已启动并在本地服务中运行,在程序文件中我看到我的文件夹包含新文件。

如果我使用ProductVersion 2.0.2和2.0.3构建项目(与之前的步骤相同),当我在2.0.2之上安装2.0.3时,没有弹出错误,安装成功完成(至少事件查看器这样说)但我的程序文件中的文件夹不存在,我的服务在本地服务中是未知的(它将无法启动)。唯一看起来不错的是添加/删除程序,它显示我安装了新版本2.0.3。另一个奇怪的事实是我可以成功从“添加/删除程序”中卸载我的应用程序。没错!

那么为什么0.0.0格式的ProductVersion升级工作正常,但是 不适用于2.0.x?

我尝试在升级过程中记录msiexec的输出,但也是如此 对我来说很复杂。

PS:不建议采用其他方式实现升级。我需要坚持下去 对于这段代码,因为我使用的msitools有很多限制。

1 个答案:

答案 0 :(得分:0)

版本是对的,你没有在那里犯任何错误。

如果没有verbose log,你发现问题的机会就会很小。这一点都不难。按照上面的链接,您会找到有关生成日志并与我们分享日志的多种方法的示例,或者尝试to read it成为您自己。