Wix 安装程序不会覆盖以前版本的可执行文件
Wix installer does not overwrite previous version of an executable
我有一个非常简单的安装程序 - 将单个 dll 复制到 Program Files 子文件夹并使用 regsvr32.exe 注册它。效果很好,但如果安装了旧版本的 dll,"Repair" 不会覆盖现有的 dll。 dll 已签名且其版本(内部版本)编号始终递增(例如 2.0.0.123 - > 2.0.0.124)。
看之前类似的帖子,我添加了RemoveExistingProducts,并将ProductId指定为“*”。卸载然后安装较新版本工作正常,但我确实需要修复以更新现有的 dll。
我还需要做什么吗?
谢谢!
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<!--
When creating a new install for the next version, these fields must be modified
-->
<?define ProductVersion = "2.0.00" ?>
<?define ProductId64 = "*" ?>
<?define ProductId32 = "*" ?>
<?define PackageId = "45F34788-66AC-441C-B666-707FFA7F1EE9" ?>
<!-- Product name as you want it to appear in Add/Remove Programs-->
<?if $(var.Platform) = x64 ?>
<?define ProductName = "XYZ (64 bit)" ?>
<?define Win64 = "yes" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?define ProductId = "$(var.ProductId64)" ?>
<?define MainDllName = "XYZ64.dll" ?>
<?define MainDllSource = "..\..\bin\Win64\Release\XYZ64.dll" ?>
<?else ?>
<?define ProductName = "XYZ (32 bit)" ?>
<?define Win64 = "no" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?define ProductId = "$(var.ProductId32)" ?>
<?define MainDllName = "XYZ.dll" ?>
<?define MainDllSource = "..\..\bin\Win32\Release\XYZ.dll" ?>
<?endif ?>
<?define UpgradeCode = "{C3763742-7C1C-4AB7-A404-F030B7550E97}" ?>
<Product Id="$(var.ProductId)" Name="$(var.ProductName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Advanced Messaging Systems LLC" UpgradeCode="$(var.UpgradeCode)">
<Package Id="$(var.PackageId)" InstallerVersion="200" Compressed="yes" Description="XYZ Installer package" InstallPrivileges="elevated"/>
<!-- No restore point -->
<Property Id="MSIFASTINSTALL" Value="3" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.PlatformProgramFilesFolder)">
<Directory Id="INSTALLLOCATION" Name="XYZ">
<Component Id="XYZDll" Guid="E2CBEE41-6C0E-4A84-95C1-7282747B4A3D">
<File Id='MainDll' Name="$(var.MainDllName)" DiskId='1' Source="$(var.MainDllSource)" SelfRegCost="0" />
<!-- TODO: Insert files, registry keys, and other resources here. -->
</Component>
</Directory>
</Directory>
</Directory>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />
<!-- Note: Custom actions to install/uninstall the dll using regsvr32.exe -->
<CustomAction Id="RegisterDll"
Directory="INSTALLLOCATION"
ExeCommand='regsvr32.exe /s "[INSTALLLOCATION]$(var.MainDllName)"'
Return="check">
</CustomAction>
<CustomAction Id="UnregisterDll"
Directory="INSTALLLOCATION"
ExeCommand='regsvr32.exe /s /u "[INSTALLLOCATION]$(var.MainDllName)"'>
</CustomAction>
<Feature Id="ProductFeature" Title="XYZ" Level="1">
<ComponentRef Id="XYZDll" />
<!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. -->
<ComponentGroupRef Id="Product.Generated" />
</Feature>
<InstallUISequence>
<Custom Action="WixCloseApplications" Before="AppSearch"/>
</InstallUISequence>
<InstallExecuteSequence>
<!-- Uninstall previous version before installing this one. -->
<RemoveExistingProducts Before="InstallInitialize"/>
<SelfRegModules/>
</InstallExecuteSequence>
<Icon Id="XYZ.ico" SourceFile="..\Graphics\XYZ.ico"/>
<Property Id="ARPPRODUCTICON" Value="XYZ.ico" />
<!-- UI -->
<UIRef Id="WixUI_InstallDir"/>
<UIRef Id="WixUI_ErrorProgressText" />
<WixVariable Id="WixUILicenseRtf" Value="..\EULA\license.rtf" />
<WixVariable Id="WixUIBannerBmp" Value="..\Graphics\banner.jpg" />
<WixVariable Id="WixUIDialogBmp" Value="..\Graphics\logo.jpg" />
<!-- End UI -->
</Product>
</Wix>
更新。修改升级条目后,以下对我有用:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<!--
When creating a new install for the next version, these fields must be modified
-->
<?define ProductVersion = "2.0.4" ?>
<?define ProductId64 = "*" ?>
<?define ProductId32 = "*" ?>
<?define PackageId = "*" ?>
<!-- Product name as you want it to appear in Add/Remove Programs-->
<?if $(var.Platform) = x64 ?>
<?define ProductName = "XYZ (64 bit)" ?>
<?define Win64 = "yes" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?define ProductId = "$(var.ProductId64)" ?>
<?define MainDllName = "XYZ64.dll" ?>
<?define MainDllSource = "..\..\bin\Win64\Release\XYZ64.dll" ?>
<?else ?>
<?define ProductName = "XYZ (32 bit)" ?>
<?define Win64 = "no" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?define ProductId = "$(var.ProductId32)" ?>
<?define MainDllName = "XYZ.dll" ?>
<?define MainDllSource = "..\..\bin\Win32\Release\XYZ.dll" ?>
<?endif ?>
<?define UpgradeCode = "{C3763742-7C1C-4AB7-A404-F030B7550E97}" ?>
<Product
Id="$(var.ProductId)"
Name="$(var.ProductName)"
Language="1033"
Version="$(var.ProductVersion)"
Manufacturer="Advanced Messaging Systems LLC"
UpgradeCode="$(var.UpgradeCode)"
>
<Package Id="$(var.PackageId)"
InstallerVersion="200"
Compressed="yes"
Description="XYZ Installer package"
InstallPrivileges="elevated"
/>
<!-- No restore point -->
<Property Id="MSIFASTINSTALL" Value="3" />
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Minimum="1.0.0"
IncludeMinimum="yes"
OnlyDetect="no"
Maximum="$(var.ProductVersion)"
IncludeMaximum="no"
Property="PREVIOUSFOUND" />
</Upgrade>
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.PlatformProgramFilesFolder)">
<Directory Id="INSTALLLOCATION" Name="XYZ">
<Component Id="XYZDll" Guid="E2CBEE41-6C0E-4A84-95C1-7282747B4A3D">
<File Id='MainDll' Name="$(var.MainDllName)" DiskId='1' Source="$(var.MainDllSource)" SelfRegCost="0" />
<!-- TODO: Insert files, registry keys, and other resources here. -->
</Component>
</Directory>
</Directory>
</Directory>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />
<!-- Note: Custom actions to install/uninstall the dll using regsvr32.exe -->
<CustomAction Id="RegisterDll"
Directory="INSTALLLOCATION"
ExeCommand='regsvr32.exe /s "[INSTALLLOCATION]$(var.MainDllName)"'
Return="check">
</CustomAction>
<CustomAction Id="UnregisterDll"
Directory="INSTALLLOCATION"
ExeCommand='regsvr32.exe /s /u "[INSTALLLOCATION]$(var.MainDllName)"'>
</CustomAction>
<Feature Id="ProductFeature" Title="XYZ" Level="1">
<ComponentRef Id="XYZDll" />
<!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. -->
<ComponentGroupRef Id="Product.Generated" />
</Feature>
<InstallUISequence>
<Custom Action="WixCloseApplications" Before="AppSearch"/>
</InstallUISequence>
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallInitialize"/>
<SelfRegModules/>
</InstallExecuteSequence>
<Icon Id="XYZ.ico" SourceFile="..\Graphics\XYZ.ico"/>
<Property Id="ARPPRODUCTICON" Value="XYZ.ico" />
<!-- UI -->
<UIRef Id="WixUI_InstallDir"/>
<UIRef Id="WixUI_ErrorProgressText" />
<WixVariable Id="WixUILicenseRtf" Value="..\EULA\license.rtf" />
<WixVariable Id="WixUIBannerBmp" Value="..\Graphics\banner.jpg" />
<WixVariable Id="WixUIDialogBmp" Value="..\Graphics\logo.jpg" />
<!-- End UI -->
</Product>
</Wix>
令我惊讶的是 Wix 编译器 和 链接器 实际上允许这条线:
<?define PackageId = "45F34788-66AC-441C-B666-707FFA7F1EE9" ?>
如果这真的有效并通过,我还没有测试过,这意味着你的包有一个硬编码包 ID。我认为 Wix 具有针对此问题的保护功能?也许是这样?如果允许硬编码包 guid 有任何意义,我们应该与 Wix 社区核实。我想这对于调试和测试目的可能是必要的 - 但至少应该有一个编译器警告。
包 GUID 的想法 是它对于每个编译的 MSI 文件应该是唯一的。 它只是用来唯一标识一个文件。 根据定义,Windows 安装程序会将具有相同包 GUID 的两个不同 MSI 文件视为相同文件。各种 x 文件问题的结果。因此,包 GUID 应始终自动生成,因为它应该是唯一的。请先尝试解决此问题,以检查这是否解决了您的整体问题。将其设置为等于 *.
我的建议是自动生成包ID和产品ID但是设置硬编码升级代码。升级代码标识“产品系列”,可用于标识您的产品的任何实例,无论语言和版本如何。为 64 位和 32 位设置使用单独的升级代码可能会有用,因为在某些系统上可以同时安装这两个版本。
您可能还想取消使用 regsvr32.exe 进行自注册并从您的 dll 中提取 COM 数据以获得适当的 MSI 支持: MSI register dll - Self-Registration considered harmful. And perhaps also check this: Register ActiveX exe server using WiX(如果 Heat 不起作用,请检查 RegSpy2)。
另请注意 you can leave out a lot of source attributes from your Wix xml file 并依赖 Wix 默认值而不是硬编码值。
有关 GUID 和文件替换的更多详细信息:
- Change my component GUID in wix?
- MSI Reference Counting: Two products install the same MSIs
- Forcing an upgrade of a file that is modified during its initial installation
- msi version numbers
- File Versioning Rules
- Replacing existing files (diagram, both files have version)
- Plain English file versioning description by Aaron Stebner
简答(另一个变得太乱了):尝试删除这一行并通过将其设置为“*”让包 ID 自动生成:
<?define PackageId = "45F34788-66AC-441C-B666-707FFA7F1EE9" ?>
请注意,您必须在卸载所有以前的 MSI 版本后停止使用它们。这是由于错误的硬编码包 guid 可能导致不可预测和不可预见的问题。
如果您想要进行重大升级,请从 WiX MajorUpgrade 元素开始。升级的一般规则是:
- 与旧产品不同的 ProductCode 和 PackageCode。
- 在前三个字段中的某处增加 ProductVersion。
- 与旧产品相同的升级代码。
- 做一些事情(例如 Wix MajorUprade 或升级元素)以确保您有适当的升级。
- 每用户安装不会升级每系统安装,反之亦然。
在您原来的情况下,未能遵守规则 1 和 2 意味着 Windows 认为同一产品已安装并进入修复模式。这应该是您的第一个警告,因为重大升级看起来像是全新安装,而不是修复。如果您在 Programs&Features 中有两个条目,则表示未满足这 4 个要求中的一个或多个。如果您得到 "Another version of this product is already installed",则表示您没有遵循规则 1,并且行为的变化是关于 ProductCode 和 PackageCode 值与已安装产品的比较。
我有一个非常简单的安装程序 - 将单个 dll 复制到 Program Files 子文件夹并使用 regsvr32.exe 注册它。效果很好,但如果安装了旧版本的 dll,"Repair" 不会覆盖现有的 dll。 dll 已签名且其版本(内部版本)编号始终递增(例如 2.0.0.123 - > 2.0.0.124)。
看之前类似的帖子,我添加了RemoveExistingProducts,并将ProductId指定为“*”。卸载然后安装较新版本工作正常,但我确实需要修复以更新现有的 dll。
我还需要做什么吗?
谢谢!
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<!--
When creating a new install for the next version, these fields must be modified
-->
<?define ProductVersion = "2.0.00" ?>
<?define ProductId64 = "*" ?>
<?define ProductId32 = "*" ?>
<?define PackageId = "45F34788-66AC-441C-B666-707FFA7F1EE9" ?>
<!-- Product name as you want it to appear in Add/Remove Programs-->
<?if $(var.Platform) = x64 ?>
<?define ProductName = "XYZ (64 bit)" ?>
<?define Win64 = "yes" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?define ProductId = "$(var.ProductId64)" ?>
<?define MainDllName = "XYZ64.dll" ?>
<?define MainDllSource = "..\..\bin\Win64\Release\XYZ64.dll" ?>
<?else ?>
<?define ProductName = "XYZ (32 bit)" ?>
<?define Win64 = "no" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?define ProductId = "$(var.ProductId32)" ?>
<?define MainDllName = "XYZ.dll" ?>
<?define MainDllSource = "..\..\bin\Win32\Release\XYZ.dll" ?>
<?endif ?>
<?define UpgradeCode = "{C3763742-7C1C-4AB7-A404-F030B7550E97}" ?>
<Product Id="$(var.ProductId)" Name="$(var.ProductName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Advanced Messaging Systems LLC" UpgradeCode="$(var.UpgradeCode)">
<Package Id="$(var.PackageId)" InstallerVersion="200" Compressed="yes" Description="XYZ Installer package" InstallPrivileges="elevated"/>
<!-- No restore point -->
<Property Id="MSIFASTINSTALL" Value="3" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.PlatformProgramFilesFolder)">
<Directory Id="INSTALLLOCATION" Name="XYZ">
<Component Id="XYZDll" Guid="E2CBEE41-6C0E-4A84-95C1-7282747B4A3D">
<File Id='MainDll' Name="$(var.MainDllName)" DiskId='1' Source="$(var.MainDllSource)" SelfRegCost="0" />
<!-- TODO: Insert files, registry keys, and other resources here. -->
</Component>
</Directory>
</Directory>
</Directory>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />
<!-- Note: Custom actions to install/uninstall the dll using regsvr32.exe -->
<CustomAction Id="RegisterDll"
Directory="INSTALLLOCATION"
ExeCommand='regsvr32.exe /s "[INSTALLLOCATION]$(var.MainDllName)"'
Return="check">
</CustomAction>
<CustomAction Id="UnregisterDll"
Directory="INSTALLLOCATION"
ExeCommand='regsvr32.exe /s /u "[INSTALLLOCATION]$(var.MainDllName)"'>
</CustomAction>
<Feature Id="ProductFeature" Title="XYZ" Level="1">
<ComponentRef Id="XYZDll" />
<!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. -->
<ComponentGroupRef Id="Product.Generated" />
</Feature>
<InstallUISequence>
<Custom Action="WixCloseApplications" Before="AppSearch"/>
</InstallUISequence>
<InstallExecuteSequence>
<!-- Uninstall previous version before installing this one. -->
<RemoveExistingProducts Before="InstallInitialize"/>
<SelfRegModules/>
</InstallExecuteSequence>
<Icon Id="XYZ.ico" SourceFile="..\Graphics\XYZ.ico"/>
<Property Id="ARPPRODUCTICON" Value="XYZ.ico" />
<!-- UI -->
<UIRef Id="WixUI_InstallDir"/>
<UIRef Id="WixUI_ErrorProgressText" />
<WixVariable Id="WixUILicenseRtf" Value="..\EULA\license.rtf" />
<WixVariable Id="WixUIBannerBmp" Value="..\Graphics\banner.jpg" />
<WixVariable Id="WixUIDialogBmp" Value="..\Graphics\logo.jpg" />
<!-- End UI -->
</Product>
</Wix>
更新。修改升级条目后,以下对我有用:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<!--
When creating a new install for the next version, these fields must be modified
-->
<?define ProductVersion = "2.0.4" ?>
<?define ProductId64 = "*" ?>
<?define ProductId32 = "*" ?>
<?define PackageId = "*" ?>
<!-- Product name as you want it to appear in Add/Remove Programs-->
<?if $(var.Platform) = x64 ?>
<?define ProductName = "XYZ (64 bit)" ?>
<?define Win64 = "yes" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?define ProductId = "$(var.ProductId64)" ?>
<?define MainDllName = "XYZ64.dll" ?>
<?define MainDllSource = "..\..\bin\Win64\Release\XYZ64.dll" ?>
<?else ?>
<?define ProductName = "XYZ (32 bit)" ?>
<?define Win64 = "no" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?define ProductId = "$(var.ProductId32)" ?>
<?define MainDllName = "XYZ.dll" ?>
<?define MainDllSource = "..\..\bin\Win32\Release\XYZ.dll" ?>
<?endif ?>
<?define UpgradeCode = "{C3763742-7C1C-4AB7-A404-F030B7550E97}" ?>
<Product
Id="$(var.ProductId)"
Name="$(var.ProductName)"
Language="1033"
Version="$(var.ProductVersion)"
Manufacturer="Advanced Messaging Systems LLC"
UpgradeCode="$(var.UpgradeCode)"
>
<Package Id="$(var.PackageId)"
InstallerVersion="200"
Compressed="yes"
Description="XYZ Installer package"
InstallPrivileges="elevated"
/>
<!-- No restore point -->
<Property Id="MSIFASTINSTALL" Value="3" />
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Minimum="1.0.0"
IncludeMinimum="yes"
OnlyDetect="no"
Maximum="$(var.ProductVersion)"
IncludeMaximum="no"
Property="PREVIOUSFOUND" />
</Upgrade>
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.PlatformProgramFilesFolder)">
<Directory Id="INSTALLLOCATION" Name="XYZ">
<Component Id="XYZDll" Guid="E2CBEE41-6C0E-4A84-95C1-7282747B4A3D">
<File Id='MainDll' Name="$(var.MainDllName)" DiskId='1' Source="$(var.MainDllSource)" SelfRegCost="0" />
<!-- TODO: Insert files, registry keys, and other resources here. -->
</Component>
</Directory>
</Directory>
</Directory>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />
<!-- Note: Custom actions to install/uninstall the dll using regsvr32.exe -->
<CustomAction Id="RegisterDll"
Directory="INSTALLLOCATION"
ExeCommand='regsvr32.exe /s "[INSTALLLOCATION]$(var.MainDllName)"'
Return="check">
</CustomAction>
<CustomAction Id="UnregisterDll"
Directory="INSTALLLOCATION"
ExeCommand='regsvr32.exe /s /u "[INSTALLLOCATION]$(var.MainDllName)"'>
</CustomAction>
<Feature Id="ProductFeature" Title="XYZ" Level="1">
<ComponentRef Id="XYZDll" />
<!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. -->
<ComponentGroupRef Id="Product.Generated" />
</Feature>
<InstallUISequence>
<Custom Action="WixCloseApplications" Before="AppSearch"/>
</InstallUISequence>
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallInitialize"/>
<SelfRegModules/>
</InstallExecuteSequence>
<Icon Id="XYZ.ico" SourceFile="..\Graphics\XYZ.ico"/>
<Property Id="ARPPRODUCTICON" Value="XYZ.ico" />
<!-- UI -->
<UIRef Id="WixUI_InstallDir"/>
<UIRef Id="WixUI_ErrorProgressText" />
<WixVariable Id="WixUILicenseRtf" Value="..\EULA\license.rtf" />
<WixVariable Id="WixUIBannerBmp" Value="..\Graphics\banner.jpg" />
<WixVariable Id="WixUIDialogBmp" Value="..\Graphics\logo.jpg" />
<!-- End UI -->
</Product>
</Wix>
令我惊讶的是 Wix 编译器 和 链接器 实际上允许这条线:
<?define PackageId = "45F34788-66AC-441C-B666-707FFA7F1EE9" ?>
如果这真的有效并通过,我还没有测试过,这意味着你的包有一个硬编码包 ID。我认为 Wix 具有针对此问题的保护功能?也许是这样?如果允许硬编码包 guid 有任何意义,我们应该与 Wix 社区核实。我想这对于调试和测试目的可能是必要的 - 但至少应该有一个编译器警告。
包 GUID 的想法 是它对于每个编译的 MSI 文件应该是唯一的。 它只是用来唯一标识一个文件。 根据定义,Windows 安装程序会将具有相同包 GUID 的两个不同 MSI 文件视为相同文件。各种 x 文件问题的结果。因此,包 GUID 应始终自动生成,因为它应该是唯一的。请先尝试解决此问题,以检查这是否解决了您的整体问题。将其设置为等于 *.
我的建议是自动生成包ID和产品ID但是设置硬编码升级代码。升级代码标识“产品系列”,可用于标识您的产品的任何实例,无论语言和版本如何。为 64 位和 32 位设置使用单独的升级代码可能会有用,因为在某些系统上可以同时安装这两个版本。
您可能还想取消使用 regsvr32.exe 进行自注册并从您的 dll 中提取 COM 数据以获得适当的 MSI 支持: MSI register dll - Self-Registration considered harmful. And perhaps also check this: Register ActiveX exe server using WiX(如果 Heat 不起作用,请检查 RegSpy2)。
另请注意 you can leave out a lot of source attributes from your Wix xml file 并依赖 Wix 默认值而不是硬编码值。
有关 GUID 和文件替换的更多详细信息:
- Change my component GUID in wix?
- MSI Reference Counting: Two products install the same MSIs
- Forcing an upgrade of a file that is modified during its initial installation
- msi version numbers
- File Versioning Rules
- Replacing existing files (diagram, both files have version)
- Plain English file versioning description by Aaron Stebner
简答(另一个变得太乱了):尝试删除这一行并通过将其设置为“*”让包 ID 自动生成:
<?define PackageId = "45F34788-66AC-441C-B666-707FFA7F1EE9" ?>
请注意,您必须在卸载所有以前的 MSI 版本后停止使用它们。这是由于错误的硬编码包 guid 可能导致不可预测和不可预见的问题。
如果您想要进行重大升级,请从 WiX MajorUpgrade 元素开始。升级的一般规则是:
- 与旧产品不同的 ProductCode 和 PackageCode。
- 在前三个字段中的某处增加 ProductVersion。
- 与旧产品相同的升级代码。
- 做一些事情(例如 Wix MajorUprade 或升级元素)以确保您有适当的升级。
- 每用户安装不会升级每系统安装,反之亦然。
在您原来的情况下,未能遵守规则 1 和 2 意味着 Windows 认为同一产品已安装并进入修复模式。这应该是您的第一个警告,因为重大升级看起来像是全新安装,而不是修复。如果您在 Programs&Features 中有两个条目,则表示未满足这 4 个要求中的一个或多个。如果您得到 "Another version of this product is already installed",则表示您没有遵循规则 1,并且行为的变化是关于 ProductCode 和 PackageCode 值与已安装产品的比较。