句柄“本产品的另一个版本已经安装。这个版本的安装不能继续…

时间:2022-06-21 22:42:47

I have 32-bit and 64-bit versions of my installer which have (nearly) the exact same code & custom action sequence (there are only minor differences which are not relevant to this issue)

我的安装程序有32位和64位版本,它们(几乎)具有完全相同的代码和自定义操作序列(只有细微的差异与此问题无关)

I want my installer to detect whether it has already been previously installed and in this case run my own code instead of showing the default Windows Installer error:

我想让我的安装程序检测它之前是否已经安装,在这种情况下运行我自己的代码,而不是显示默认的Windows安装程序错误:

Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel.

该产品的另一个版本已经安装。无法继续安装此版本。要配置或删除该产品的现有版本,请在控制面板上使用Add/ remove程序。

My 32-bit installer works perfectly fine in that it runs my custom code if I run the installer when the product is already installed, but the same code & custom action in my 64-bit installer does NOT work correctly and always shows the unwanted error msg.

我的32位安装程序工作得非常好,因为如果我在产品已经安装时运行安装程序,它就会运行我的自定义代码,但是我的64位安装程序中的相同代码和自定义操作不能正确工作,并且总是显示不希望出现的错误msg。

CheckPreviousVersion is the first function called as a Custom Action during the UI sequence, I've tried putting it in different spots like after InstallValidate but nothing works.

CheckPreviousVersion是在UI序列中被称为自定义操作的第一个函数,我尝试将它放到不同的位置,比如InstallValidate之后,但是没有任何东西可以工作。

I've examined the verbose log file but I can't find anything that might explain this behavior, here is a part of the log:

我检查了详细的日志文件,但是我找不到任何可以解释这种行为的东西,这是日志的一部分:

=== Verbose logging started: 05/03/2013  16:27:20  Build type: SHIP UNICODE 5.00.7601.00  Calling process: C:\Windows\system32\msiexec.exe
===

MSI (c) (0C:94) [16:27:20:331]: Machine policy value 'Debug' is 0 MSI (c) (0C:94) [16:27:20:331]: ******* RunEngine:
           ******* Product: foo.msi
           ******* Action: 
           ******* CommandLine: ********** MSI (c) (0C:94) [16:27:21:546]: Machine policy value 'DisableUserInstalls' is 0 MSI (c) (0C:94) [16:27:21:557]: SOFTWARE RESTRICTION POLICY: Verifying package --> 'C:\Builds\.msi' against software restriction policy MSI (c) (0C:94) [16:27:21:557]: Note: 1: 2262 2: DigitalSignature 3:
-2147287038  MSI (c) (0C:94) [16:27:21:557]: SOFTWARE RESTRICTION POLICY: C:\Builds\.msi is not digitally signed MSI (c) (0C:94) [16:27:21:558]: SOFTWARE RESTRICTION POLICY: C:\Builds.msi is permitted to run at the 'unrestricted' authorization level. MSI (c) (0C:94) [16:27:21:584]: Cloaking enabled. MSI (c) (0C:94) [16:27:21:584]: Attempting to enable all disabled privileges before calling Install on Server MSI (c) (0C:94) [16:27:21:586]: End dialog not enabled MSI (c) (0C:94) [16:27:21:586]: Original package ==> C:\Builds\....msi MSI (c) (0C:94) [16:27:21:586]: Package we're running from ==> C:\Builds\.....msi MSI (c) (0C:94) [16:27:21:589]: APPCOMPAT: Uninstall Flags override found. MSI (c) (0C:94) [16:27:21:589]: APPCOMPAT: Uninstall VersionNT override found. MSI (c) (0C:94) [16:27:21:589]: APPCOMPAT: Uninstall ServicePackLevel override found. MSI (c) (0C:94) [16:27:21:589]: APPCOMPAT: looking for appcompat database entry with ProductCode '{B8CBA92E-2140-48AB-B4EA-A4C3FF10295B}'. MSI (c) (0C:94) [16:27:21:589]: APPCOMPAT: no matching ProductCode found in database. MSI (c) (0C:94) [16:27:21:599]: MSCOREE not loaded loading copy from system32 MSI (c) (0C:94) [16:27:21:608]: Machine policy value 'DisablePatch' is 0 MSI (c) (0C:94) [16:27:21:608]: Machine policy value 'AllowLockdownPatch' is 0 MSI (c) (0C:94) [16:27:21:608]: Machine policy value 'DisableLUAPatching' is 0 MSI (c) (0C:94) [16:27:21:608]: Machine policy value 'DisableFlyWeightPatching' is 0 MSI (c) (0C:94) [16:27:21:609]: APPCOMPAT: looking for appcompat database entry with ProductCode '{}'. MSI (c) (0C:94) [16:27:21:609]: APPCOMPAT: no matching ProductCode found in database. MSI (c) (0C:94) [16:27:21:609]: Transforms are not secure. MSI (c) (0C:94) [16:27:21:609]: PROPERTY CHANGE: Adding MsiLogFileLocation property. Its value is 'C:\Builds\Angoss\Products\Workstation\single-exec\INSTALL64.LOG'. MSI (c) (0C:94) [16:27:21:609]: Command Line: CURRENTDIRECTORY=C:\Builds\Angoss\Products\Workstation\single-exec CLIENTUILEVEL=0 CLIENTPROCESSID=7948  MSI (c) (0C:94) [16:27:21:609]: PROPERTY CHANGE: Adding PackageCode property. Its value is '{}'. MSI (c) (0C:94) [16:27:21:609]: Product Code passed to Engine.Initialize:  '' MSI (c) (0C:94) [16:27:21:609]: Product Code from property table before transforms: '{}' MSI (c) (0C:94) [16:27:21:609]: Product Code from property table after transforms:  '{}' MSI (c) (0C:94) [16:27:21:609]: Product registered: entering maintenance mode MSI (c) (0C:94) [16:27:21:609]: Determined that existing product (either this product or the product being upgraded with a patch) is installed per-machine. MSI (c) (0C:94) [16:27:21:609]: PROPERTY CHANGE: Adding ProductState property. Its value is '5'. MSI (c) (0C:94) [16:27:21:609]: PROPERTY CHANGE: Adding ProductToBeRegistered property. Its value is '1'. MSI (c) (0C:94) [16:27:21:609]: Entering CMsiConfigurationManager::SetLastUsedSource. MSI (c) (0C:94) [16:27:21:609]: Specifed source is already in a list. MSI (c) (0C:94) [16:27:21:609]: User policy value 'SearchOrder' is 'nmu' MSI (c) (0C:94) [16:27:21:609]: Machine policy value 'DisableBrowse' is 0 MSI (c) (0C:94) [16:27:21:609]: Machine policy value 'AllowLockdownBrowse' is 0 MSI (c) (0C:94) [16:27:21:609]: Adding new sources is allowed. MSI (c) (0C:94) [16:27:21:609]: PROPERTY CHANGE: Adding PackagecodeChanging property. Its value is '1'. Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel.

2 个解决方案

#1


5  

This message usually appears only during development phases, not on the end-user machine. The message appears because you modify only the resources from the package and rebuild it, without increasing the version number, so Windows Installer sees there is a package with the same product code and name on the machine, but with a different package code.

此消息通常只出现在开发阶段,而不是最终用户机器上。之所以会出现此消息,是因为您只修改包中的资源并重新构建它,而不增加版本号,因此Windows安装程序会看到机器上有一个具有相同产品代码和名称的包,但是使用不同的包代码。

Your users will never get this message because I assume you will increase the version number when releasing the package. This is also based on the name of your function i.e. "CheckPreviousVersion".

您的用户永远不会收到这条消息,因为我假定您在发布包时将增加版本号。这也基于你的函数名。“CheckPreviousVersion”。

If you want a custom message to appear if you found an older version on the machine make sure you first have the old version installed, you currently have the latest version installed, but using another previously built package (i.e. different package code).

如果您希望出现自定义消息,如果您在机器上发现一个旧版本,请确保您首先安装了旧版本,您当前安装了最新版本,但是使用了另一个以前构建的包(即不同的包代码)。

#2


4  

If you´re using a BasicMSI installer, you can create a System Search which checks the following registry key:

如果你使用BasicMSI´重新安装程序,您可以创建一个系统搜索检查以下注册表项:

HKEY_LOCAL_MACHINE\SOFTWARE\(Wow6432Node)\Microsoft\Windows\CurrentVersion\Uninstall\YOURPRODUCTCODE

HKEY_LOCAL_MACHINE \微软软件\(Wow6432Node)\ \ Windows \ CurrentVersion \ Uninstall \ YOURPRODUCTCODE

If this key is available an older version of your setup is installed on the computer. Now create a Custom Action which is placed before "CheckPreviousVersion" to run your code. Set the condition for this Custom Action to the property from your System Search.

如果此密钥可用,则在计算机上安装一个较旧的安装版本。现在创建一个自定义操作,该操作放在“CheckPreviousVersion”之前,以运行代码。将此自定义操作的条件设置为系统搜索中的属性。

That should do the trick.

这应该很管用。

#1


5  

This message usually appears only during development phases, not on the end-user machine. The message appears because you modify only the resources from the package and rebuild it, without increasing the version number, so Windows Installer sees there is a package with the same product code and name on the machine, but with a different package code.

此消息通常只出现在开发阶段,而不是最终用户机器上。之所以会出现此消息,是因为您只修改包中的资源并重新构建它,而不增加版本号,因此Windows安装程序会看到机器上有一个具有相同产品代码和名称的包,但是使用不同的包代码。

Your users will never get this message because I assume you will increase the version number when releasing the package. This is also based on the name of your function i.e. "CheckPreviousVersion".

您的用户永远不会收到这条消息,因为我假定您在发布包时将增加版本号。这也基于你的函数名。“CheckPreviousVersion”。

If you want a custom message to appear if you found an older version on the machine make sure you first have the old version installed, you currently have the latest version installed, but using another previously built package (i.e. different package code).

如果您希望出现自定义消息,如果您在机器上发现一个旧版本,请确保您首先安装了旧版本,您当前安装了最新版本,但是使用了另一个以前构建的包(即不同的包代码)。

#2


4  

If you´re using a BasicMSI installer, you can create a System Search which checks the following registry key:

如果你使用BasicMSI´重新安装程序,您可以创建一个系统搜索检查以下注册表项:

HKEY_LOCAL_MACHINE\SOFTWARE\(Wow6432Node)\Microsoft\Windows\CurrentVersion\Uninstall\YOURPRODUCTCODE

HKEY_LOCAL_MACHINE \微软软件\(Wow6432Node)\ \ Windows \ CurrentVersion \ Uninstall \ YOURPRODUCTCODE

If this key is available an older version of your setup is installed on the computer. Now create a Custom Action which is placed before "CheckPreviousVersion" to run your code. Set the condition for this Custom Action to the property from your System Search.

如果此密钥可用,则在计算机上安装一个较旧的安装版本。现在创建一个自定义操作,该操作放在“CheckPreviousVersion”之前,以运行代码。将此自定义操作的条件设置为系统搜索中的属性。

That should do the trick.

这应该很管用。