2012-07-07 104 views
1

我有一个奇怪的问题,证明难以诊断。添加程序集引用后名称空间中不存在类型或命名空间名称'ComponentModel'

类型或命名空间名称ComponentModel'不中 命名空间中存在“:添加了包含命名空间Matrix.System到Windows服务项目的程序集引用后,编译服务,当我现在收到此错误

private System.ComponentModel.IContainer components = null; 
private System.ServiceProcess.ServiceInstaller serviceInstaller1; 
0123:Matrix.System”的类型或命名空间名称ServiceProcess在服务中产生Matrix.System‘

的错误,虽然“ 没有命名空间中存在’

,并在服务安装项目我得到这个:

无法找到依赖“IONIC.ZLIB”装配“Apache.NMS的(签名=“EDBE51AD942A3F5C” 版本=“1.9.1.5”) .ActiveMQ.dll”

网管组件已经在安装项目,直到我加入了Matrix.System装配

回答

4

您可以‘根’的命名空间类似这样的一切工作正常:

using global::System.ComponentModel; 

(然后摆脱在你的代码完全合格的引用)

或者,如果你真的要使用完全合格的命名空间:

private global::System.ComponentModel.IContainer components = null; 
private global::System.ServiceProcess.ServiceInstaller serviceInstaller; 

这看起来无关其他依赖性问题。

我的猜测是,在同一个类你有:

using Matrix; 

不然我也不会想到它是摆在首位的问题。

+0

谢谢你。阅读你的答案让我意识到Matrix.System在某种程度上掩盖了System命名空间。将Matrix.System更改为其他内容并重新导入可解决问题。非常感谢 – codebrane 2012-07-07 08:47:09

相关问题