How to detect the presence of the Visual C++ 2010 redistributable package

Question:

I have seen your previous blog posts that describe how to detect the presence of the Visual C++ 2005 redistributable package and the Visual C++ 2008 redistributable package.  I am creating an installer that requires the Visual C++ 2010 runtime files.  How can I detect the presence of the Visual C++ 2010 redistributable package?

Answer:

Unlike the Visual C++ 2005 and 2008 redistributable packages, there are registry keys that can be used to detect the presence of the Visual C++ 2010 redistributable package.

Visual C++ 2010 redistributable package detection registry values

 

 

 

Alternatively, like in past releases of the Visual C++ redistributable package, you can use an algorithm like the one I described in my previous blog posts to detect the presence of the Visual C++ 2010 redistributable package on a system:

  1. Call the MsiQueryProductState API
  2. Pass in the product code for the package that you want to detect based on the list below
  3. Check the return value of this API.  If it is anything other than INSTALLSTATE_DEFAULT, the package is not yet installed

Visual C++ 2010 redistributable package product codes

Visual C++ 2010 SP1 redistributable package product codes

 

PS:if you can not find the regist following these steps,then you can try this

 

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\VC\Runtimes\x86 on 64-bit systems. In code that would result in accessing registry keyHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\VC\Runtimes\x86. Notice the absence of Wow6432Node.

On a 32-bit system the registry is the same without Wow6432Node:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\VC\Runtimes\x86

你可能感兴趣的:(package)