最好的方法来检查是否安装了SQL CE,如果是的话是什么版本?的话、最好的、方法来、版本

2023-09-03 04:12:49 作者:酒伴孤独

我已经写了使用SQL CE 3.5 VB.NET应用程序。我很好奇,如果任何人有任何的最佳做法或code,有助于检查,如果A)的SQL CE安装和B)如果是这样,是什么版本。

I've written a VB.NET application that uses SQL CE 3.5. I'm curious if anyone has any best practice or code to help check if A) SQL CE is installed and B) If so, what version.

我搜索MSDN和谷歌的任何东西,但我没有发现任何有用的。我闲逛了注册表,发现这个关键: HKEY_LOCAL_MACHINE \ SOFTWARE \微软\ Microsoft SQL Server的精简版\器v3.5 用字符串值版本,数据是3.5.5692.0。

I searched msdn and google for anything but I didn't find anything helpful. I was poking around the registry and found this key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5 with a string value "Version" and the data was 3.5.5692.0.

所以从蝙蝠我的假设是检查这个关键的presence但它困扰我,因为3.5键肯定喜欢它的声音被束缚到3.5 DLL。我想说的是我讨厌强迫别人安装SQL 3.5,如果他们有SQL CE(CE插在这里的某个未来版本)。

So off the bat my assumption is to check for the presence of this key but it bothers me because the "3.5" key sure sounds like it's tied to the 3.5 DLL. What I'm trying to say is I'd hate to force someone to install SQL 3.5 if they have SQL CE (insert some future version of CE here).

其它信息: 目标框架:.NET 2.0 最低目标操作系统:Windows XP SP2

Misc info: Target Framework: .NET 2.0 Minimum Target OS: Windows XP SP2

推荐答案

有这种操作检查产品标识符(GUID),​​其由MSI安装保存在注册表中的广泛接受的方法。如果你没有在安装,您可以破解打开MSI一个叫做逆戟鲸(Windows SDK中的一部分)的工具问题的产品,并抓住GUID的方式。如果不是全部安装大部分建设者有一个动作或任务可以做这件事为pre-REQ测试,甚至VS2005 / 2008的一部分有这个能力。

The widely accepted method for doing this is checking the product identifier (GUID) which is saved in the registry by the MSI installer. If you dont have the product in question installed you can crack open the MSI with a tool called Orca (part of Windows SDK) and grab the GUID that way. Most if not all install builders have an action or task that can do this as part of a pre-req test, even VS2005/2008 has this capability.

要检查版本,我想挖过来再在注册表中或者看文件版本。

To check versions, I would dig around again in the registry or maybe look at file versions.