简体   繁体   English

Windows服务安装程序C#

[英]Windows Service Installer C#

I am working on a task, where I need to create a installer (.msi/exe) which can install my application as an Windows Service. 我正在执行一项任务,需要创建一个安装程序(.msi / exe),该安装程序可以将我的应用程序安装为Windows服务。 Also, I need to deploy this service from a non-alterable medium (ie from CDROM). 另外,我需要从不可更改的介质(即CDROM)部署此服务。 But I have my configuration files in the CDROM which I want to copy them to a local folder on hard drive before hosting the service. 但是,我的配置文件位于CDROM中,我想在托管服务之前将其复制到硬盘上的本地文件夹中。 I understand there are different ways for creating a installer 1) Using Install shield wizard in Visual Studio 2) Advanced Installers 我了解创建安装程序的方法有多种:1)在Visual Studio中使用安装盾向导2)高级安装程序

Which option do you think is optimal for my problem? 您认为哪种选择最适合我的问题? Also, I am not sure if it is possible to copy configuration files to Hard Drive and leave the dll's on the disk while installation. 另外,我不确定是否可以在安装时将配置文件复制到硬盘并将dll保留在磁盘上。

Please guide me through the right direction. 请指导我正确的方向。

I am not totally clear what your real problem is, however, I try an answer: 我尚不清楚您的真正问题是什么,但是,我尝试一个答案:

But I have my configuration files in the CDROM which I want to copy them to a local folder on hard drive before hosting the service 但是我的配置文件在CDROM中,我想在托管服务之前将其复制到硬盘上的本地文件夹中

If these files can be integrated in the VS solution, they can be tagged as "Content" (Build Action) and copied to the install location during setup. 如果这些文件可以集成到VS解决方案中,则可以在安装过程中将它们标记为“内容”(“构建操作”)并复制到安装位置。 If you need to be more flexible, you can write a setup extension. 如果需要更灵活,可以编写设置扩展。

and leave the dll's on the disk while installation 并在安装时将dll保留在磁盘上

I do not understand this. 我不明白这个。 Which DLLs ? 哪些DLL?

If you are interested in some tips for creating a sample service with a complete setup, you can check my SO answer: https://stackoverflow.com/a/28853490/4547223 如果您对创建具有完整设置的示例服务的一些技巧感兴趣,可以查看我的SO答案: https : //stackoverflow.com/a/28853490/4547223

Or look at: http://www.rsprog.de/samplewindowsservice/ 或查看: http : //www.rsprog.de/samplewindowsservice/

You may probably comment you experiences with that and tell us which files do you want to copy to which location and more about the background. 您可能会对此发表评论,并告诉我们要将哪些文件复制到哪个位置以及有关背景的更多信息。 I will try to refine my answer then. 然后,我将尝试完善我的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM