Old 15th March 2009, 03:59   #1
Haplo
Junior Member
 
Join Date: Feb 2008
Posts: 8
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.
Haplo is offline   Reply With Quote
Old 15th March 2009, 07:41   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,484
http://nsis.sourceforge.net/WinSxS_Q...y_is_installed might be of help

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 15th March 2009, 17:18   #3
TobbeSweden
Senior Member
 
Join Date: Oct 2006
Posts: 106
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.
TobbeSweden is offline   Reply With Quote
Old 16th March 2009, 14:59   #4
thek
Member
 
thek's Avatar
 
Join Date: Jun 2006
Location: Austria
Posts: 92
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.

code:
${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}

thek is offline   Reply With Quote
Old 16th March 2009, 15:53   #5
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
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.
Animaether is offline   Reply With Quote
Old 18th March 2009, 04:19   #6
Haplo
Junior Member
 
Join Date: Feb 2008
Posts: 8
Thanks a lot everyone for your answers.
Haplo is offline   Reply With Quote
Old 27th May 2011, 17:41   #7
m1st0
Junior Member
 
Join Date: May 2011
Posts: 1
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.

code:

# 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

m1st0 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump