为 Windows 服务创建 MSI 安装程序 [英] Creating an MSI installer for a Windows Service

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

问题描述

我在 Visual Studio 2008 中有一个 Windows 服务项目.我还添加了设置和部署项目.不幸的是,当我安装它时,该服务没有显示在服务 MMC 管理单元中.

I have a Windows Service project in Visual Studio 2008. I've also added the setup and deployment project. Unfortunately, when I install it, the service does not show up in the services MMC snapin.

我已经将 ProjectInstaller 添加到服务项目中,并且我已按照说明操作 这里 已经.

I have already added the ProjectInstaller to the service project, and I've followed the instructions here already.

推荐答案

您正在寻找的(并且那篇文章没有任何内容,我可以看到)是 ProjectInstaller 类.如果您在设计视图中打开您的服务,您可以右键单击并选择添加安装程序".这会为您的项目添加一个类,默认情况下(我认为)ProjectInstaller.cs.在设计视图中,您将看到两个默认名称为 ServiceProcessInstaller1 和 ServiceInstaller1 的项目.更改您希望服务在哪个帐户下运行的每个属性、服务名称、描述等.

What you're looking for (and that article has nothing on this, that I can see) is a ProjectInstaller class. If you open your service up in design view, you can right-click and select "Add Installer." This adds a class to your project called, by default (I think), ProjectInstaller.cs. In design view, you will see two items with the default names ServiceProcessInstaller1 and ServiceInstaller1. Change the properties on each for what account you want your service to run under, what the service name is, description, etc.

然后,在您的 MSI 项目中,单击自定义操作编辑器"图标并将来自 YourServiceProject 的主要输出"添加到所有操作、安装、提交、回滚和卸载.

Then, in your MSI project, click on the Custom Actions Editor icon and add the "Primary output from YourServiceProject" to all of the actions, Install, Commit, Rollback, and Uninstall.

这是 Microsoft 的旧版演练.

祝你好运.

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

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