假设我正在名称空间内部工作,例如Org.Company
,并且此名称空间包含MyClass
。 我还在导入一个名为Company
的名称空间的nuget,其类名为OtherClass
。Castle Windsor命名空间冲突
所以,当我在我的Org.Company
命名空间里工作,我不能做到以下几点:
Company.OtherClass obj;
,因为编译器假定我实际上意味着:
Org.Company.Otherclass obj
哪些不存在。
所以,据我所知,而不是使用完全合格的名字,其实我必须导入其他命名空间,例如using Company;
但问题是,我需要从一个引用此OtherClass
XML文件(Castle Windsor配置文件)和完全限定名Company.OtherClass
不起作用。 有没有办法解决这个问题?更改名称空间名称不是一个可行的选项。
编辑: 这是我对我的温莎城堡的xml文件
<using assembly="MyProj, Version=1.0.0.0, Culture=neutral" />
...
<component
service="Company.IOtherClass"
type="Company.OtherClass"
/>
我收到以下错误:
{"Could not convert string 'Company.OtherClass' to a type. Make sure assembly containing the type has been loaded into the process, or consider specifying assembly qualified name of the type."}
大概是因为它看里面Org.Company
相反,在MyProj
组件中定义。
我想如果有一种方式来增加另一个<using />
声明引用NuGet包这可能是固定......有没有办法做到这一点?
Castle Windsor是否返回任何错误meesage?或者,您可以在那里使用完全限定的名称,包括装配体? – Pako