I just installed Visual Studio 2010 with .NET Framework 4.0 and C# and I can't find anything under the System.Management
namespace except for System.Management.Instrumentation
. All the online documentation at MSDN about WMI keeps telling me that I have to use classes such as System.Management.ManagementObjectSearcher
or System.Management.ManagementScope
but I don't see those classes.
What happened to those classes and how can I access them?
The System. Management namespace provides rich set of management information and management events about the system, devices, and applications instrumented to the Windows Management Instrumentation.
Right click on the references in your project. Click Add Reference. Select the file (Project Root > Bin > System. Management.
In C#, the . NET Base Class Library(BCL) has a language-specific alias which is Object class with the fully qualified name as System.
You need to add a reference to System.Management.dll
to your project.
You can see System.Management.Instrumentation
without adding a reference to System.Management.dll
because it is included in a different library (System.Core.dll
, which is included as a reference automatically), but you cannot access the other types contained by that namespace without explicitly adding a reference to the System.Management.dll
library.
If you're using VS 2010, switch the project to .Net 4.0. Then click on Add References, you will now see System.Management in the list (and not only System.Management.Instrumentation). You can now use the System.Management classes.
I just had the same problem, and that fixed it!
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