对 .NET Windows 安装程序应用程序执行注册表搜索 [英] Performing registry search for a .NET windows installer application

查看:31
本文介绍了对 .NET Windows 安装程序应用程序执行注册表搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 .NET winform 安装程序.在安装之前,我正在执行注册表搜索以检查计算机上是否安装了 MS Access Runtime.

I have a .NET winform installer application. Before installing, I'm doing a registry search to check if MS Access Runtime is installed on the machine.

搜索目标机器

搜索目标机器的属性

启动条件

启动条件的属性

但是我想避免在启动条件的属性中硬编码像 "C:\Program Files\Microsoft Office\Office15\" 这样的路径.到目前为止,我已经尝试过 "[ProgramFilesFolder]\Microsoft Office\Office15\", "%ProgramFiles%\Microsoft Office\Office15\" 但两个选项都不起作用.

However i want to avoid hard coding the path like "C:\Program Files\Microsoft Office\Office15\" in the properties of launch condition. So far i have tried "[ProgramFilesFolder]\Microsoft Office\Office15\", "%ProgramFiles%\Microsoft Office\Office15\" but both the options are not working.

推荐答案

正确的注册表搜索:尝试搜索注册表的正确 32 位部分:SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths\MSACCESS.EXE

关键是在字符串的开头包含 Wow6432Node.

Crucial is the inclusion of Wow6432Node towards the beginning of the string.

<小时>

自定义操作:这不是公认的最佳实践,但我喜欢使用自定义操作来检查系统 (我不不喜欢他们进行系统更新).检查自定义操作是只读的,不需要任何回滚,对系统没有危险,您可以相对安全地抑制错误.


Custom Action: It is not accepted best practice, but I like to use custom actions to inspect the system (I don't like them for making system updates). Inspection custom actions are read-only, do not require any rollback, are not dangerous to the system and you can relatively safely suppress errors.

我喜欢检查自定义操作的原因是,如果系统检查要求变得更加复杂,您将拥有充分的灵活性.我发现 AppSearch 有时会变得非常混乱.自定义操作不适用于 Visual Studio 安装程序项目.

The reason I like inspection custom actions is that you have full flexibility if system inspection requirements get more complicated. I find AppSearch gets very confusing at times. Custom actions are not easy to use with Visual Studio Installer Projects.

Bitness:我不经常使用App Search,但这是一台真正的 32 位机器吗?(非常复古)还是带有 32 位组件的 64 位机器?如果是后者,这里提醒一下注册表和磁盘中依赖于核心位数的路径:

注册:

  • 64 位:HKEY_LOCAL_MACHINE\SOFTWARE
  • 32 位:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node

磁盘:

  • 64 位:C:\Program Files\
  • 32 位:C:\Program Files (x86)\
  • 64 位:C:\Windows\System32\ -(是的,真的)立>
  • 32 位:C:\Windows\SysWOW64\ -(是的,真的)立>

链接:

  • App Search - registry locations

这篇关于对 .NET Windows 安装程序应用程序执行注册表搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆