如何将Electron应用程序和Windows服务捆绑在一起? [英] How to bundle Electron application and windows service together?

查看:731
本文介绍了如何将Electron应用程序和Windows服务捆绑在一起?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对电子应用非常陌生.我需要有关选举安装的帮助. 我有一个 Electron桌面应用程序和一个 Windows服务. 我可以使用sudo-prompt软件包启动和停止我的预安装服务. 我正在使用electron-winstaller软件包创建 Windows安装程序. 但是我想将我的 windows服务与我的电子应用程序捆绑在一起.我的要求是,当我安装我的电子程序包时,它也应同时安装我的服务;当我卸载程序包时,则应卸载该服务.

I am very new with electron application. I need some help with election installation. I have an Electron desktop application and a windows service. I can start and stop my pre installed services by using sudo-prompt package. I am creating windows installer by using electron-winstaller package. But I want to bundle my windows service along with my electron application. My requirement is when I install my electron package then it should install my service also, when I uninstall my package then that service should be uninstalled.

请帮帮我.任何线索,任何建议将不胜感激. 如果您认为应该通过其他方法来实现,那么请建议我.

Please help me out. Any clue, Any suggestions will be appreciated. If you think this should be achieved with something else then please do suggest me.

推荐答案

Electron的Windows Installer打包程序给我一个特殊的案例工具,在这种情况下可能会遇到限制.我会改用一般情况下的工具,例如Free and Open Source Windows Installer XML Toolset aka WiX.我也将使用另一个称为工业强度Windows Installer XML(又名IsWiX)的FOSS应用程序.

Electron's windows installer packager strikes me a specific case tool that would likely hit limitations in scenarios like this. I would use a general case tool instead such as the Free and Open Source Windows Installer XML Toolset aka WiX. I would also use with that another FOSS application called Industrial Strength Windows Installer XML aka IsWiX.

WiX允许您使用XML/XSD域特定语言描述和构建MSI数据库.它支持MSBuild,可轻松与CI/CD管道集成. IsWiX *是一组项目模板和图形设计器,它们提供了自以为是的项目结构(脚手架),并极大地加快了学习进度和实施速度.例如,您描述的该安装程序可以无需编写XML即可完成.

WiX allows you to describe and build MSI databases using an XML/XSD domain specific language. It supports MSBuild for easy integration with your CI/CD pipeline. IsWiX* is a set of project templates and graphical designers that provide an opinionated project structuring (scaffolding) and greatly speeds up the learning curve and implementation. For example, this installer you describe could be done without writing a single line of XML.

有关更多信息,请参见: https://github.com/iswix-llc/iswix-教程

For more information see: https://github.com/iswix-llc/iswix-tutorials

桌面应用程序和Windows服务教程应**向您显示编写此安装程序所需的一切.基本上完全遵循桌面应用程序,然后跳到Windows服务教程的最后一部分,您将在其中定义Windows服务.

The desktop-application and windows-service tutorials should** show you everything you need to know to author this installer. Basically follow the desktop-application all the way through and then skip to the final portion of the windows-service tutorial where you define the windows service.

  • 我是IsWiX的维护者

**这假定您的服务exe是与Windows服务控制管理器对接的正确Windows服务.如果实际上只是作为服务运行的控制台应用程序,则需要包含诸如srvany.exe之类的程序.这将需要一行手工XML来扩展注册表中的服务定义,并将正确的命令行值传递给您的exe.可以在此处找到示例: Wix安装程序以替换INSTSRV和SRVANY进行用户定义的服务安装

** This assumes your service exe is a proper Windows service that interfaces with the windows service control manager. If it's really just a console app that runs as a service you will need to include a program such as srvany.exe. This will require one line of hand crafted XML to extended the service definition in the registry with the proper command line value to be passed to your exe. An example can be found here: Wix installer to replace INSTSRV and SRVANY for user defined service installation

这篇关于如何将Electron应用程序和Windows服务捆绑在一起?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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