如何通过NSIS安装SQL Server Compact Edition 4.0

时间:2012-10-09 01:26:36

标签: sql-server-ce nsis

我正在寻找一个示例NSIS脚本,只在必要的SQL Server Compact Edition 4.0中检测和安装。

1 个答案:

答案 0 :(得分: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,那么它就会出错并且不兼容。因此只安装或。