开发者

Trying to get CPU ID

I'm trying to get the CPU ID from the machine.

I found the following code somewhere:

System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass);
System.Management.ManagementObjectCollection moc = mc.GetInstances();

However I get the following error:

Error   1   Th开发者_JAVA百科e type or namespace name 'ManagementClass' could not be found (are you missing a using directive or an assembly reference?

Any idea what could be the problem?

EDIT

At the top of my document I have:

using System.Management;


You need to add a reference to the assembly System.Management.dll (System.Management namespace) to your project.

Also make sure you are not using the .NET 4 client profile as target framework, if so switch to ".NET framework 4".


Did you add a reference to the System.Management assembly?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜