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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With