System.Management currently is only supported for Windows desktop applications.

511 阅读1分钟

解决方法

使用低版本

  1. System.Management v7.0.1
<PackageReference Include="System.Management" Version="7.0.1" />
  1. 主工程引用 System.Management v7.0.1

  2. 不适用cpu

//不用cpu
//hardwareInfo.RefreshCPUList();          
//error:Performance Counters are not supported on this platform.

参考

  1. Using Library project .NET Standard 2.1 and System.Management Nuget v7.0.0
  2. Trying to call any object of System.Management from WPF application .NET Core 3.1 and receive the error:
    System.Management throw System.PlatformNotSupportedException: 'System.Management currently is only supported for Windows desktop applications.'

Receive Error while trying to use: System.Management throw System.PlatformNotSupportedException: 'System.Management currently is only supported for Windows desktop applications.' · Issue #78464 · dotnet/runtime