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.
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.
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behaviour or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions. Cookies are used for ads personalisation.
Functional
Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
2nd January 2017 at 20:58
Hi, did you post somewhere the [Run] part of the Inno Script?
3rd January 2017 at 13:39
Hello,
You can find an example here:
https://github.com/Belphemur/SoundSwitch/blob/dev/Installer/scripts/products/vcredist2015.iss
I’m using a full framework to check and download dependencies.
11th January 2018 at 15:57
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.
11th January 2018 at 16:03
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.
11th January 2018 at 16:25
Yes. I have checked with a 32-bit Windows (with regedt32 and with my setup program).
11th January 2018 at 16:29
Great !
As soon as github is back online, I’ll fix the code.
Thank you for the correction !