Closed fairking closed 2 years ago
This is an issue with the Microsoft.Management.Infrastructure package.
It only ships with the following runtimes:
If you're using a different runtime it won't work.
Your options are:
I don't understand. I would rather write my own code then. Without any dependency. Just based on System.Management
.
This library is not compatible with windows as I understand.
It is compatible with Windows.
DeviceId.Windows.Wmi
uses System.Management
. This is the one that the readme recommends that you use.
DeviceId.Windows.Mmi
uses MMI, but it's not recommended (for the reasons you've seen above) unless System.Management
is not available for your use case. If you're able to use System.Management
then just use DeviceId.Windows.Wmi
.
Ok, I switched to v6.0 and the following example is working on Windows (runtime win-x64
) 👍
string systemId = new DeviceIdBuilder()
.AddMacAddress()
.AddOsVersion()
.OnWindows(windows => windows
.AddProcessorId()
.AddMotherboardSerialNumber()
.AddSystemUuid())
.OnLinux(linux => linux
.AddCpuInfo()
.AddMotherboardSerialNumber()
.AddProductUuid())
.UseFormatter(new HashDeviceIdFormatter(() => MD5.Create(), new Base64UrlByteArrayEncoder()))
.ToString();
Thanks a lot for your help. 🥇
Glad you got it going!
DeviceId: 5.3.0 Running the app on windows 10 I have the following error:
My code looks like this:
Is it a bug or am I doing something wrong? Appreciate any help.