问题描述
我刚安装了Visual Studio 2010的.NET Framework 4.0和C#,我无法找到 System.Management
命名空间下的任何东西,除了 System.Management.Instrumentation
。在MSDN有关WMI的所有在线文档不断告诉我,我必须使用类,如 System.Management.ManagementObjectSearcher
或 System.Management.ManagementScope
,但我没有看到这些类。
I just installed Visual Studio 2010 with .NET Framework 4.0 and C# and I can't find anything under the System.Management
namespace except for System.Management.Instrumentation
. All the online documentation at MSDN about WMI keeps telling me that I have to use classes such as System.Management.ManagementObjectSearcher
or System.Management.ManagementScope
but I don't see those classes.
发生了什么事,以这些类以及如何访问它们?
What happened to those classes and how can I access them?
推荐答案
您需要的以 System.Management.dll
引用您的项目。
You need to add a reference to System.Management.dll
to your project.
您可以看到 System.Management.Instrumentation
不添加引用 System.Management.dll
,因为它是包括在不同的库( System.Core.dll的
,这是自动作为参考),但你不能访问包含由该命名空间中的其他类型的不明确增加一个参考到 System.Management.dll
库。
You can see System.Management.Instrumentation
without adding a reference to System.Management.dll
because it is included in a different library (System.Core.dll
, which is included as a reference automatically), but you cannot access the other types contained by that namespace without explicitly adding a reference to the System.Management.dll
library.
这篇关于哪里是我的System.Management。*类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!