简体   繁体   English

为什么在VS2010 C#中不能使用ManagementObjectSearcher

[英]Why can't use ManagementObjectSearcher in VS2010 C#

I'm trying to use the code from this post: get com port number of an USB adapter 我正在尝试使用本文中的代码: 获取USB适配器的com端口号

Then I got this message: why? 然后我收到此消息:为什么? 在此处输入图片说明

You have to add a reference to System.Management Manually through VS 2010. 您必须通过VS 2010手动添加对System.Management的引用。

  1. Right Click on Project, Add References 右键单击项目, 添加引用

  2. Select the Assemblies Tab and Search for System.Management . 选择组件选项卡并搜索System.Management。 Then Add Reference. 然后添加参考。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM