Not able to use System.Management.dll in Dot Net Core

后端 未结 4 1341
孤街浪徒
孤街浪徒 2021-02-18 13:31

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

How do I get the Machine info like Processo

4条回答
  •  既然无缘
    2021-02-18 14:13

    .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.

    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.

    The previous version of System.Management throws an error:

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

    See this link for more info about the error.

提交回复
热议问题