如何在 WiX 安装程序中检测 SQL Server Express [英] How to detect SQL Server Express in WiX installer

查看:34
本文介绍了如何在 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆