MatthewKing / DeviceId

A simple library providing functionality to generate a 'device ID' that can be used to uniquely identify a computer.
MIT License
729 stars 118 forks source link

.NET Standard with Nuget package #3

Closed ssteiner closed 6 years ago

ssteiner commented 6 years ago

Could it be that the .NET standard version is missing some code? I just added deviceId 4.0 to y .NET standard 2.0 project, and it seems the dll does not contain the DeviceIdBuilderExtensions, so calling any .AddXYZ() methods on the DeviceIdBuilder is not possible.

MatthewKing commented 6 years ago

Hi,

Most of the .Add() methods on DeviceIdBuilder are present in the .NET Standard DLL, with the exception of .AddMacAddress(), .AddProcessorId(), and .AddMotherboardSerialNumber(). These three are missing by design, as they depend on WMI (which isn't present in .NET Standard).

I'm in the process of planning a new release that uses the Windows Compatibility Pack for .NET Core to add in these extra features.

If you don't want to wait, you can directly include the DeviceId source code in your project, and reference the Microsoft.Windows.Compatibility package, and everything should work.

Hope this helps!

MatthewKing commented 6 years ago

Actually, it looks like the Windows Compatibility Pack isn't really needed. I'll can probably just add a reference to System.Management and that should be sufficient.

Those three methods will still be Windows-only, though.

MatthewKing commented 6 years ago

I've just pushed a new version that should add support for the missing functionality (on Windows only).

Thanks!