Reputation: 794
1)Which is the best way to detect whether vs2005 runtimes are installed in a system using NSIS installer?
2)If runtimes are not detected which is the best way to add run time libraries-
a)running an embedded vcredist or
b)copying dlls to the installation folder
Thanks
Upvotes: 0
Views: 1806
Reputation: 30013
;-------------------------------
; Test if Visual Studio Redistributables 2005+ SP1 installed
; Returns -1 if there is no VC redistributables intstalled
Function CheckVCRedist
Push $R0
ClearErrors
ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7299052b-02a4-4627-81f2-1818da5d550d}" "Version"
; if VS 2005+ redist SP1 not installed, install it
IfErrors 0 VSRedistInstalled
StrCpy $R0 "-1"
VSRedistInstalled:
Exch $R0
FunctionEnd
Of course you need to run the embedded installer, not copying files yourself. Confirm registry key 7299052b-02a4-4627-81f2-1818da5d550d
against your version of VC runtime.
Upvotes: 2
Reputation: 101756
A while ago, I created some sample code that checks the assembly cache, it's probably better than just checking for a uninstall entry
Upvotes: 1