我正在寻找一个示例 NSIS 脚本,仅在必要时检测和安装 SQL Server Compact Edition 4.0。
问问题
793 次
1 回答
3
为我未来的自己回答我自己的问题。包括:
!include "x64.nsh"
!include LogicLib.nsh
部分如下。版本检查正在测试 SP1
Section "SQL Server Compact Edition 4.0 (required)"
SectionIn RO
${If} ${RunningX64}
ReadRegStr $0 HKLM "SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server Compact Edition\v4.0\ENU" "DesktopRuntimeVersion"
DetailPrint "Microsoft SQL Server Compact Edition (64 bit) DesktopRuntimeVersion=$0"
${If} $0 == '4.0.8876.1'
DetailPrint "Microsoft SQL Server Compact Edition 4.0 SP1 (64 bit) is installed"
${Else}
DetailPrint "Installing Microsoft SQL Server Compact Edition 4.0 SP1 (64 bit)"
SetDetailsPrint listonly
ExecWait '"$INSTDIR\Tools\SSCERuntime_x64-ENU.exe" /i /passive'
${EndIf}
${Else}
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v4.0\ENU" "DesktopRuntimeVersion"
DetailPrint "Microsoft SQL Server Compact Edition (32 bit) DesktopRuntimeVersion=$0"
${If} $0 == '4.0.8876.1'
DetailPrint "Microsoft SQL Server Compact Edition 4.0 SP1 (32 bit) is installed"
${Else}
DetailPrint "Installing Microsoft SQL Server Compact Edition 4.0 SP1 (32 bit)"
SetDetailsPrint listonly
ExecWait '"$INSTDIR\Tools\SSCERuntime_x86-ENU.exe" /i /passive'
${EndIf}
${EndIf}
SetDetailsPrint lastused
SectionEnd
顺便说一句,我看到一些博客说 x86 和 x64 必须安装在 64 位系统上,但如果我在 64 位系统上运行 x86,则会出现不兼容的错误。因此只安装或。
于 2012-10-09T01:26:35.787 回答