1、自动启动的方法设置:
请先设置以下两个控件:
设置serviceProcessInstaller1控件的Account属性为“LocalSystem”.
设置serviceInstaller1控件的StartType属性为"Automatic".
服务上添加安装程序后,通过编码实现自动启动,方法如下:
给serviceProcessInstaller1添加AfterInstall事件,然后添加如下代码:
2、设置允许服务与桌面交互方法:
参考:
http://www.cnblogs.com/joejoe/archive/2009/05/09/1453250.html
http://www.cnblogs.com/wfwup/archive/2009/01/14/1375382.html
3、方法3:在ProjectInstaller的视图设计器中添加控件ServiceController,即serviceController1,添加serviceInstaller1的AfterInstall事件: