“管理范围”找不到
我收到此错误:
CS0246:找不到类型或命名空间名称“ManagementScope”...
在这一行上:
private ManagementScope plainScope = null;
该项目构建正常,但是我在运行时遇到上述编译器错误我尝试加载任何页面。是的,我有适当的 using System.Management
语句。是的,我已包含 System.Management
作为参考。这是我的 using 语句块:
using System;
using System.Collections.Generic;
using System.Data;
using System.Management;
我已阅读这个问题 ,我的项目针对的是 .Net 3.5 Framework,而不是 4。如果有帮助,有问题的代码位于项目的 App_Code 目录中包含的类文件内。文件的“高级属性”下的“构建操作”设置为“编译”。我相信这可能与问题有关,因为我最近在 aspx
文件的代码隐藏中使用了 System.Management
命名空间,并且它被编译并跑得很好。
I'm getting this error:
CS0246: The type or namespace name 'ManagementScope' could not be found...
On this line:
private ManagementScope plainScope = null;
The project builds fine, however I get the above compiler error during runtime when I try to load any page. Yes, I have the appropriate using System.Management
statement. Yes, I have included System.Management
as a reference. This is my using statement block:
using System;
using System.Collections.Generic;
using System.Data;
using System.Management;
I have read this question, and my project is targeting the .Net 3.5 Framework, not 4. In case it helps, the offending code is inside a class file which is included in the App_Code directory of the project. The "Build Action", under Advanced Properties of the file is set to "Compile". I believe that this might have something to do with the problem seeing as I was using the System.Management
namespace recently in the code-behind of an aspx
file and it compiled and ran just fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要在项目引用中添加
System.Management
you need to add
System.Management
in the projects references您是否考虑过使用融合?
该工具将记录所有加载 .Net 框架制作的程序集的尝试...它准确地显示了它正在查找的文件以及它尝试在何处查找它。
注意:您需要以管理员身份运行它才能更改日志记录设置。如果您想手动设置,则提示的日志位置应指向空目录
Have you considered using fusion?
This tool will log all attempts to load assemblies made by the .Net framework... It shows exactly what file it was looking for and where it tried looking for it.
NB: You need to run it as an administrator to be able to change logging settings. The Log location it prompt for should point at an empty directory if you want to set it manually