Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the ManagementEventWatcher class no longer available in the System.Management namespace?

Tags:

c#

.net

asp.net

I'm getting the following error message:

The type or namespace name 'ManagementEventWatcher' does not exist in the namespace 'System.Management' (are you missing an assembly reference?)

I have included System.Management in my project references, yet the type cannot be found.

I have run Visual Studio as administrator and still get the same result. Has ManagementEventWatcher gone away?

like image 995
Mark Avatar asked Mar 06 '14 11:03

Mark


1 Answers

You are probably missing the assembly reference to System.Management.dll. The using statement just brings names into scope, to save you typing the prefix: it doesn't actually add a DLL reference into the project.

If you have added the reference and didn't include using System.Management in your class then you gets this error message. Also if you just include using System.Management in your class and didn't include it's reference into your project, you will get a similar error message. You have to add the reference of System.Management.dll to your project just like I have shown below.


Go to the Solution Explorer, and expand your project, right click on the References folder/option and select Add References from the context menu. Now select the .Net tab and select the System.Management from the list and click OK.

In case if you have VS2010, VS2012, VS2013... Add the reference by right click on the References folder/option and select Add References from the context menu. Now select the Assemblies and then Framework tab and select the System.Management from the list and click OK.

enter image description here

like image 92
Suhaib Janjua Avatar answered Oct 16 '22 20:10

Suhaib Janjua