ClickOnce 部署 Windows 服务? [英] ClickOnce deploy a Windows Service?

查看:31
本文介绍了ClickOnce 部署 Windows 服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 ClickOnce 部署 Windows 服务?如果是这样,您如何实现这一目标?

Is it possible to deploy a Windows Service using ClickOnce? If so, how do you achieve this?

目前我们必须使用一个Deployment项目,使用ClickOnce可以大大简化安装过程.

Currently we have to use a Deployment project, and the installation process could be simplified greatly by using ClickOnce.

推荐答案

AFAIK 你不能真正使用 ClickOnce 端到端来部署服务;文件位置(ClickOnce 安装到用户的配置文件中)和安装(ClickOnce 在很大程度上没有副作用)都存在问题.

AFAIK you can't really use ClickOnce end-to-end to deploy a service; there are issues with both the file locations (ClickOnce installs into a user's profile) and installation (ClickOnce is largely side-effect free).

但是,您可以将服务编写为可以从服务列表中自行安装/卸载的 exe,像这样;基本上,您将其编写为控制台 exe 并处理一些命令行参数,使用 AssemblyInstaller 从当前程序集[un]安装.另一个优点是可以使用相同的方法来帮助调试,因为您可以从命令行运行它.

You can, however, write a service as an exe that can self-install/uninstall from the services list, like so; basically, you write it as as a console exe and handle some command line args, using AssemblyInstaller to [un]install from the current assembly. Another advantage is that the same approach can be used to help debugging, since you can run it from the command line.

这篇关于ClickOnce 部署 Windows 服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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