包含 C++ Builder Windows 服务的 Wix 安装程序包 [英] Wix installer package containing a C++ Builder Windows service

查看:44
本文介绍了包含 C++ Builder Windows 服务的 Wix 安装程序包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 Wix 工具集制作的安装包,其中包括使用 Embarcadero 的 C++ Builder 创建的服务.如果与 Visual Studio C++/C# 相比,ECB 在 Windows 下注册/取消注册服务的语法不同,我无法通过常规 Wix 元素 注册服务,安装程序在此期间冻结服务注册/注销.我通过 Wix Custom Actions 找到了解决方案.我创建了以下操作:

I have a installation package made using the Wix toolset, that includes a service created with Embarcadero's C++ Builder. ECB has a different syntax to register/unregister services under Windows if compared to Visual Studio C++/C#, I was not able to register the service through the regular Wix element <ServiceInstall>, the installer freezes during the service registration/unregistration. I found a solution through the Wix Custom Actions. I created the following actions:

    <CustomAction
        Id="LaunchApp_SrvInstall"
        Directory="INSTALLDIR"
        Impersonate="no"
        Execute="deferred"
        ExeCommand="&quot;[INSTALLDIR]ACService.exe&quot; /install /silent">
    </CustomAction>
    <CustomAction
        Id="LaunchApp_SrvUninstall"
        Directory="INSTALLDIR"
        Impersonate="no"
        Execute="deferred"
        ExeCommand="&quot;[INSTALLDIR]ACService.exe&quot; /uninstall /silent">
    </CustomAction>

    <InstallExecuteSequence>
        <Custom Action="LaunchApp_SrvInstall"   After="InstallFiles">NOT REMOVE</Custom>
        <Custom Action="LaunchApp_SrvUninstall" Before="RemoveFiles">REMOVE ~= "ALL"</Custom>
    </InstallExecuteSequence>

使用上面的语法,在包安装过程中,将文件复制到安装目录后,我注册了服务,如果我正在卸载包,则在删除已安装的文件之前取消注册服务.在这两种情况下,它都能完美运行.当我尝试将软件更新到更新版本时,我面临的问题发生了,我遇到了软件和服务正在运行并且用户尝试安装新的 MSI 包以更新整个解决方案的情况.在这种情况下,我有以下弹出窗口:

With the syntax above, during the package install, after the files are copied to the installation directory I have the service registered, and if I'm uninstalling the package the service is unregistered before the installed files are removed. In both cases it works perfectly. The problem I'm facing happens when I try to update the software to a newer version, I have the scenario where the software and the service are running and the user tries to install the new MSI package to update the entire solution. In that case, I have the following popup:

似乎在更新过程中,安装程序试图注册该服务两次,但我不知道为什么.这里有人已经遇到过这种情况吗?有没有办法将自定义操作配置为在包更新期间也能工作?

It seems that during the update process, the installer is trying to register the service twice, but I can't figure why. Does anyone here already faced such situation? Is there a way to configure the Custom Actions to work also during the package update?

推荐答案

在评论中给出有用的提示之后,当我关联 NameDisplayName 属性时,一切都正常了使用 WiX 安装程序项目源代码的 NameDisplayName 标签的 Embarcadero IDE 的代码,此外,还需要在 Arguments 标签中定义 Arguments代码>

After the useful tips given in the comments, everything worked when I correlated the properties Name and DisplayName of the Embarcadero's IDE with the tags Name and DisplayName of the WiX installer project source, also, it was necessary to define the Arguments tag in <ServiceInstall>

就是这样.现在我可以使用 WiX 处理我的服务.我非常有信心上述细节也适用于 Delphi 编译器.

That's it. Now I can handle my service using WiX. I'm quite confident the details above are also valid for the Delphi compiler.

这篇关于包含 C++ Builder Windows 服务的 Wix 安装程序包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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