unity 4 Please check your configuration file and verify this type name.
The problem is in you config file. You are mixing two concepts with some incorrect syntax.
The <assembly... />
and <namespace ... />
nodes provide an assembly and namespace search order when your <register ... />
node contains a type that cannot be found by itself. If a type cannot be found, it searches through all combinations of [namespace].Type, [assembly]
. Here's where the error is: it does NOT search for Type, [assembly]
. If any <namespace ... />
nodes are defined, it does NOT try appending only the assembly.
So your <register type="Biblioteca.Contracts.IManterCategoriaBO" mapTo="Biblioteca.Business.ManterCategoriaBO" />
node has the type Biblioteca.Contracts.IManterCategoriaBO
which does not contain the assembly, so it cannot be found. Therefore, it needs to do a search. You did specify <namespace ... />
nodes, so it will first tryBiblioteca.Biblioteca.Contracts.IManterCategoriaBO, Biblioteca
. Notice the duplicate Biblioteca name.
Here's a corrected config file.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration" />
</configSections>
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<assembly name="Biblioteca" />
<assembly name="Biblioteca.Contracts" />
<assembly name="Biblioteca.Business" />
<namespace name="Biblioteca" />
<namespace name="Biblioteca.Contracts" />
<namespace name="Biblioteca.Business" />
<container>
<register type="IManterCategoriaBO" mapTo="ManterCategoriaBO" />
<!-- Or this works -->
<!--<register type="Biblioteca.Contracts.IManterCategoriaBO, Biblioteca" mapTo="Biblioteca.Business.ManterCategoriaBO, Biblioteca" />-->
</container>
</unity>
</configuration>
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)