找不到“ManagementScope”

时间:2011-02-08 01:51:13

标签: asp.net compiler-errors system.management

我收到了这个错误:

CS0246: The type or namespace name 'ManagementScope' could not be found...

在这一行:

private ManagementScope plainScope = null;

项目构建正常,但是当我尝试加载任何页面时,我在运行时遇到上述编译器错误。是的,我有适当的using System.Management声明。是的,我已将System.Management作为参考。这是我的using语句块:

using System;
using System.Collections.Generic;
using System.Data;
using System.Management;

我已阅读this question,我的项目针对的是.Net 3.5 Framework,而不是4.如果有帮助,有问题的代码位于项目的App_Code目录中的类文件中。文件高级属性下的“构建操作”设置为“编译”。我相信这可能与问题有关,因为我最近在System.Management文件的代码隐藏中使用了aspx命名空间,并且编译并运行得很好。

2 个答案:

答案 0 :(得分:0)

您是否考虑过使用fusion

此工具将记录所有尝试加载由.Net框架生成的程序集...它显示了它正在查找的文件以及它尝试查找的位置。

注意:您需要以管理员身份运行它才能更改日志记录设置。如果要手动设置,则提示的日志位置应指向空目录

答案 1 :(得分:0)

您需要在项目参考中添加system.management