HOW TO: Detect if the Visual C++ 2010 redistributable package is installed with WiX
As noted by Aaron Stebner, there is now a registry key you can search for to detect if the Visual C++ 2010 redistributable package is installed a machine, when installing your application.
There are 3 different (but very similar) registry keys for each of the 3 platform packages. Each key has a
DWORD value called
Installed with a value of
Here's an example of using this in WiX, detecting the presence of the x86 version of the redistributable:
<?xml version="1.0" encoding="utf-8"?> <Include> <!-- Visual C++ 2010 x86 --> <Property Id="HASVCPP2010"> <RegistrySearch Id="HasVCPP2010Search" Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio10.0\VC\VCRedistx86" Name="Installed" Type="raw" /> </Property> <Condition Message="This application requires Microsoft Visual C++ 2010 Redistributable Package (x86).">Installed OR (HASVCPP2010)</Condition> </Include>
When someone runs your installer and they don’t have this package installed, they will get something like this message box when the installer initializes:
It’s a good idea to have a setup bootstrapper that automatically installs this package if it’s missing, but this WiX snippet is a good safe-guard for if someone directly runs your MSI.