0

1)使用NSIS安装程序检测系统中是否安装了vs2005运行时的最佳方法是什么?

2)如果未检测到运行时,这是添加运行时库的最佳方式-

     a)running an embedded vcredist or 
     b)copying dlls to the installation folder

谢谢

4

2 回答 2

2
;-------------------------------
; 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

当然,您需要运行嵌入式安装程序,而不是自己复制文件。7299052b-02a4-4627-81f2-1818da5d550d根据您的 VC 运行时版本确认注册表项。

于 2009-09-18T07:01:52.470 回答
1

前段时间,我创建了一些检查程序集缓存的示例代码,它可能比仅检查卸载条目更好

于 2009-09-19T23:18:56.320 回答