'ManagementClass' does not exist in the namespace 'System.Management'

你说的曾经没有我的故事 提交于 2019-11-29 09:23:06

You need to add a reference to System.Management in your project.

I think the issue here is that you don't have a proper "pointer" to the System.Management assembly. You must:

  • Use a using statement - in some of your code, you didn't prefix classes w/ System.Management, so you should either include:

a.)

using System.Management

or

b.) a using block

using(System.Management) 
{  
//your code goes here
}

Next, you need to have a real assembly reference. To do this in Visual Studio, right click on your project (or on References) in the Solution Explorer window and click Add Reference. After the list tabulates, find System.Management.dll in the .NET tab. Once you add it, it should work!

Ajay Tyagi

In the solution explorer:

  1. add reference
  2. find and add system.management in .NET class

that's it

Have you got the System.Management assembly referenced?

Khawaja Asim

Please first make sure you add the Library Systems.Management in to your project references.

Then just use that referred assembly by including in your class.

using System.Windows;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!