Wix Bootstrapper RegistrySearch未找到值

huangapple go评论60阅读模式
英文:

Wix Bootstrapper RegistrySearch NOT finding value

问题

我试图在我的引导程序捆绑包文件中搜索注册表,以检查程序是否首次安装,然后进行第二次搜索以检查已安装程序的位数

然后,我想使用返回的值来安装程序的32位或64位驱动程序

问题在于当我在命令提示符中运行以下命令创建日志文件时:Bootstrapper.exe -l "c:\temp\LogFileName.log",我得到了这行:

[52BC:4F84][2023-05-17T12:59:37]i000: 未找到注册表值。键 = 'SOFTWARE\[COMPANY_NAME]\',值 = 'Bitness'

我在注册表编辑器中添加了Bitness作为字符串值,并将值设置为64,因为该程序确实是64位的。

这是我的注册表搜索:

<!-- 检查程序是否已安装 -->
<util:RegistrySearch Id="CheckProgramInstalled"
                    Root="HKLM"
                    Key="SOFTWARE\[COMPANY_NAME]\[PRODUCTNAME]"
                    Result="exists"
                    Variable="ProgramInstalled" />

<!-- 检查程序的位数 -->
<util:RegistrySearch Id="CheckProgramBitness"
                    After="CheckProgramInstalled"
                    Root="HKLM"
                    Key="SOFTWARE\[COMPANY_NAME]\[PRODUCTNAME]"
                    Value="Bitness"
                    Result="value"
                    Variable="ProgramBitness" />
英文:

I'm trying to search the registry in my Bootstrapper Bundle file to check if a program is firstly installed and a second search to check the bitness of the program installed.

Then I want to use the values returned to either install a 32bit or 64bit driver for the program.

The issue is that in the log file created when I run this in cmd: Bootstrapper.exe -l "c:\temp\LogFileName.log", I get this line:

[52BC:4F84][2023-05-17T12:59:37]i000: Registry value not found. Key = &#39;SOFTWARE\[COMPANY_NAME]\&#39;, Value = &#39;Bitness&#39;

I added Bitness as a string value into the registry editor and put the value as 64 as the program is indeed 64bit.

These are my registry searches:

&lt;!-- Check if program is installed --&gt;  
&lt;util:RegistrySearch Id=&quot;CheckProgramInstalled&quot;
					    Root=&quot;HKLM&quot;
	                    Key=&quot;SOFTWARE\[COMPANY_NAME]\[PRODUCTNAME]&quot;
	                    Result=&quot;exists&quot;
	                    Variable=&quot;ProgramInstalled&quot; /&gt;
&lt;!-- Check bitness of the program --&gt;   
&lt;util:RegistrySearch Id=&quot;CheckProgramBitness&quot;
						After=&quot;CheckProgramInstalled&quot;
						Root=&quot;HKLM&quot;
	                    Key=&quot;SOFTWARE\[COMPANY_NAME]\[PRODUCTNAME]&quot;
						Value=&quot;Bitness&quot;
	                    Result=&quot;value&quot;
	                    Variable=&quot;ProgramBitness&quot; /&gt;

答案1

得分: 1

这里似乎有至少两个单独的问题。

无法识别/空属性

您的注册表搜索包括此键:

> 键="SOFTWARE\[COMPANY_NAME]\[PRODUCTNAME]"

但错误消息报告的键如下:

> 键 = 'SOFTWARE\[COMPANY_NAME]\'

这表明:

  1. [COMPANY_NAME] 属性无法识别(您确定下划线是正确的吗?);
  2. [PRODUCTNAME] 属性为空。

您可以检查这些属性是否被正确设置,或考虑使用 WiX 变量代替 - 此文章 可能会有帮助。

位数特定的注册表视图

默认情况下,&lt;util:RegistrySearch&gt; 搜索32位注册表视图。这在您的情况下很关键,因为如果您安装了64位应用程序,那么您的注册表搜索将无法找到相关的键。有关注册表重定向的更多信息,请参阅此 Microsoft 文章

要搜索64位注册表视图,您需要设置 Win64=&quot;yes&quot;。请查看这里这里的已接受答案和评论。

英文:

It looks like there are at least two separate issues here.

Unrecognised / empty properties

Your registry search includes this key:

> Key="SOFTWARE\[COMPANY_NAME]\[PRODUCTNAME]"

but the error message reports the key like this:

> Key = 'SOFTWARE\[COMPANY_NAME]\'

This suggests:

  1. the [COMPANY_NAME] property is not recognised (are you sure the underscore is correct?);
  2. the [PRODUCTNAME] property is empty.

You could check whether these properties are being set correctly, or consider using WiX variables instead - this article might help.

Bitness-specific registry views

By default, &lt;util:RegistrySearch&gt; searches the 32-bit registry view. This is critical in your case because if you have the 64-bit application installed then your registry search won't find the relevant keys. For more information on registry redirection, see this Microsoft article.

To search the 64-bit registry view, you will need to set Win64=&quot;yes&quot;. See the accepted answers and comments here and here.

huangapple
  • 本文由 发表于 2023年5月17日 21:29:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/76272667.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定