beyondjay

 

2008年7月9日

将windows services制作成MSI安装程序

1、创建新的“安装项目”项目;
2、在解决方案资源管理器中添加相应的所有项目文件(在项目上右键“添加”—>“文件”);
3、在解决方案资源管理器上方 点击“自定义操作编辑器”;
4、在“自定义操作”视图中,点击“安装”,右击“添加自定义操作”,在弹出窗口“选择项目中的项”中选择对应的windows service所在的EXE文件,点击确定;
5、在“安装”下点击上一步选择的windows service程序文件,在属性窗口中设置参数(Arguments)为 “/install” ;(这一步可让安装程序MSI自动安装好Windows service)
6、同样在“卸装”项中添加windows service所在的EXE文件,并在属性窗口中设置参数(Arguments)为 “/uninstall” ;(这一步可以在“添加/删除程序”时自动卸装Windows service)
7、生成项目文件就OK了。 


o build your service project

  1. In Solution Explorer, right-click your project and select Properties from the shortcut menu. The project's Property Pages dialog box appears.
  2. In the left pane, select the General tab in the Common Properties folder.
  3. From the Startup object list, choose MyNewService. Click OK.
  4. Press Ctrl+Shift+B to build the project. 

Service Project Property Page

Now that the project is built, it can be deployed. A setup project will install the compiled project files and run the installers needed to run the Windows service. To create a complete setup project, you will need to add the project output, MyNewService.exe, to the setup project and then add a custom action to have MyNewService.exe installed.

To create a setup project for your service

  1. On the File menu, point to Add Project, and then choose New Project.
  2. In the Project Types pane, select the Setup and Deployment Projects folder.
  3. In the Templates pane, select Setup Project. Name the project MyServiceSetup.

A setup project is added to the solution. Next you will add the output from the Windows service project, MyNewService.exe, to the setup.

Service Setup Project

To add MyNewService.exe to the setup project

  1. In Solution Explorer, right-click MyServiceSetup, point to Add, then choose Project Output. The Add Project Output Group dialog box appears.
  2. MyNewService is selected in the Project box.
  3. From the list box, select Primary Output, and click OK.

    A project item for the primary output of MyNewService is added to the setup project. Now add a custom action to install the MyNewService.exe file.

To add a custom action to the setup project

  1. In Solution Explorer, right-click the setup project, point to View, then choose Custom Actions. The Custom Actions editor appears.
  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. 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. Build the setup project.

posted @ 2008-07-09 10:23 Tony Zhou 阅读(52) | 评论 (0)编辑

导航

统计

与我联系

搜索

 

常用链接

留言簿

我参与的团队

我的标签

随笔分类

随笔档案

最新评论

阅读排行榜

评论排行榜

60天内阅读排行