的ManagementObject类没有出现在System.Management命名空间了出现在、空间、ManagementObject、Management

由网友(別跟過去過卟去)分享简介:我试着写一些WMI在我的Windows窗体和的ManagementObject是得到安宁我的的类型或命名空间名称的ManagementObject无法找到错误下面是我未完成code:使用系统;使用System.Collections.Generic;使用System.Linq的;使用System.Text;使用...

我试着写一些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:);
 

解决方案 Introduction to the Comm System Object and Interference Analysis

右键单击右侧引用和手动添加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.

阅读全文

相关推荐

最新文章