本文介绍了ManagementEventWatcher类在System.Management命名空间中不再可用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我收到以下错误消息:我已经包含了 System.Management 在我的项目引用中,但找不到该类型。I have included System.Management in my project references, yet the type cannot be found.我已经以管理员身份运行Visual Studio,但仍然得到相同的结果。 ManagementEventWatcher 已经消失了吗?I have run Visual Studio as administrator and still get the same result. Has ManagementEventWatcher gone away?推荐答案您可能缺少程序集引用到 System.Management.dll 。 using语句只是将名称带入范围,以省去您键入前缀的麻烦:它实际上并未在项目中添加DLL引用。You are probably missing the assembly reference to System.Management.dll. The using statement just brings names into scope, to save you typing the prefix: it doesn't actually add a DLL reference into the project.如果已添加引用并且没有在类中包含使用System.Management 的,那么您会收到此错误消息。另外,如果仅在班级中包含使用System.Management 的,而未在项目中包含其引用,则您将收到类似的错误消息。就像我在下面显示的那样,必须将 System.Management.dll 的引用添加到您的项目中。If you have added the reference and didn't include using System.Management in your class then you gets this error message. Also if you just include using System.Management in your class and didn't include it's reference into your project, you will get a similar error message. You have to add the reference of System.Management.dll to your project just like I have shown below.转到解决方案资源管理器,展开项目,右键单击引用文件夹/选项,然后从上下文菜单中选择添加引用。现在,选择.Net选项卡,然后从列表中选择 System.Management ,然后单击确定。Go to the Solution Explorer, and expand your project, right click on the References folder/option and select Add References from the context menu. Now select the .Net tab and select the System.Management from the list and click OK.您有VS2010,VS2012,VS2013 ... 通过右键单击引用文件夹/选项添加引用,然后从上下文菜单中选择添加引用。现在,选择程序集,然后选择框架选项卡,然后从列表中选择 System.Management 并单击确定。In case if you have VS2010, VS2012, VS2013...Add the reference by right click on the References folder/option and select Add References from the context menu. Now select the Assemblies and then Framework tab and select the System.Management from the list and click OK. 这篇关于ManagementEventWatcher类在System.Management命名空间中不再可用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-17 03:51