laurent
laurent

Reputation: 90833

How to detect if a specific version of vcredist_x86.exe has already been installed?

I created an installer that run vcredist_x86.exe (version 9.0.x.x) as part of the installation. Before installing it however I would like to know if it's already in the user's system. I basically need to detect not only that the DLLs are present but that they have the right version number. Is there any reliable way to do that?

I'm using NSIS but any solution would be welcome.

Upvotes: 1

Views: 1525

Answers (2)

Mark Bowler
Mark Bowler

Reputation: 104

Try this:

!include "x64.nsh"

Section
  var /GLOBAL hasCRT
  !define CRTCHECKDLL msvcr80.dll
  !define CRTCHECKNAME 'Microsoft.VC80.CRT,version="8.0.50727.6195",type="win32",processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b"'
  push '${CRTCHECKDLL}'
  push '${CRTCHECKNAME}'
  call WinSxS_HasAssembly
  pop $hasCRT
  DetailPrint ${CRTCHECKDLL}=$hasCRT
SectionEnd

Upvotes: 1

laurent
laurent

Reputation: 90833

There's no easy way to do that, so I ended up always installing the package whether it's already installed or not. Since it's a small install anyway it doesn't make much difference.

Upvotes: 0

Related Questions