2

I'm trying to have my application determine whether or not Microsoft Visual C++ 2013 Redistributable has been installed on the user's system. I've looked through answers here, here, and here, but it looks like all of the answers fall into two major categories:

  1. Check the registry: This is not an option because, if Visual Studio is installed or Visual C++ has been removed, you get false positives. This is the case for HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM\SOFTWARE\Microsoft\VisualStudio\12.0\VC, and HKLM\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VC.
  2. Use WMI/check system tables using wmic product get or new ManagementObjectSearcher("SELECT * FROM Win32_Product"). This is reliable, but very slow (40+ sec), since it looks like it has to load all products installed on the system before it returns results.

When the redistributable installer is run, the installer is very quickly able to determine whether or not the component is already installed:

Already installed

Or not installed:

Not installed

What's the quickest way to do this that is still reliable? Ideally, I'd like to know: how does Microsoft do it so quickly? And can I do it that way?

Community
  • 1
  • 1
A N
  • 276
  • 5
  • 18
  • 1
    can you use a merge module? – Daniel A. White Dec 09 '15 at 01:08
  • @DanielA.White I'm not familiar with merge modules, but I did some brief research on them, and it looks like they only work for .msi file, but the application is a .exe file. Is there a way to do it with .exe files that I've missed? – A N Dec 10 '15 at 15:43

1 Answers1

5

As has now been explained in the answer to another question, there are more reliable registry values that can be used:

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
Community
  • 1
  • 1
A N
  • 276
  • 5
  • 18