This is the code. I just wanna test the library of System.ServiceProcess library.
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); } } }
However, when I run the C# code, its says:
Error 1 The type or namespace name 'ServiceProcess' does not exist in the namespace 'System' (are you missing an assembly reference?)
What went wrong?
Windows to save the deleted files in the Recycle Bin for a period (30 days or even longer by default). If you never cleared the recycle bin, it will take up a certain space on your system C drive, which as a result, your C drive is getting full. So we suggest you empty the recycle bin regularly.
Right-click on C: drive and select Properties, and then click "Disk Cleanup" button in the disk properties window. Step 2. In Disk Cleanup window, select the files you want to delete and click OK. If this does not free up much space, you can click Clean up system files button to delete system files.
If the C: drive is showing as red that means it doesn't have much free space left, see below to increase space. The following procedure cleans up files associated with your user account. You can also use Disk Cleanup to clean up all the files on your computer. 1.
If you're using a Windows machine, the most common issue is when the C drive is full and the D drive is empty. Unreasonable partition size allocation and installing too many programs can be the reasons your C drive is full, and the D drive is empty.
The System.ServiceProcess
namespace belongs to System.ServiceProcess.dll
and it isn't added as a reference by default.
For this, in the solution window, right click on "References" and choose "Add Reference..". Go to the .NET tab, and double click on System.ServiceProcess.dll.
This assembly is probably in the folder C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With