How to add the reference for System.Management in VSCode?

1.3k Views Asked by At

How to add the reference for System.Management in VSCode? It always shows the error:

"The type or namespace name 'Management' does not exist in the namespace 'System'"

I've right clicked on System.Management and there is no option of any reference management. Really don't know how to deal with this.

3

There are 3 best solutions below

2
Arun_Raja1 On

Firstly select the Project in the top left corner.

enter image description here

Then right click the project in solution explorer then click Reference and Add.

enter image description here

Here within the Reference manager dialogue box you can choose the System.(Whatever you want).

0
nighthawk On

I guess you are developing Xamarin application. System.Management is Windows only namespace/package, you'll need platform specific way of getting the MAC address. Without more details it's hard to tell what exactly you are trying to accomplish but you could take a look at this question: https://stackoverflow.com/a/43885747/1286216

Also, be aware that newer Android devices randomize MAC address.

0
Mwiapfeo_142 On

Use the CLI in your project directory to add dependencies in VS Code. Here is the link from NuGET for System.Management :

https://www.nuget.org/packages/System.Management/

Should be something like that :

 dotnet add package System.Management --version 6.0.0