Search code examples
c#wpfwindows-servicesservice-installer

Why ServiceInstaller is not available in my "WPF App(.NET Framework)" projetct?


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?


Solution

  • 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.