SQL CE 4.0作为InstallShield先决条件

时间:2012-02-07 17:47:45

标签: sql-server-ce windows-installer installshield

我正在创建自己的prq文件,以便在安装WPF应用程序的情况下执行SQL CE 4.0安装。安装程序一直在失败,我不知道为什么。看起来它试图运行CE exe,但随后Windows Installer帮助窗口会出现所有这些命令行帮助选项。我单击确定,然后它说CE的安装失败。我不知道如何确定出了什么问题。

这是我的prq文件内容:

<?xml version="1.0" encoding="UTF-8"?>
<SetupPrereq>
<conditions>
    <condition Type="32" Comparison="2" Path="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v4.0\ENU" FileName="DesktopRuntimeVersion" ReturnValue="4.0.8482.1"></condition>
</conditions>
<files>
    <file LocalFile="&lt;ISProductFolder&gt;\SetupPrerequisites\SSCERuntime_x86-ENU.exe" URL="http://www.microsoft.com/download/en/details.aspx?id=17876" FileSize="0,0"></file>
</files>
<execute file="SSCERuntime_x86-ENU.exe" cmdline="/passive /norestart" cmdlinesilent="/passive /norestart"></execute>
<properties Id="{F7BF54C1-CA2C-4410-98DB-480769CE6547}" Description="This prerequisite installs the Microsoft SQL Server Compact 4.0."></properties>
</SetupPrereq>

非常感谢任何帮助。

2 个答案:

答案 0 :(得分:6)

我能够从它看起来如此工作

<?xml version="1.0" encoding="UTF-8"?>
<SetupPrereq>
<conditions>
    <condition Type="32" Comparison="2" Path="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v4.0\ENU" FileName="DesktopRuntimeVersion" ReturnValue="4.0.8482.1"></condition>
</conditions>
<files>
    <file LocalFile=".\SSCERuntime_x86-ENU.exe" URL="http://download.microsoft.com/download/0/5/D/05DCCDB5-57E0-4314-A016-874F228A8FAD/SSCERuntime_x86-ENU.exe" FileSize="0,0"></file>
</files>
<execute file="SSCERuntime_x86-ENU.exe" cmdline="/i /passive" cmdlinesilent="/i /passive"></execute>
<properties Id="{05DCCDB5-57E0-4314-A016-874F228A8FAD}" Description="This prerequisite installs the Microsoft SQL Server Compact 4.0 x86."></properties>
</SetupPrereq>

x64脚本

<?xml version="1.0" encoding="UTF-8"?>
<SetupPrereq>
<conditions>
    <condition Type="32" Comparison="2" Path="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v4.0\ENU" FileName="DesktopRuntimeVersion" ReturnValue="4.0.8482.1"></condition>
</conditions>
<files>
    <file LocalFile=".\SSCERuntime_x64-ENU.exe" URL="http://download.microsoft.com/download/0/5/D/05DCCDB5-57E0-4314-A016-874F228A8FAD/SSCERuntime_x64-ENU.exe" FileSize="0,0"></file>
</files>
<execute file="SSCERuntime_x64-ENU.exe" cmdline="/i /passive" cmdlinesilent="/i /passive"></execute>
<properties Id="{05DCCDB5-57E0-4314-A016-874F228A8FAD}" Description="This prerequisite installs the Microsoft SQL Server Compact 4.0 x64."></properties>
</SetupPrereq>

答案 1 :(得分:2)

在回应rishiJasapara的评论时,我根据之前的回答制作了剧本。

这个想法是一样的,创建两个脚本,一个用于x86,另一个用于x64平台。 您必须在InstallShield项目中选择两个先决条件,但是在目标机器的安装页面中列出下面列出的脚本,您将看到唯一一个与机器的处理器体系结构相对应的。

Microsoft SQL CE 4.0 x86.prq:

<?xml version="1.0" encoding="UTF-8"?>
<SetupPrereq>
    <conditions>
        <condition Type="32" Comparison="2" Path="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v4.0\ENU" FileName="DesktopRuntimeVersion" ReturnValue="4.0.8482.1"></condition>
    </conditions>
    <operatingsystemconditions>
        <operatingsystemcondition CSDVersion="" Bits="1"></operatingsystemcondition>
    </operatingsystemconditions>
    <files>
        <file LocalFile=".\SSCERuntime_x86-ENU.exe" URL="http://download.microsoft.com/download/0/5/D/05DCCDB5-57E0-4314-A016-874F228A8FAD/SSCERuntime_x86-ENU.exe" CheckSum="0A55733CF406FBD05DFCFF5A27A0B4F7" FileSize="0,2379544"></file>
    </files>
    <execute file="SSCERuntime_x86-ENU.exe"></execute>
    <properties Id="{2754916B-119B-4428-9F94-DC9E45072CCC}"></properties>
    <behavior Failure="4" Reboot="2"></behavior>
</SetupPrereq>

Microsoft SQL CE 4.0 x64.prq:

<?xml version="1.0" encoding="UTF-8"?>
<SetupPrereq>
    <conditions>
        <condition Type="32" Comparison="2" Path="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v4.0\ENU" FileName="DesktopRuntimeVersion" ReturnValue="4.0.8482.1"></condition>
    </conditions>
    <operatingsystemconditions>
        <operatingsystemcondition CSDVersion="" Bits="2"></operatingsystemcondition>
    </operatingsystemconditions>
    <files>
        <file LocalFile=".\SSCERuntime_x64-ENU.exe" URL="http://download.microsoft.com/download/0/5/D/05DCCDB5-57E0-4314-A016-874F228A8FAD/SSCERuntime_x64-ENU.exe" CheckSum="A417082ECAEDD95AFB41F73DC140C350" FileSize="0,2621240"></file>
    </files>
    <execute file="SSCERuntime_x64-ENU.exe"></execute>
    <properties Id="{7CB7BE3C-614A-403F-94D9-5652285A3EDF}"></properties>
    <behavior Failure="4" Reboot="2"></behavior>
</SetupPrereq>

正如您所看到的,主要区别在于确定了正确的SQL CE安装包时附加的“operatingsystemconditions”。

我在Windows 7 32位和64位系统上测试过,它实际上运行正常。