What's the best way to set a windows service description in .net

前端 未结 5 901
离开以前
离开以前 2021-02-18 16:12

I have created a C# service using the VS2005 template. It works fine however the description of the service is blank in the Windows Services control applet.

5条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-18 16:45

    To clarify on how to accomplish this without using code:

    • Add a service installer to your project as described here: http://msdn.microsoft.com/en-us/library/ddhy0byf%28v=vs.80%29.aspx

    • Open the installer (e.g. ProjectInstaller.cs) in Design view.

    • Single-click the service installer component (e.g. serviceInstaller1) or right-click it and choose Properties.

    • In the Properties pane, set the Description and/or DisplayName (this is also where you set StartType etc.) Description is probably all you want to change, although if you want to give a slightly more human-readable DisplayName (the first column in Services manager) you can also do so.

    • If desired, open the auto-generated designer file (e.g. ProjectInstaller.Designer.cs) to verify that the properties were set correctly.

    • Build the solution and install using installutil.exe or other means.

提交回复
热议问题