我有 2 个由 WiX 生成的 msi 安装程序。第一个(安装程序 1)的版本 =“1.0.0.0”,而第二个(安装程序 2)的版本 =“1.1.0.0”。它们都有 ProductCode = "*" 和 UpgradeCode = "UpgradeCode"。
安装程序 1 在 %AppData%\MyApp\1.0.0.0 文件夹中安装一个 exe 文件,并在 SOFTWARE\MyApp\1.0.0.0 下的注册表中写入一个条目。该条目的值为 1.0.0.0
安装程序 2 的预期行为是,在其安装过程中,以前的版本 (1.0.0.0) 将从控制面板中卸载,其条目将从注册表中删除,文件夹将从 %AppData%\MyApp 中卸载。
真正发生的是版本 1.0.0.0 未从控制面板中安装,条目已从注册表中删除并安装了新版本的条目,但文件夹 %AppData%\MyApp\1.0.0.0 仍然存在,并在下创建了一个新文件夹 1.1.0.0 %AppData%\MyApp。
谁能帮我找出我的代码有什么问题以及如何解决它?
<Product Id="*"
Name="MyApplication"
Language="1033"
Version="$(var.ProductVersion)"
Manufacturer="MyCompany"
UpgradeCode="{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}">
<Package InstallerVersion="200"
Compressed="yes"
Description="Installer for my application"
InstallScope="perUser"/>
<Upgrade Id="{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}">
<UpgradeVersion Minimum="$(var.ProductVersion)"
OnlyDetect="yes"
Property="NEWERVERSIONDETECTED"/>
<UpgradeVersion Property="OLDERVERSIONBEINGUPGRADED"
Minimum="1.0.0.0"
IncludeMinimum="yes"
Maximum="$(var.ProductVersion)"
IncludeMaximum="no"/>
</Upgrade>
<Property Id="MSIRESTARTMANAGERCONTROL"
Value="Disable"/>
<InstallExecuteSequence>
<RemoveExistingProducts Before="InstallInitialize" />
</InstallExecuteSequence>
<Media Id="1"
Cabinet="MyApp.cab"
EmbedCab="yes"/>
<Directory Id="TARGETDIR"
Name="SourceDir">
<Directory Id="AppDataFolder">
<Directory Id="CompanyDir"
Name="MyApp">
<Component Id="CompanyDirComp"
Guid="*">
<RemoveFolder Id="RemCompanyDir"
On="uninstall"
Property="CompanyDir"/>
<RegistryValue Root="HKCU"
Key="SOFTWARE\MyApp"
Name="Uninstall"
Type="string"
Value="$(var.ProductVersion)"
KeyPath="yes"/>
<RemoveRegistryKey Action="removeOnInstall"
Id="cd"
Key="SOFTWARE\MyApp"
Root="HKCU"/>
</Component>
<Directory Id="INSTALLDIR"
Name="$(var.ProductVersion)">
<Component Id="CompanyDirInstallComp"
Guid="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}">
<RegistryValue Root="HKCU"
Key="SOFTWARE\MyApp\$(var.ProductVersion)"
Name="Uninstall"
Type="string"
Value="$(var.ProductVersion)"
KeyPath="yes"/>
<RemoveFolder Id="RemINSTALLDIR"
On="uninstall"
Property="INSTALLDIR"/>
<File Id="myFile.exe" Source="C:\Users\myFile.exe"/>
<RemoveFile Id="RemMyFile"
On="uninstall"
Name="*.exe"/>
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Product>
更新的问题:
我已经在 Windows 8.1x32 和 Windows 8.1x64 上测试了上面的代码。安装程序 2 在 Windows 8.1x64 上正常工作;在其安装过程中,以前的版本 (1.0.0.0) 从控制面板中卸载,其条目从注册表中删除,文件夹从 %AppData%\MyApp 中卸载。在 Windows 8.1x32 安装程序 2 上,仅从控制面板中卸载以前的版本,但其条目仍保留在注册表中,文件夹不会被删除。
我使用 cmd 和以下命令运行安装程序 2:msiexec /i installer2.msi /l*v log.txt
Windows 8.1x64 输出:操作 2:45:13:FindRelatedProducts。搜索相关应用 动作开始 2:45:13:FindRelatedProducts。FindRelatedProducts:找到应用程序:{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} MSI (c) (48:7C) [02:45:13:828]:属性更改:添加 OLDER_VERSION_DETECTED 属性。其值为“{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}”。操作于 2:45:13 结束:FindRelatedProducts。返回值 1。
Windows 8.1x32 输出:MSI (c) (68:20) [01:45:29:831]:执行操作:FindRelatedProducts MSI (c) (68:20) [01:45:29:831]:注意:1 : 2205 2: 3: ActionText 动作 1:45:29: FindRelatedProducts。搜索相关应用 操作开始时间 1:45:29:FindRelatedProducts。操作于 1:45:29 结束:FindRelatedProducts。返回值 1。
由于某种原因在 Windows 8.1x32 安装程序 2 上找不到版本 1.0.0.0 有什么想法会导致上述问题吗?