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++ 9.0 runtime redistributable package

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

Rate This
  • Comments 33


I saw a couple of previous blog posts that you wrote about how to detect the presence of the Visual C++ 2005 runtime files and the Visual C++ 2005 SP1 runtime files.  I am creating an installer that requires the Visual C++ 2008 runtime files.  How can I detect the presence of the Visual C++ 2008 and 2008 SP1 runtime files?


Like in the Visual C++ 2005 runtime files, there is not a specific detection mechanism designed and built into the Visual C++ 2008 runtime files installers.  You can use an algorithm like the one I described in my previous blog posts to detect the presence of the Visual C++ 2008 runtime files products 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++ 2008 runtime files

Visual C++ 2008 SP1 runtime files

Visual C++ 2008 SP1 ATL Security Update runtime files

Visual C++ 2008 SP1 MFC Security Update runtime files

<update date="11/19/2009"> Added information about the Visual C++ 2008 SP1 ATL Security Update product codes. </update>

<update date="11/7/2011"> Added information about the Visual C++ 2008 SP1 MFC Security Update product codes. </update>

  • Question: You previously posted a list of command line switches to perform silent and unattended installations

  • I tried the following command line to install silently:

    Vcredist_x86.exe /q

    But it does not supress UI. :(

    Can you post command lines used to install silently the Visual Studio 2008 SP1 release of the VC 9.0 redistributable packages?

  • Hi Sangeeta - I'm sorry, but I'm not able to reproduce what you describe.  I downloaded the VC++ 2008 SP1 redistributable from http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2, then ran vcredist_x86.exe /q and it installed successfully with no UI displayed.

    What exact UI screens do you see in this scenario?  Do you have any logs named %temp%\dd_vcredist*.txt that might help explain why it is not running in silent mode on your system?

  • Hi Astenber -Thanks for the quick response. Let me quickly explain you the scenario.

    I am launching VC++ 2008 SP1 executable through an application and not through command line.

    For the previous version of the vcredist i.e. 2005 SP,I used to pass following command line and it used to work fine.

    szSwitches=L"/q:a /c:\"VCREDI~3.EXE /q:a /c:\"\"msiexec /i vcredist.msi /qn\"\" \"";

    The above command line is mentioned by you in one of the blog :) and it is meant for the extracted executable and not for the vcredist_x86.exe bootstrapper.

    Do you know the similar command line for VC++ 2008 SP1 that we pass to msiexec for the extracted executable?

  • Hi Sangeeta - I posted silent install instructions for the VC++ 2008 and VC++ 2008 SP1 runtime redistributable packages at http://blogs.msdn.com/astebner/archive/2009/03/26/9513328.aspx.  You only need to use /q and you don't need to run msiexec like you did in the VC++ 2005 redistributable.

  • Thanks Aaron!I will try using /q.

  • For who might be interested, these are the product codes for VS2008 SP1 with ATL security updates (9.0.30729.4148):

    x86: {1F1C2DFC-2D24-3E06-BCB8-725134ADF989}

    x64: {4B6C7001-C7D6-3710-913E-5BC23FCE91E6}

    ia64: {977AD349-C2A8-39DD-9273-285C08987C7B}

  • Hi Kmat - Thank you for adding this information.  I will update the main blog post soon as well to hopefully make these product codes easier for folks to search for and find in the future.

  • I see a number of comments suggesting to use a series of product codes to detect the VC2008 runtime.  But Microsoft is always coming out with new versions (service packs and security updates).  Suppose I check for all these GUIDs in my installer, but then Microsoft comes out with a new update and an end-user has previously installed only that new version.  My older installer would fail to recognize this new version and try to install an older version of VC2008 runtime which probably has security holes.  What's the best way of dealing with this scenario?  Is it better to somehow detect newer, as-of-yet unreleased versions of the runtime (perhaps using the upgrade code of the MSI) and not install anything?  Or is it better to force installation of the older version of the runtime (which would happen with the currently-described detection algorithm)?

  • Hi JJInnSoft - Most of the cases I've seen in the past where an installer includes the VC++ redistributable, the application requires that exact version of the VC++ runtime files.  In those cases, it is best to install that version, even if other versions are already on the system.  There are other options for managing the VC++ runtime file dependency in your application as well (statically linking, deploying the DLLs application-local, etc).  These options all have pros and cons, so you have to evaluate them and decide what makes the most sense for your scenario.  I wrote about some of the options and include links with additional information for you to look at to help make this decision in the blog post at http://blogs.msdn.com/astebner/archive/2007/01/09/problems-with-custom-actions-that-depend-on-the-visual-c-8-0-runtime-files-on-windows-vista.aspx.  There are also some helpful posts on this topic on Nikola Dudar's blog at http://blogs.msdn.com/nikolad/archive/tags/VC_2B002B00_+Libraries+Deployment/default.aspx.

  • I did some further investigation by opening the various runtime available runtime downloads in Orca and found the following:

    * Upgrade code for C++ 2008 redistributable for RTM, SP1, and ATL security update are all {AA783A14-A7A3-3D33-95F0-9A351D530011}.  They have unique product codes as noted in the original blog post.

    * Upgrade code for C++ 2005 redistributable for RTM and ATL security update versions are both {86C9D5AA-F00C-4921-B3F2-C60AF92E2844}.  I did not check the other versions (e.g. SP1) but I assume they have the same upgrade code too.  They also have unique product codes as noted in a different blog post.

    Is it same to assume that these upgrade codes are unique for the major versions of the runtime?  (I.e. future service packs and patches to VC2008 would have the same upgrade code I found, but the Visual C++ 2010 version will have a new upgrade code).

    This seems like the more appropriate method in my scenario, because my application should work with any installed version of the 2008 runtime (so says my manifest) and it's trivial to implement the check in WiX with the Upgrade and Condition elements (the bootloader would use MsiEnumRelatedProducts to implement the same check and run vcredist if none found).

  • Hi JJInnSoft - I believe it is safe to assume that the UpgradeCode will be the same for any service pack or security release within the same family of the VC++ redistributable (all of the 2005 versions will be the same, all of the 2008 versions will be the same, all of the 2010 versions will be the same).  Unfortunately, I don't see that officially documented anywhere, so there is some slight risk that it could change for some reason in a future servicing release.

    Overall, I think it is fine for you to use Upgrade + Condition checks in your installer like you describe above, but you should also plan to do some type of regression test pass in the future if/when new service packs or security fixes are released for the version of the VC++ redistributable that your product depends on.

  • I realize no one has posted on this in a while but I'm curious is there is a /norestart switch for the C++ 2008 redist? Does /norestart work or is there some other switch that needs to be used.

  • Hi James - It doesn't look like the /norestart switch is supported for the VC++ 2008 redistributable.  Instead, you would need to use a 2 step approach:

    1.  Extract the package by running vcredist_x86.exe /x:c:\vc2008redist /q

    Note - you can change the path c:\vc2008redist to whatever folder you want

    2.  Run the MSI directly by runnning msiexec /i c:\vs2008redist\vc_red.msi /q REBOOT=ReallySuppress

  • To double check the product codes I installed the Visual C++ runtimes downloaded from Microsoft, one at a time in English and German. I found out that the product codes differ for localized versions of the redistributables for VC++ 2008.

    * Visual C++ 2008 Redistributable Package (x86):

     German: {09298F26-A95C-31E2-9D95-2C60F586F075}

     English: {FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}

    * Visual C++ 2008 SP1 Redistributable Package (x86):

     German: {6AFCA4E1-9B78-3640-8F72-A7BF33448200}

     English: {9A25302D-30C0-39D9-BD6F-21E6EC160475}

    (I did not check X64 so far)

    For VC++ 2005 and VC++ 2010 the product codes seem to be the same for all languages, according to my evaluation, but I am not sure because I just checked German and English.

    This is a massive problem when detecting an installed Visual C++ 2008 runtime in an application that runs on non English systems. In case the application checks for the product code of the English runtimes, but a Spanish runtime is installed for example, the check would fail.

Page 1 of 3 (33 items) 123
Leave a Comment
  • Please add 8 and 7 and type the answer here:
  • Post