如何在 WiX 安装程序中检测 SQL Server Express

How to detect SQL Server Express in WiX installer(如何在 WiX 安装程序中检测 SQL Server Express)
本文介绍了如何在 WiX 安装程序中检测 SQL Server Express的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过 WiX 安装程序检测 Sql Server Express 是否已安装并在机器上运行?

How do I detect if Sql Server Express is installed and running on a machine in a WiX installer?

我想在安装我的应用程序之前进行检查,如果它没有安装并运行,通知用户在安装我的应用程序之前必须先安装它.

I want to check before installing my application and if it's not installed and running, to inform the user that it has to be installed first before installing my application.

推荐答案

我尝试了 Krzysztof 的解决方案(上图) - 但在某些机器上,当使用这种方法时,它无法正确检测到它们何时执行已安装 Sql Express.

I tried Krzysztof's solution (above) - but on some machines when using this approach it wasn't correctly detecting when they did not have Sql Express installed.

这似乎是由于对 REG_MULTI_SZ InstalledInstances 注册表值处理不当造成的?

It looked to be caused by mishandling of the REG_MULTI_SZ InstalledInstances registry value?

当我检查是否需要在安装程序中停止/重新启动 Sql Server Express 服务时,我决定只检查它 - 所以这是我的替代方案,我只检查服务:

As I was checking to see if I needed to stop/restart the Sql Server Express service in the installer, I decided to just check against that instead - so here's my alternative, where I just check for the service instead:

<Property Id="SQLEXPRESSINSTALLED" >
  <RegistrySearch Id="IsSqlExpressServiceInstalled" Root="HKLM" Key="SYSTEMCurrentControlSetservicesMSSQL$SQLEXPRESS" Name="Description" Type="raw" Win64="no"/>
</Property>      

<Condition Message="Express Not Installed">SQLEXPRESSINSTALLED</Condition>

<Condition Message="Express Installed">NOT SQLEXPRESSINSTALLED</Condition>

有点小技巧,但对我们的客户来说似乎工作得很好(使用组件内的条件,而不是上面显示的示例启动条件)

Bit of a hack, but seems to work well enough for our customers (were using the conditions within components, rather then the example Launch conditions shown above)

这篇关于如何在 WiX 安装程序中检测 SQL Server Express的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
SSIS: Model design issue causing duplications - can two fact tables be connected?(SSIS:模型设计问题导致重复-两个事实表可以连接吗?)
SQL Server Graph Database - shortest path using multiple edge types(SQL Server图形数据库-使用多种边类型的最短路径)
Invalid column name when using EF Core filtered includes(使用EF核心过滤包括时无效的列名)
How should make faster SQL Server filtering procedure with many parameters(如何让多参数的SQL Server过滤程序更快)
How can I generate an entity–relationship (ER) diagram of a database using Microsoft SQL Server Management Studio?(如何使用Microsoft SQL Server Management Studio生成数据库的实体关系(ER)图?)