DependencyResolver.SetResolver(new UnityDependencyResolver(container));

May 31, 2013 at 11:49 AM
Hello,

I've installed Unity runtime v4.0.30319, for the first time, and based on an example where uses runtime v2.0.50727 when I create an instance of the UnityDependencyResolver the UI notifies,
THE NAMESPACE NAME UnityDependencyResolver could not be found.
DependencyResolver.SetResolver(new UnityDependencyResolver(container));

what's the right approach for doing this with the last runtime?

Oscar
May 31, 2013 at 2:57 PM
If you are targeting .NET 4.0.30319 then you are probably using Unity 2.1. Unity 2.1 does not include a UnityDependencyResolver class so the example you are looking at probably uses a third party resolver such as Unity.Mvc3.

Unity 3, which requires Microsoft .NET Framework 4.5, does include a UnityDependencyResolver which is included in the Unity bootstrapper for ASP.NET MVC package.

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to