Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect if Visual C++ 2017 Redistributable is installed

With Microsoft changing the pattern of registry entries in its latest versions, how do i detect if Visual C++ 2017 Redistributable is installed on a machine?

My aim is to install VC++2015Redist since the software is written using VS2015. If i can successfully detect VC++2017Redist on a machine, then I skip my installation of VC++2015Redist

like image 384
Manjunath Avatar asked Sep 12 '17 14:09

Manjunath


People also ask

How do I know if Microsoft Visual is installed?

Click Start > Control Panel > Programs and Features. Verify that Microsoft Visual C++ 2005 Redistributable appears in the list of installed programs.

How do I know if I have Visual Studio C++?

Open Add and Remove Programs and look for Microsoft Visual C++ Redistributable. The installed versions will be listed there.

Where is Visual C++ redistributable installed?

In the latest version of Visual Studio 2019, you'll find the redistributable files in the %VCINSTALLDIR%Redist\MSVC\v142 folder. In both Visual Studio 2017 and Visual Studio 2019, they're also found in %VCToolsRedistDir% .

How do I know if I have Microsoft Visual C++ redistributable for Visual Studio 2019?

The Redistributable is available in the my.visualstudio.com Downloads section as Visual C++ Redistributable for Visual Studio 2019 - Version 16.7. Use the Search box to find this version.


1 Answers

The 2017 VC++ Redistributable installation upgrades/REPLACES the 2015 installation

Installation of the Visual Studio 2017 Redistributables upgrades and replaces any existing installation of the 2015 Redistributables. I've checked this, and the 2015 installation disappears from "Add/Remove Programs", and the registry values (see below) have their version numbers updated. Further, per MSDN, the 2017 VC++ Redistributables have Binary Compatibility with the 2015 version.

It's possible to check whether 2015 or 2017 are installed by checking the registry keys described below. This is for a x64 system, have a look without the Wow6432Node for a 32-bit system.

Keys:

For 64-bit VC++ Redistributable

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x64

For 32-bit VC++ Redistributable

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x86

The properties and values are the same (same format) for both 32- and 64-bit installations. Registry Values of use:

Value          2015       2017 
Name      Val. Data  Val. Data
--------  ---------  ---------
Major            14         14
Minor             0         13
Bld           23026      26020

Note that the @Minor and build (@Bld) numbers of 2017 continue to change as new patches are updated.

I would suggest, if checking for a minimum that 2015 is installed, just checking the key and that the @Major version is 14.

If checking for 2017, with the intention of doing an upgrade if it's not in existence, then just check the @Bld number, and if it's not at least the version that can be installed, then go ahead and install the current 2017 version. Note that future updates the the @Minor and @Bld version are probable -- I've got another computer where v14.11.25325 is installed, also a 2017 version.

like image 126
CJBS Avatar answered Oct 10 '22 12:10

CJBS