There are several different ways to reference third party code in a .NET app:
- NuGet package (preferred)
- Assembly reference from GAC (for NET Framework assemblies and legacy code)
- Binary reference (for assemblies not in the GAC)
- COM reference (for COM components only)
- DllImport (for native binaries only)
So the first question is what is system.devices
? Can you provide a reference to what this binary is? The only references I can find relate to Mono.
The second question is what type of app are you building and what framework version are you targeting? In general you can only reference binaries that are compatible with your framework. For example you cannot reference an assembly from the GAC with a NET 6 app.
If the binary is a native DLL and not a NET assembly then DllImport is the only option and you won't be adding a reference to it in your project. If it is exposed as a COM object then you would add a reference using the Add COM Reference option and you would then have to select it from the type library selector. The COM component has to be installed on your machine and bitness (x86 or x64) compatible with your project.
For NET assemblies look in NuGet first. I don't see any system.devices
package but there are packages with that in the name.
If you cannot find a NuGet package AND you have the assembly available then you'll be stuck with using a binary reference. That means you need to put the binary someplace in your solution (not the output directory) and then add a binary reference to it using the Browse button.