How to check if I need to install VCRedist?
Asked Answered
C

2

7

My program contains several dlls which depend on MSVCP100.dll and MSVCR100.dll, in Win7 my program runs without any problem, however in Win8 it failed to locate these two dlls. I notice that in Win8 there is no VCRedist installed by default, so apparently I need to install the VCRedist to enable my program.

The question is, how do I check if the VCRedist is installed?

Looks like we can do it by searching in registry [1] [2]. However, it seems there are many versions of VCRedist(VC2012,2010,2008,2005...), so I need to go through all these registry keys?

Collencollenchyma answered 28/9, 2012 at 9:4 Comment(0)
L
3

If you just run installer of VCRedist (which you should ship with your program, anyway), it will do the job for you. Games "try" to install DirectX the same way.

Lowis answered 28/9, 2012 at 10:14 Comment(1)
this is not an ideal scenario (poor UX) but it's the most defensive.Tolland
E
12

Since your DLLs depend on MSVCR100.dll, you'll want to find VCRedist for VC 2010.

The number after 'MSVCR' or 'MSVCP' is the internal version of Visual Studio x10 - http://en.wikipedia.org/wiki/Microsoft_Visual_Studio#Version_history lists the values for the various versions.

For Visual Studio 2010 you can detect if the runtime is already installed by checking the "Installed" value of HKLM\SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x86 for 32-bit applications/DLLs and HKLM\SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x64 for 64-bit applications/DLLs.

For Visual Studio 2010 and previous versions, http://blogs.msdn.com/b/astebner/archive/2010/05/05/10008146.aspx has a good explanation of methods for detecting if the runtime is installed.

With Visual Studio 2012 things have changed and the VCRedist key no longer exists. Instead you may look at the Installed value of the reg key (for 32-bit applications) Software\Microsoft\VisualStudio\11.0\VC\Runtimes\x86

Externality answered 29/1, 2013 at 0:46 Comment(2)
This is not suitable if you try to check in a machine without Visual StudioRaven
yes, what if the vs is not installed but vsredist are installed? @bcranWindgall
L
3

If you just run installer of VCRedist (which you should ship with your program, anyway), it will do the job for you. Games "try" to install DirectX the same way.

Lowis answered 28/9, 2012 at 10:14 Comment(1)
this is not an ideal scenario (poor UX) but it's the most defensive.Tolland

© 2022 - 2024 — McMap. All rights reserved.