0

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.

Camilo Terevinto
  • 31,141
  • 6
  • 88
  • 120
heinzQ
  • 23
  • 2
  • can you share more details about the code? – Arun_Raja1 Nov 24 '21 at 11:04
  • https://www.nuget.org/packages/System.Management/ - the package is for Windows, what are you planning to do with it on MacOS? – Camilo Terevinto Nov 24 '21 at 11:05
  • I'm trying to get client's MAC Adress by ManagementClass,and my developing device is Mac, because my app will run on ios&android. – heinzQ Nov 24 '21 at 13:44
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Nov 28 '21 at 14:18

3 Answers3

0

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.

nighthawk
  • 773
  • 7
  • 30
0

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
-1

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).

Arun_Raja1
  • 207
  • 1
  • 1