Microsoft.Management.Infrastructure 所在的位置

问题描述:

我需要获取硬盘信息,我想使用 WMI.

I need to get hdd info, and I want to use WMI.

来自 msdn 的示例

example from msdn

using Microsoft.Management.Infrastructure;
...
string Namespace = @"root\cimv2";
string className = "Win32_LogicalDisk";

CimInstance myDrive = new CimInstance(className, Namespace);

我正在使用 Visual Studio 2015.我在用于测试 WMI 的解决方案中创建了一个 控制台应用程序.没有Microsoft.Management.Infrastructure,如何添加?

I'm using Visual Studio 2015. I've created a console application in solution for testing WMI. There is no Microsoft.Management.Infrastructure, how to add it?

您是否添加了对 Microsoft.Management.Infrastructure.dll 的引用?(如MSDN 页面.)

Have you added a reference to Microsoft.Management.Infrastructure.dll? (As specified at the top of the MSDN page.)