使用WMI ManagementObjectSearcher缺少指令或程序集引用?

Ren*_*ndy 7 c# windows security antivirus

我找到了这个链接:

使用C#在Windows上检测防病毒

但是,当我在visual c#express edition 2008中尝试此代码时,它说:

Error 1 The type or namespace name 'ManagementObjectSearcher' could not be found 
(are you missing a using directive or an assembly reference?) 
C:\Users\Andy\Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs 15 17 ConsoleApplication1
Run Code Online (Sandbox Code Playgroud)

在2条线上看起来很重要的其他类似错误!

看起来代码段缺少一些导入或什么?

我正在使用Windows 7 ...请帮忙!

安迪

Fem*_*ref 25

您缺少对包含类型的程序集的引用,该类型ManagementObjectSearcher位于System.Management名称空间中.添加此命名空间,它应该工作.

您必须右键单击项目 - >添加引用并添加System.Management程序集.创建新项目时不会自动添加System.Managment.

WMI参考
WMI + C#