情况:2个项目 1个项目是WCF服务库(ProjA)类型 1项目是带有Unity引用(ProjB)的控制台应用程序
在ProjB内部我想做UnityContainer.LoadConfiguration并解析ProjA中的类型。
我在ProjB.AppConfig文件中试过这个
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<alias alias="IClass" type="OtherNameSpace.IClass, OtherNameSpace"/>
<alias alias="Class" type="OtherNameSpace.Class, OtherNameSpace"/>
<container>
<register type="IClass" mapTo="Class"/>
</container>
</unity>
作为参考,ProjB名称空间是ClientHost,ProjB名称空间是OtherNameSpace。
我得到的异常是:类型名称或别名OtherNameSoace.IClass,无法解析OtherNameSpace。请检查您的配置文件并验证此类型名称。