Detect version of VC Redist in Inno Setup

For SoundSwitch, I needed to fix a bug where the installer wasn’t detecting correctly the version of VC Redist C++ installed.

As I found on Stack Overflow, each version has it’s own MSI key in the registry, but this is impossible to use since at each update of the VC Redist you need to find the new registry key and check for it.

However, I found this excellent post explaining where in the registry you can find if the wanted version is installed. The best part, the build is also present at the key given.

With that information at hand, I had all I needed to future proof my installer, and I’m happy to share with you the script I wrote for Inno Setup.

Antoine Aflalo Written by:

7 Comments

  1. M Rea
    2nd January 2017
    Reply

    Hi, did you post somewhere the [Run] part of the Inno Script?

  2. Patrice Poulain
    11th January 2018
    Reply

    Hello,
    Very useful.
    The regkeys when IsX64() is false seem false here.
    I replace
    \VC\VCRedist\x86
    by
    \VC\Runtimes\x86
    in the first case and by
    \RuntimeAdditional in the second case.

    Regards.

    • Antoine Aflalo
      11th January 2018
      Reply

      Hello Patrice,

      Are you sure about the x86 version ?

      I admit, I don’t have a 32Bit Windows (since a long time) and haven’t been able to try it. Only based it on previous found code.

      If you can confirm me that you have tested it on 32 bits, I’ll glady change those regkeys.

  3. Patrice Poulain
    11th January 2018
    Reply

    Yes. I have checked with a 32-bit Windows (with regedt32 and with my setup program).

    • Antoine Aflalo
      11th January 2018
      Reply

      Great !

      As soon as github is back online, I’ll fix the code.

      Thank you for the correction !

Leave a Reply

Your email address will not be published. Required fields are marked *