Aaron Stebner's WebLog

Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio

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

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

Rate This
  • Comments 68

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

<update date="4/12/2011"> Added product codes for Visual C++ 2010 SP1 redistributable packages. </update>

 

  • I have VS2010 installed, but I don't have these registry keys on my machine.

  • Hi Martin - These keys are installed by the Visual C++ redistributable package, not by Visual Studio.  Can you please double-check that you have the Visual C++ redistributable package installed in your scenario?

  • Hi Aaron, been through quite a few kb, msdn, technet, etc. articles trying to get a handle on managing runtime component dependencies for a couple of 3rd party components we OEM'd and integrated in our .Net app and finally came across your posts for the 2005, 2008 and now this 2010 redist info - thank you, thank you, thank you!  Don't know why I couldn't find similar at MS but again - ty!

  • What is infurating is that this runtime should simply be part of Windows 7.  Way too many things need it.  It's just silly not to have it pre-installed or at the very least it should be part of the pre-reqs for ONE-CLICK installs.

  • I have a quick question:

    Do Visual Studio 2010 installation deploy Visual C++ 2010 runtime files even if Visual C++ component of installation is disabled?

  • Hi Igor - Yes, Visual Studio 2010 setup still installs the VC++ 2010 runtime files even if you uncheck the Visual C++ component during VS setup.  The VC++ runtime files are needed by several parts of Visual Studio, not just the Visual C++ design-time components.  VS setup also installs copies of the VC++ runtime files installers for use as prerequisites if you build installers within Visual Studio for your applications.

  • i check the registry editor in window 2007 server@Enterprise

    for Visual C++ 2010 Redistributable Package (x64)

    the right directory is below:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\VC\VCRedist\x64]

    Installed = 1 (REG_DWORD)

    can you do a check?

  • Hi Jordan from China - Yes, that registry key looks like the correct one to check for the 64-bit VC++ 2010 Redistributable.

  • From what I understand VC++ 2010 Redist is supported in 10 different langauges. Is there a way from registry to figure out which language of VC++ 2010 Redist is installed?

  • Hi RN - The VC++ Redistributable is a multi-language package that displays setup UI in the language of your OS when you run it.  The underlying MSI and files that are installed are the same for all languages.  You shouldn't need to detect anything language-specific for this package, and instead can just detect whether it is installed or not in a language-neutral way.

  • Since Visual Studio 2010 installs a version of the VC 10.0 runtime, what would we check for in this instance?  We do not need to install the redistributable since Visual Studio installed a version of it.  Would it be sufficient to check for both VS 2010 and the Runtime listed in ...\VisualStudio\10.0\VC\VCRedist\?  Or in this instance, should we still be installing the redistributable?

    Thank you.

  • Hi Robert - Visual Studio 2010 installs a sub-set of the VC++ 2010 Redistributable, not the full package.  You should not check for that sub-set package, and instead should check for and install the full redistributable in your scenarios.

  • Thank you for your response and for the rest of your blog.  It is very helpful.

  • Does anyone have the full list of Visual C++ 2010 SP1 redistributable package product codes?

    x86 appears to be {F0C3E5D1-1ADE-321E-8167-68EF0DE699A5}, but it would be nice to have someone else validate that (and also get the x64/ia64 codes)

    [my apologies if this posts multiple times, something weird is going on with my machine...]

  • Hi CMC - Here are the SP1 product codes.  I'll also update the table in the main blog post with this information.

    Visual C++ 2010 SP1 Redistributable (x86) - {F0C3E5D1-1ADE-321E-8167-68EF0DE699A5}

    Visual C++ 2010 SP1 Redistributable (x64) - {1D8E6291-B0D5-35EC-8441-6616F567A0F7}

    Visual C++ 2010 SP1 Redistributable (ia64) - {88C73C1C-2DE5-3B01-AFB8-B46EF4AB41CD}

Page 1 of 5 (68 items) 12345
Leave a Comment
  • Please add 1 and 5 and type the answer here:
  • Post