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:
- 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
, andHKLM\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VC
. - Use WMI/check system tables using
wmic product get
ornew 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:
Or 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?