Dlaczego mój C # nie ma biblioteki System.ServiceProcess?
To jest kod. Chcę tylko przetestować bibliotekę biblioteki System.ServiceProcess.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ServiceProcess;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("hi");
var srv = new ServiceController("MyService");
Console.WriteLine("MyService Status {0}", srv.Status);
if (srv.Status != ServiceControllerStatus.Running)
srv.Start();
System.Threading.Thread.Sleep(1000000);
}
}
}
Jednak po uruchomieniu kodu C # mówi:
Błąd 1 Nazwa lub nazwa przestrzeni nazw „ServiceProcess” nie istnieje w przestrzeni nazw „System” (czy brakuje odwołania do zespołu?)
Co poszło nie tak?