Archive: Microsoft Visual C++ 2008 Redistributable Package


Microsoft Visual C++ 2008 Redistributable Package
Hi

Is there a way to verify if Microsoft Visual C++ 2008 Redistributable Package (http://www.microsoft.com/downloads/d...displaylang=en) is installed on user's machine so I can show a warning if it is not? Thanks.


http://nsis.sourceforge.net/WinSxS_Q...y_is_installed might be of help


Please do note that the user can have the required runtimes even if the redist isn't installed though...

One example would be if the user has Visual Studio 2008 installed.


We solved this by installing the VS2008 redistributable always!

If its already installed this will do nothing
if its an old version it will upgrade.

And as far as I understand the MS license contract you are allowed to do this.

${Unless} ${FileExists}   
$TEMP\VS2008_SP1_vcredist_x86.exe
DetailPrint "Installing VC++ 9 runtime"
File ..\common\binaries\VS2008_SP1_vcredist_x86.exe
ExecWait "$TEMP\VS2008_SP1_vcredist_x86.exe /q"
DetailPrint "Cleaning up"
Delete $TEMP\VS2008_SP1_vcredist_x86.exe
${EndUnless}

It's a redistributable - yes, you can always call the installer even if it's already installed.

Myself, I just check the installation registry keys. Even IF the package -is- in fact already installed (which you might be able to determine via the WinSxS stuff).. if the registry keys are missing, it means it was installed via non-standard means (e.g. as part of a Visual Studio install), and (re-)installing is a good idea anyway.


Thanks a lot everyone for your answers.


More Direct Help
Here is my effort at installing the redistributables (no guarantees or safety checks provided). There may be some cases of failure hereafter, but for my installer it has been a great benefit--only needing an install if it does not exist on the system. The codes I needed for the registry were obtained from http://blogs.msdn.com/b/astebner/arc...-2005-sp1.aspx.


# 64-bit Installs
# Make sure the variable is clear

StrCpy $1 ""
SetRegview 64
# Detect if it is installed already
ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\{071c9b48-7c32-4621-a0ac-3f809523288f}" DisplayName
StrCmp $1 "" sp164_not_exists sp164_exists
sp164_not_exists:
# From http://blogs.msdn.com/astebner/archive/2007/02/07/update-regarding-silent-install-of-the-vc-8-0-runtime-vcredist-packages.aspx
# "qb!" for progress with no cancel, "qb" for progress and cancel, "qn" for no interaction

DetailPrint "Please wait for the next step to finish."
ExecWait '$INSTDIR\bin64\MicrosoftRedistributable64\vcredist_x64SP1.exe /q:a /c:"VCREDI~2.EXE /q:a /c:""msiexec /i vcredist.msi /qn"" "' $0 # Only progress bar
DetailPrint "vcredist_x64 SP1 Update returned $0"
sp164_exists:
# Nothing to do
# Make sure the variable is clear

StrCpy $1 ""
SetRegview 64
ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\{6CE5BAE9-D3CA-4B99-891A-1DC6C118A5FC}" DisplayName
StrCmp $1 "" atl64_not_exists atl64_exists
atl64_not_exists:
# From http://blogs.msdn.com/astebner/archive/2007/02/07/update-regarding-silent-install-of-the-vc-8-0-runtime-vcredist-packages.aspx
# "qb!" for progress with no cancel, "qb" for progress and cancel, "qn" for no interaction

DetailPrint "Please wait for the next step to finish."
ExecWait '$INSTDIR\bin64\MicrosoftRedistributable64\vcredist_x64SP1ATL.exe /q:a /c:"VCREDI~2.EXE /q:a /c:""msiexec /i vcredist.msi /qn"" "' $0 # Only progress bar
DetailPrint "vcredist_x64 SP1 ATL Update returned $0"
atl64_exists:
# Nothing to do

# 32-bit Installs
# Make sure the variable is clear

StrCpy $1 ""
SetRegview 32
ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\{7299052B-02A4-4627-81F2-1818DA5D550D}" DisplayName
StrCmp $1 "" sp1_not_exists sp1_exists
sp1_not_exists:
# From http://blogs.msdn.com/astebner/archive/2007/02/07/update-regarding-silent-install-of-the-vc-8-0-runtime-vcredist-packages.aspx
# "qb!" for progress with no cancel, "qb" for progress and cancel, "qn" for no interactio
n
DetailPrint "Please wait for the next step to finish."
ExecWait '$INSTDIR\bin\MicrosoftRedistributables\vcredist_x86SP1.exe /q:a /c:"VCREDI~3.EXE /q:a /c:""msiexec /i vcredist.msi /qn"" "' $0 # Only progress bar
DetailPrint "vcredist_x86 SP1 Update returned $0"
sp1_exists:
# Nothing to do
# Make sure the variable is clear

StrCpy $1 ""
SetRegview 32
ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\{837B34E3-7C30-493C-8F6A-2B0F04E2912C}" DisplayName
StrCmp $1 "" atl_not_exists atl_exists
atl_not_exists:
# From http://blogs.msdn.com/astebner/archive/2007/02/07/update-regarding-silent-install-of-the-vc-8-0-runtime-vcredist-packages.aspx
# "qb!" for progress with no cancel, "qb" for progress and cancel, "qn" for no interaction

DetailPrint "Please wait for the next step to finish."
ExecWait '$INSTDIR\bin\MicrosoftRedistributables\vcredist_x86SP1ATL.exe /q:a /c:"VCREDI~3.EXE /q:a /c:""msiexec /i vcredist.msi /qn"" "' $0 # Only progress bar
DetailPrint "vcredist_x86 SP1 ATL Update returned $0"
atl_exists:
# Nothing to do