的ManagementObject类没有出现在System.Management命名空间了 [英] ManagementObject Class not showing up in System.Management namespace

查看:147
本文介绍了的ManagementObject类没有出现在System.Management命名空间了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着写一些WMI在我的Windows窗体和的ManagementObject是得到安宁我的

的类型或命名空间名称的ManagementObject无法找到错误

下面是我未完成code:

 使用系统;
使用System.Collections.Generic;
使用System.Linq的;
使用System.Text;
使用System.IO;
使用的System.Threading;
使用System.Security.Policy;
使用System.Management;
使用System.Management.Instrumentation;


命名空间ConsoleApplication2
{
    类节目
    {
        静态无效的主要(字串[] args)
        {


            的ManagementObject盘=新的ManagementObject(Win32_LogicalDisk.DeviceID = \C:\);
 

解决方案

右键单击右侧引用和手动添加System.Management。即使我把它using语句中我还是不得不这样做。有一次,我做到了,一切工作正常。

I'm trying to write some WMI in my windows form and the ManagementObject is givin me the

"The type or namespace name 'ManagementObject' could not be found" Error

Here is my un-complete code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading;
using System.Security.Policy;
using System.Management;
using System.Management.Instrumentation;


namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {


            ManagementObject disk = new ManagementObject("Win32_LogicalDisk.DeviceID=\"C:\"");

解决方案

Right-click References on the right and manually add System.Management. Even though I included it in the using statement I still had to do this. Once I did, all worked fine.

这篇关于的ManagementObject类没有出现在System.Management命名空间了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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