Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2009
    Posts
    1

    Dependency Module: SQL Server CE 3.5

    I wrote and have used the following script for SQL Ce. I hope others who need it find it useful.

    <DependencyTemplate>
    <Dependency>
    <Name>SQL Server Compact Edition 3.5</Name>
    <RevisionDate>Tuesday, June 16, 2009</RevisionDate>
    <Description>Type: Setup Factory 8.0 Dependency Module
    Installs the Microsoft SQL Server Compact Edition v3.5 onto the user’s system.

    Instructions:
    In order for this module to be available and function correctly, Setup Factory expects the following:

    1) A newly created folder in the "Dependencies" folder (where you unzipped "sqlce_x86.xml") called "sqlce_x86".
    2) A copy of the Microsoft SQL CE v3.5 redistributable file (SSCERuntime-ENU-x86.msi) located in the "sqlce_x86" directory mentioned above. The installation file can be downloaded from the following URL:
    http://www.microsoft.com/downloads/d...DisplayLang=es

    Important:
    You should reboot your PC after installation!</Description>
    <DetectScript>function isSQLServerCE_Installed()

    -- Write to logfile that detection has started.
    SetupData.WriteToLogFile("Info\tMicrosoft SQL Server CE v3.5 Module: Detection script started.\r\n",true);

    -- Check: Microsoft SQL Server CE v3.5 Registry key exists?
    SQLServerCE_Reg = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Microsoft SQL Server Compact Edition\v3.5\ENU", "Version", true);

    --if SQLServerCE_Reg == "3.5" then
    if String.Find(SQLServerCE_Reg, "3.5", 1, false) > 0 then
    -- Key exists, do not start the installation script and write to logfile
    SetupData.WriteToLogFile("Info\tMicrosoft SQL Server CE v3.5 Module: Registry key found, no installation needed.\r\n",true);
    return true
    else
    -- Key does not exist, start the installation script and write to logfile
    SetupData.WriteToLogFile("Info\tMicrosoft SQL Server CE v3.5 Module: Registry key not found, start with installation.\r\n",true);
    return false
    end

    -- Write to logfile that detection has finished.
    SetupData.WriteToLogFile("Info\tMicrosoft SQL Server CE v3.5 Module: Detection script finished.\r\n",true);

    end</DetectScript>
    <DetectFunction>isSQLServer_Installed</DetectFunction>
    <InstallScript>
    -- Variables
    local strMessage =
    [[Setup has detected that Microsoft SQL Server Compact Edition v3.5 is not installed.
    Click OK to install the newest version or Cancel to abort this setup.

    The installation can take some time.]];
    local strMessageTitle = "Microsoft SQL Server Compact Edition v3.5 Required!";
    local strRuntimeSupportFolder = SessionVar.Expand("%TempLaunchFolder%\\SSCERuntime-ENU-x86");
    local strFileToRun = "\\sqlce_x86\\SSCERuntime-ENU-x86.msi";
    local strMessageFail =
    [[The installation of Microsoft SQL Server Compact Edition v3.5 failed.
    The setup will now close.]];

    -- Write to logfile that installation has started.
    SetupData.WriteToLogFile("Info\tMicrosoft SQL Server Compact Edition v3.5 Module: Installation script started.\r\n",true);

    local MessageBoxResult = Dialog.Message(strMessageTitle,strMessage,MB_OKCAN CEL,MB_ICONEXCLAMATION,MB_DEFBUTTON1);

    if (MessageBoxResult == IDOK) then
    -- Install Microsoft SQL Server Compact Edition v3.5 and log to file
    SetupData.WriteToLogFile("Info\tMicrosoft SQL Server Compact Edition v3.5 Module: Installation script started.\r\n",true);
    --run the setup with command line parameters
    File.Run(strFileToRun);

    error = Application.GetLastError();

    if (error ~= 0) then
    -- An error occurred, write to logfile and exit setup
    Dialog.Message("Installation failed!", strMessageFail, MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    SetupData.WriteToLogFile("Error\tMicrosoft SQL Server Compact Edition v3.5 Module: File installation error: ".. error .."\r\n",true);
    SetupData.WriteToLogFile("Info\tMicrosoft SQL Server Compact Edition v3.5 Module: Installation script finished.\r\n",true);
    Application.Exit();
    end
    else -- IDCANCEL
    -- Do not install Microsoft SQL Server Compact Edition v3.5 and log to file
    Dialog.Message("Installation failed!", strMessageFail, MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    SetupData.WriteToLogFile("Info\tMicrosoft SQL Server Compact Edition v3.5 Module: File installation canceled.\r\n",true);
    SetupData.WriteToLogFile("Info\tMicrosoft SQL Server Compact Edition v3.5 Module: Installation script finished.\r\n",true);
    Application.Exit();
    end


    -- Write to logfile that installation has finished.
    SetupData.WriteToLogFile("Info\tMicrosoft SQL Server Compact Edition v3.5 Module: Installation script finished.\r\n",true);</InstallScript>
    <SupportFiles>
    <File>#SUFDIR#\Dependencies\sqlce_server\SSCERunti me-ENU-x86.msi</File>
    </SupportFiles>
    </Dependency>
    </DependencyTemplate>
    Attached Files

  2. #2
    Join Date
    Jul 2006
    Posts
    18

    Lightbulb

    Hi MrCrowley,

    first, i have to thank you for posting this code. But, i think you there is a failure at checking the registry key.

    On my computer, there is no "Version" entry under "...\v3.5\ENU"

    Quote Originally Posted by MrCrowley View Post
    -- Check: Microsoft SQL Server CE v3.5 Registry key exists?
    SQLServerCE_Reg = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Microsoft SQL Server Compact Edition\v3.5\ENU", "Version", true);
    I still have two entries called "DesktopRuntimeServicePackLevel" and "DesktopRuntimeVersion". Maybe it depends on system language or preinstalled compact editions, in my case this is/was the german one...

    I have found the "Version" registry entry under "...\v3.5\DEU"...

    I think it would suffice to change your code from "Version" into "DesktopRuntimeVersion". The version number would be then not "3.5" but "3.5.5692.0". Your code

    Code:
    if String.Find(SQLServerCE_Reg, "3.5", 1, false) > 0 then
    should still work.

    Could you check this please?

    Regards

    Sebastian

  3. #3
    Join Date
    Jul 2006
    Posts
    18

    Star

    ****, i couldn't edit my post. I have forgotton something...

    If you write

    Code:
    ...\\Microsoft SQL Server Compact Edition\v3.5\ENU", "Version", true);
    you have to escape all the backslashes.

    Regards

    Sebastian

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts