可以在不使用InstallUtil的情况下自行安装吗? 我应该使用服务安装程序类吗?我应该如何使用它?
我想能够调用以下内容:
MyService.exe -install
它将具有与调用相同的效果:
InstallUtil MyService.exe
解决方案
是的,这是完全可能的(即我这样做);您只需要引用正确的dll(System.ServiceProcess.dll)并添加一个安装程序类...
这是一个例子。
I have a standard .NET windows service written in C#.
Can it install itself without using InstallUtil? Should I use the service installer class? How should I use it?
I want to be able to call the following:
MyService.exe -install
and it will have the same effect as calling:
InstallUtil MyService.exe
解决方案
Yes, that is fully possible (i.e. I do exactly this); you just need to reference the right dll (System.ServiceProcess.dll) and add an installer class...
Here's an example.
更多推荐
安装没有InstallUtil.exe的.NET Windows服务
发布评论