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 58


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?


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>


  • Much appreciated!

  • Hi Aaron,

    Is the Visual C++ 2010 SP1 Redistributable also suited for applications developed in Visual Studio 2010 without SP1?

    So is it enough to install the Visual C++ 2010 SP1 Redistributable or should we install both the Visual C++ 2010 Redistributable and the Visual C++ 2010 SP1 Redistributable on target systems?

  • Hi Ton Grommen - The installer for the Visual C++ 2010 SP1 Redistributable will automatically upgrade the original Visual C++ 2010 Redistributable if it was previously installed on your computer, so you won't be able to install both of them on the same computer.  You should be able to use the SP1 redistributable to run applications created by VS 2010 with or without VS 2010 SP1.

  • Hi Aaron,

    Thanks for the provided information!

    How do you consider the point that only one VCRedist 2010 package can be installed at the same time (nomore SxS like previous VCRedists) ? For the approach using the Reg keys this doesn't distinguish between RTM and SP1 (SP2...). The approach using MsiQueryProductState API cannot be used when e.g. a SP2 is installed and we want to install a SP1 as we (right now) don't know the Product Code.

    For me I did an approach with FindRelatedProducts and query the product version based on a given Upgrade Code. The WiX code fragment to illustrating that approach is like following (sets property VC2010SP1REDIST_X86 if VCredist 2010 x86 SP1 is installed):

     <Upgrade Id='{1F4F1D2A-D9DA-32CF-9909-48485DA06DD5}'>







    Best regards,


  • Hi Tobias S - Thanks for posting this information.  I agree that this approach of using the UpgradeCode and the FindRelatedProducts action makes sense for the VC++ 2010 Redistributable.

  • Can this be detected by file location?

  • Hi John F - If you wanted to, you could check the versions of the VC++ runtime files in the %windir%\system32 directory on a computer to see if they are installed.  If you do this, you should make sure that the files exist and have version number 10.0.30319 or higher.

  • just one question. you are saying the registry keys are created when you install the redist or runtime and not when VS 2010 is installed. so, when you uninstall the redist or runtime, will those keys be removed? or just the status of the Install subkey be moved back to 0 instead of 1

    thanks much

  • Hi Veeru - The Installed registry value will be removed when the VC++ redistributable is uninstalled.

  • Hello, I believe there's a third incarnation of VC++ 2010 runtime: 6A86554B-8928-30E4-A53C-D7337689134D, it's version 10.00.30319 (you have keys for versions 10.00.20506.1 (original) and 10.00.40219 (SP1). Not sure how much different it is.

  • We are running various applications that need different versions of VC++ 2010 runtime. Do you have the keys for version 9.0.30729.6161, v10.0.303191 and  v10.0.303 for both x64 and x86?

  • Hi Vinny - Unlike previous versions of the VC++ Redistributable, updates for the VC++ 2010 Redistributable are delivered as patches instead of new releases of the MSI.  That means that the product code is the same as the original product, and that also means that you cannot use only the product code to determine whether or not an update is installed.

    If you need to be able to detect the installation state of VC++ 2010 Redistributable updates, you can use registry keys like the following:



    In the above key name, the ProductName will be different for each version and processor architecture of the VC++ 2010 Redistributable.  For example, in the VC++ 2010 SP1 x64 Redistributable, it will be Microsoft Visual C++ 2010  x64 Redistributable - 10.0.40219.

    Also, in the above key name, the KB number will be different for each update.

    Overall, my recommendation for the VC++ redistributable packages is to not bother to try to detect if the package is already installed.  Instead, I recommend that you always install them during your installation process.  In the worst case, it will already be installed and it will trigger a repair.  The reason I recommend this is that I've seen enough cases in the past where the detection logic wasn't reliable and/or changed in future service packs, and that ended up causing problems for setup programs that tried to detect the install state.

    You also asked about a 9.0 version of the VC++ Redistributable.  That is the VC++ 2008 Redistributable, and I've got a separate blog post about that version.  You can find it at blogs.msdn.com/.../9384143.aspx.


    ' Tells you if Visual C++ 2010 Runtime is installed

    Public Function IsVisualCPP10RedistributableInstalled() As Boolean

           Dim ret As Boolean = False

           Dim Check1 As Object = Nothing

           Dim Check2 As Object = Nothing


               If IntPtr.Size = 8 Then

                   ' I'm Running as a 64-bit application

                   Check1 = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x64", "Installed", Nothing)

                   Check2 = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\VC\VCRedist\x64", "Installed", Nothing)

                   If Check1 Is Nothing Then Check1 = CInt("0")

                   If Check2 Is Nothing Then Check2 = CInt("0")

                   If (CInt(Check1) = 1) Or (CInt(Check2) = 1) Then

                       ret = True

                   End If


                   ' I'm Running as a 32-bit application

                   Check1 = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x86", "Installed", Nothing)

                   Check2 = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\VC\VCRedist\x86", "Installed", Nothing)

                   If Check1 Is Nothing Then Check1 = CInt("0")

                   If Check2 Is Nothing Then Check2 = CInt("0")

                   If (CInt(Check1) = 1) Or (CInt(Check2) = 1) Then

                       ret = True

                   End If

               End If

           Catch ex As Exception

               ret = False

           End Try

           Return ret

       End Function

  • I'm having an issue while scanning a Windows Server 2003 x86 and detects the following vulnerability in reference to Microsoft Foundation Class (mfc100.dll) FOR Visual C++ 2010. It is detecting the wrong version 10.0.40219.325 and it should be 10.0.40219.1. I do see Visual C++ 2008 Redistributable Package for mfc90 VERSION 9.030729.6161. I do not see anything that indicates Visual C++ 2010 Redistributable Package 1, but I do see Microsoft Visual C++ x86 Runtime 10.0.40219 which is not version number the security software is expecting. Any ideas?

  • Hi Mjocasio23 - I'm not sure I understand your scenario.  Version 40219.325 is a higher version than 40219.1, so it sounds like the updated version of that file is already installed.  Is your scanning software telling you that you still need to install a patch when it is already installed?  If so, what exact scanning software are you using?

Page 2 of 4 (58 items) 1234
Leave a Comment
  • Please add 5 and 2 and type the answer here:
  • Post