Missing directive or assembly reference using WMI ManagementObjectSearcher?

前端 未结 1 2061
半阙折子戏
半阙折子戏 2021-01-05 07:06

I have found this link:

Detect Antivirus on Windows using C#

However when I try this code in visual c# express edition 2008 it says :

Error 1         


        
相关标签:
1条回答
  • 2021-01-05 08:06

    You are missing a reference to the assembly containing the type ManagementObjectSearcher, which is in the System.Managementnamespace. Add this namespace and it should work.

    You will have to rightclick the project -> add reference and add the System.Management assembly. System.Managment is not added automatically with the creation of a new project.

    WMI reference
    WMI + C#

    0 讨论(0)
提交回复
热议问题