Process Class Not Found in System.Diagnostics? (Sy

2019-06-11 05:49发布

问题:

I am using .NET Framework 3.5, I have referenced all the assemblies, I have double checked everything, but still this irritating error

 CS0234: The type or namespace name 'Process' does not exist in the namespace               
 'System.Diagnostics' (are you missing an assembly reference?) (CS0234) (Proj1)

According to MSDN and various other sources, the Process class is definitely located in System.dll in the System.Diagnostics namespace. Then What In The World Is The Problem?

回答1:

Ensure you are referencing the correct System.Dll. The version should be roughly v2.0.50727



回答2:

I was also facing the same problem. I was using CodeDom to execute code that required Process Class. So the solution for me was to refrence System.dll in options. Here is the solution, if any one needs it.

CSharpCodeProvider cs = new CSharpCodeProvider();
cs.CompilerOptions = "/optimize /reference:System.dll";