如果 System.Management.dll
与 Dot Net Core 不兼容,我应该如何收集硬件信息。
如何获取处理器 ID、磁盘卷号等机器信息
最佳答案
.NET Core 3 现在支持 System.Management。截至目前,.NET Core 3 处于预览模式,最新的预览版本为 4。
您必须选择 Visual Studio 中“项目”菜单下的管理 NuGet 程序包... 菜单项才能安装最新版本的 System.Management
。确保选中包含预览复选框,以便安装最新版本。
以前版本的 System.Management
抛出一个错误:
"Cannot marshal a string by-value with the [Out] attribute..."
参见 this link有关错误的更多信息。
关于c# - 无法在 Dot Net Core 中使用 System.Management.dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40567595/