假设我正在一个名为
所以,当我在我的
据我所知,我必须导入其他命名空间,如
然而,问题在于我需要从XML文件(Castle Windsor配置文件)引用这个
我遇到了以下错误:
{"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
的命名空间中工作,该命名空间包含MyClass
。我还导入了一个名为Company
,类名为OtherClass
的NuGet。所以,当我在我的
Org.Company
命名空间中工作时,我不能执行以下操作:
Company.OtherClass obj;
,因为编译器会认为我实际上是指:Org.Company.Otherclass obj
,而这个类并不存在。据我所知,我必须导入其他命名空间,如
using Company;
,而不是使用完全限定名称。然而,问题在于我需要从XML文件(Castle Windsor配置文件)引用这个
OtherClass
,而完全限定名称Company.OtherClass
无法正常工作。有没有什么方法可以解决这个问题?更改命名空间名称不是一个可行的选项。
编辑:
这是我在我的Castle Windsor 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包,那么这个问题就可以解决。是否有办法做到这一点?