【问题标题】:How to quickly yet reliably determine if Visual C++ 2013 Runtime is installed [duplicate]如何快速而可靠地确定是否安装了 Visual C++ 2013 Runtime [重复]
【发布时间】:2015-12-09 00:49:11
【问题描述】:

我正在尝试让我的应用程序确定 Microsoft Visual C++ 2013 Redistributable 是否已安装在用户的系统上。我查看了hereherehere 的答案,但看起来所有答案都分为两大类:

  1. 检查注册表:这不是一个选项,因为如果安装了 Visual Studio 或 Visual C++ 已被删除,您会得到误报。 HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\UninstallHKLM\SOFTWARE\Microsoft\VisualStudio\12.0\VCHKLM\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VC 就是这种情况。
  2. 使用 WMI/检查系统表 使用 wmic product getnew ManagementObjectSearcher("SELECT * FROM Win32_Product")。这是可靠的,但非常慢(40 多秒),因为它看起来必须在返回结果之前加载系统上安装的所有产品。

当可再发行安装程序运行时,安装程​​序能够非常快速地确定组件是否已经安装:

或未安装:

仍然可靠的最快方法是什么?理想情况下,我想知道:Microsoft 是如何做到这么快的?我可以那样做吗?

【问题讨论】:

  • 你可以使用合并模块吗?
  • @DanielA.White 我不熟悉合并模块,但我对它们做了一些简要研究,看起来它们只适用于 .msi 文件,但应用程序是 .exe 文件.有没有办法处理我错过的 .exe 文件?

标签: c# .net windows


【解决方案1】:

As has now been explained in the answer to another question,还有更可靠的注册表值可以使用:

Microsoft Visual C++ 2013 Redistributable (x64)
Registry Key: HKLM\SOFTWARE\Classes\Installer\Dependencies\{050d4fc8-5d48-4b8f-8972-47c82c46020f} 
Configuration: x64
Version: 12.0.30501.0

Microsoft Visual C++ 2013 Redistributable (x86)
Registry Key: HKLM\SOFTWARE\Classes\Installer\Dependencies\{f65db027-aff3-4070-886a-0d87064aabb1} 
Configuration: x86
Version: 12.0.30501.0

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-21
    • 2016-11-28
    • 1970-01-01
    相关资源
    最近更新 更多