0

I would like to install and uninstall a windows service programmably, But i can not use ServiceInstaller in my "WPF App(.NET Framework)" project.

enter image description here

enter image description here

Did i miss some references?

  • 1
    Do you control the source of the service? If you do then i suggest using topshelf. Your service exe is then a cosole app which has built in install and uninstall you could use. – Andy Nov 18 '20 at 17:10
  • Yes, but it is a Worker Service project –  Nov 18 '20 at 18:21
  • 1
    Topshelf is for easily developed and installed windows services. Read up on it. – Andy Nov 18 '20 at 19:39

1 Answers1

0

In a project that targets the .NET Framework, you should add a reference to System.ServiceProcess under Project->Add Reference->Assemblies->Framework.

The ServiceInstaller class is not available in .NET Core or .NET 5.

mm8
  • 163,881
  • 10
  • 57
  • 88