我有一个奇怪的问题,证明难以诊断。将包含名称空间Matrix.System
的程序集引用添加到Windows服务项目后,我现在在编译服务时遇到此错误:
类型或命名空间名称“ComponentModel”不存在于 namespace'Matrix.System'类型或命名空间名称'ServiceProcess' 名称空间'Matrix.System'
中不存在
但是服务中会产生错误:
private System.ComponentModel.IContainer components = null;
private System.ServiceProcess.ServiceInstaller serviceInstaller1;
在服务设置项目中我得到了这个:
无法找到依赖'IONIC.ZLIB'(签名='EDBE51AD942A3F5C' 版本='1.9.1.5')程序集'Apache.NMS.ActiveMQ.dll'
NMS程序集已经在安装项目中,一切正常,直到我添加了Matrix.System
程序集
答案 0 :(得分:4)
您可以像这样“root”命名空间:
using global::System.ComponentModel;
(然后在代码中删除完全限定的引用。)
或者,如果确实想要使用完全限定的命名空间:
private global::System.ComponentModel.IContainer components = null;
private global::System.ServiceProcess.ServiceInstaller serviceInstaller;
这看起来与其他依赖问题无关。
我的猜测是你在同一个班级:
using Matrix;
否则我不认为它首先是一个问题。
答案 1 :(得分:1)