自定义Windows Service安装程序 [英] Customising a Windows Service installer program

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

问题描述

我已经使用VS2015用C#编写了一个Windows Service程序,该程序使用FileSystem观察器来等待csv文件到达文件夹,然后将数据从文件导入SQL数据库中.

I have written a Windows Service program in C# using VS2015  that uses a FileSystem watcher to wait for csv files arriving in a folder and then importing the data from the files into a SQL database.

我已经在计算机上成功安装了该软件,并看到它可以作为服务运行.但是,我随后向安装程序中添加了一些自定义操作,以使最终用户能够通过使用自定义中显示的文本框来重新设置app.config文件中的某些键. 安装过程(我已经添加了VS2010安装程序)以输入文件夹监视路径以及服务器和数据库名称.

I have installed this successfully on my machine and seen it run as a service. However, I have then added some custom actions to the installer to enable the end user to re-set some keys in the app.config file by using the text boxes presented in the custom install process (I have added back the VS2010 installer) to enter the folder watch path and server and DB name.

自定义安装后,对app.config文件的修改可以正常工作-我可以在安装文件夹中看到该文件,但不再安装该服务.我正在寻找一些帮助,以找出为什么这种方法不再起作用.

After customising the install, the modification of the app.config file works fine - I can see the file in the installation folder, but the service is no longer installed. I am looking for some assistance to find why this no longer works.

谢谢

戴夫

dshaw

推荐答案

大卫,

您是说未安装该服务,但在服务列表中看不到该服务吗?如果是,请确保在安装服务之前已执行以下步骤.

Do you mean the service is not installed but you can't see it in services list? If yes, please make sure you have do following steps before you install your service.

1.在解决方案资源管理器中,右键单击安装项目,指向视图",然后选择自定义操作".自定义动作编辑器出现.

1.In Solution Explorer, right-click the setup project, point to View, then choose Custom Actions. The Custom    Actions editor appears.

2.在自定义操作"编辑器中,右键单击自定义操作"节点. ,然后选择添加自定义操作.    在项目"对话框中选择项目".

2.In the Custom Actions editor, right-click the Custom Actions node    and choose Add Custom Action. The    Select Item in Project dialog box appears.

3.双击列表框中的应用程序文件夹以将其打开,然后选择MyNewService的主要输出(活动),然后单击确定.主要输出被添加到 的所有四个节点自定义操作 安装,提交和   回滚并卸载.

3.Double-click the application folder in the list box to open it, select    primary output from MyNewService    (Active), and click OK. The primary output is added to all four nodes of    the custom actions  Install, Commit,    Rollback, and Uninstall.

4.构建安装项目.

最好的问候,
王丽

Best Regards,
Li Wang


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

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