I am having figuring out an unexpected behavior in using Unity application block. I have Project A as my start up project.
Project A has a project reference to Project B which has a project reference to Project C.
Project A uses unity to resolve reference to classes defined in Project B. These classes in turn use Unity to resolve reference to dependencies on classes in Project C.
So, since I am only using interfaces defined in a common project and resolving concrete references using Unity, there is no need to add project/assembly references for Project B or Project C in Project A.
But in that case Unity is not being able to resolve the references. If on the other hand, I add the references for both the projects, there are no issues. Why is it necessary? Is there any way around this?
Is this because Unity will need the dll to be in context and loaded in order to construct types from these assemblies? Somehow this doesn’t feel right.
Can anybody help me in understanding this beahvior.
The code in the Unity assembly needs to be able to resolve the concrete classes you’ve registered. This means that it needs to have access to the assemblies in which the concrete classes reside – be they in the same output directory as the Unity assembly, or in the GAC – unity needs to be able to find them.