无法在 Dot Net Core 中使用 System.Management.dll [英] Not able to use System.Management.dll in Dot Net Core

查看:39
本文介绍了无法在 Dot Net Core 中使用 System.Management.dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果 System.Management.dllDot Net Core 不兼容,我应该如何收集硬件信息.

How should I gather Hardware Info if System.Management.dll is not compatible with Dot Net Core.

如何获取机器信息,如处理器 ID、磁盘卷号等

How do I get the Machine info like Processor Id, Disk Volume number etc.

推荐答案

.NET Core 3 现在支持 System.Management.目前,.NET Core 3 处于预览模式,其中预览 4 是最新的.

.NET Core 3 now supports System.Management. As of this time, .NET Core 3 is in preview mode with preview 4 as the most current.

您必须在 Visual Studio 的项目"菜单下选择管理 NuGet 包... 菜单项以安装最新版本的 System.Management.确保选中包含预览复选框,以便安装最新版本.

You will have to select the Manage NuGet packages... menu item under the Project menu in Visual Studio to install the latest version of System.Management. Make sure that the include previews checkbox is selected so that you will install the latest version.

之前版本的System.Management 抛出错误:

The previous version of System.Management throws an error:

无法使用 [Out] 属性按值编组字符串..."

"Cannot marshal a string by-value with the [Out] attribute..."

有关错误的详细信息,请参阅此链接.

See this link for more info about the error.

这篇关于无法在 Dot Net Core 中使用 System.Management.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆