InstallShield 如何检查是否安装了 SQL Server 2005 (3.1) Compact Edition (CE)
我正在开发一个 Windows 桌面应用程序,需要 SQL Server 2005 Compact Edition (SQLServerCE31-EN.msi) 进行安装。我使用InstallShield 2011来安装它,作为安装过程中的先决条件。
为了得出先决条件定义,我使用了 进程监视器以查看在 时检查这些注册表位置SQLServerCE31-EN.msi 手动运行(不通过安装程序):
32 位:HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server Compact Edition\v3.1
64 位:< code>HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Microsoft SQL Server Compact Edition\v3.1
大多数情况下,此检查似乎有效,如果 InstallShield 已检测到已安装,则它会跳过先决条件。然而,在某些计算机(Windows 7 Ultimate 64 位,已安装 SQL Server Compact Edition 3.5)中,该密钥不存在,即使 Microsoft SQL Server 2005精简版 [ENU] 列在程序和功能下。
以下两个位置(在 64 位计算机上)都有一个注册表项,可用于检查是否安装了 SQL Server Compact Edition 3.5,但没有显示是否安装了 3.1。
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server Compact Edition\v3.5
我相当确定可以同时安装这两个版本,而且 3.5 不会升级 3.1,尽管它显然是较新的版本。
如何检查是否已安装 SQL Server 2005 Compact Edition?
InstallShield 用户,这是我们当前使用的 .prq
文件:
<?xml version="1.0" encoding="UTF-8"?>
<SetupPrereq>
<conditions>
<condition Type="1" Comparison="2" Path="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.1" FileName="" ReturnValue="" Bits="2"></condition>
</conditions>
<files>
<file LocalFile="<ISProjectFolder>\..\InstallShieldPreRequisites\Microsoft SQL Server 2005 Compact Edition\SQLServerCE31-EN.msi" URL="http://download.microsoft.com/download/f/5/4/f54529c6-e316-4637-a211-95818fcd4451/SQLServerCE31-EN.msi" CheckSum="54854BAC91E616BF8F71184C05AD0355" FileSize="0,1819136"></file>
</files>
<execute file="SQLServerCE31-EN.msi" cmdline="/passive /norestart" cmdlinesilent="/passive /norestart" requiresmsiengine="1"></execute>
<properties Id="{51BB3FEE-3851-4ECC-909A-C9D8EAF83254}" Description="This prerequisite installs Microsoft SQL Server 2005 Compact Edition"></properties>
</SetupPrereq>
对于 上面的文件有待改进吗?
I am developing a Windows desktop application which requires the SQL Server 2005 Compact Edition (SQLServerCE31-EN.msi) to be installed. I am using InstallShield 2011 to install this as a pre-requisite during the installation process.
In order to come up with the pre-requisite definition I used Process Monitor to see that these registry locations are checked when SQLServerCE31-EN.msi is run manually (not via the installer):
32-bit: HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server Compact Edition\v3.1
64-bit: HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Microsoft SQL Server Compact Edition\v3.1
Most of the time, this check seems to work and InstallShield skips the pre-requisite if it's already detected as installed. However one some machines (Windows 7 Ultimate 64-bit with SQL Server Compact Edition 3.5 already installed) the key doesn't exist, even though Microsoft SQL Server 2005 Compact Edition [ENU] is listed under Programs and Features.
There's a registry key at both of the following locations (on a 64-bit machine) which could be used to check that SQL Server Compact Edition 3.5 is installed, but nothing to show if 3.1 is installed.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server Compact Edition\v3.5
I am fairly certain that it is possible to have both versions installed and it's not that 3.5 upgrades 3.1, even though it is obviously a newer version.
How can I check to see if SQL Server 2005 Compact Edition is installed?
For the InstallShield users out there, this is the .prq
file we are currently using:
<?xml version="1.0" encoding="UTF-8"?>
<SetupPrereq>
<conditions>
<condition Type="1" Comparison="2" Path="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.1" FileName="" ReturnValue="" Bits="2"></condition>
</conditions>
<files>
<file LocalFile="<ISProjectFolder>\..\InstallShieldPreRequisites\Microsoft SQL Server 2005 Compact Edition\SQLServerCE31-EN.msi" URL="http://download.microsoft.com/download/f/5/4/f54529c6-e316-4637-a211-95818fcd4451/SQLServerCE31-EN.msi" CheckSum="54854BAC91E616BF8F71184C05AD0355" FileSize="0,1819136"></file>
</files>
<execute file="SQLServerCE31-EN.msi" cmdline="/passive /norestart" cmdlinesilent="/passive /norestart" requiresmsiengine="1"></execute>
<properties Id="{51BB3FEE-3851-4ECC-909A-C9D8EAF83254}" Description="This prerequisite installs Microsoft SQL Server 2005 Compact Edition"></properties>
</SetupPrereq>
Can the prerequisite file above be improved?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products 配置单元中的产品代码来检查是否安装了 SQL Server CE 3.1。
例如SQL CE 3.5的产品代码是{F0B430D1-B6AA-473D-9B06-AA3DD01FD0B8}
我们会在注册表中找到以下内容:(注意代码做了一些转移) HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\ 1D034B0FAA6BD374B960AAD30DF10D8B
您可以通过ORCA工具找到SQL CE 3.1产品代码。详细步骤如下:
启动ORCA软件
使用 ORCA 打开 SQL CE 3.1 msi 文件
单击“属性”并在右侧面板中检查“产品代码”
下载:ORCA MSI Editor
http://www.technipages.com/download-orca-msi-editor.html
希望这有帮助......
You can use product code to in HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products hive to check if SQL Server CE 3.1 is installed.
For example the product code of SQL CE 3.5 is {F0B430D1-B6AA-473D-9B06-AA3DD01FD0B8}
We will find the below in the registry:(note that the code has do some transfer) HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\1D034B0FAA6BD374B960AAD30DF10D8B
You can find the SQL CE 3.1 product code via ORCA tool. Here is the detailed steps:
Start ORCA software
Open the SQL CE 3.1 msi file with ORCA
Click Property and check Product Code in the right panel
Download: ORCA MSI Editor
http://www.technipages.com/download-orca-msi-editor.html
Hope this helps…
答案的简短版本:
感谢 Microsoft Robbie Ming 的帮助,我们发现检查此注册表项是检查先决条件是否已安装的可靠方法:
Short version of the answer:
Thanks to help from Robbie Meng at Microsoft, we have found that checking for this registry key is a reliable way of checking if the prerequisite is already installed: