在System.Diagnostics中找不到进程类?(System.dll ? ?)

本文关键字:System dll 进程 Diagnostics 找不到 | 更新日期: 2023-09-27 18:09:43

我使用的是。net Framework 3.5,我已经引用了所有的程序集,我已经仔细检查了一切,但仍然这个恼人的错误

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

根据MSDN和其他各种来源,Process类肯定位于系统中的System.dll中。诊断名称空间。那么到底是什么问题呢?

在System.Diagnostics中找不到进程类?(System.dll ? ?)

确保您引用了正确的System.Dll。版本应该大致为v2.0.50727

我也面临着同样的问题。我使用CodeDom来执行需要Process Class的代码。所以我的解决方案是在选项中引用System.dll。这是解决办法,如果有人需要的话。

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