Unity 2.0 dependency on Microsoft.Practices.ServiceLocation?

Apr 28, 2010 at 8:20 PM
We're starting to take a look at the Unity Application Block in Enterprise Library 5.0, and it appears that the Microsoft.Practices.Unity assembly has a dependency on Microsoft.Practices.ServiceLocation. I thought one of the goals of this release was to get the basic Unity functionality down to one assembly (eliminating Microsoft.Practices.ObjectBuilder2.dll). Do we have to distribute a minimum of two DLLs (Microsoft.Practices.Unity.dll and Microsoft.Practices.ServiceLocation.dll) to use Unity?
Apr 28, 2010 at 9:58 PM

You don't need to distribute the ServiceLocation DLL unless you're actually using the ServiceLocation adapter. There's a reference, but you don't hit it unless you're explicitly using that class.

Having said that, VS will automatically copy ServiceLocation.dll when you build, but it's not actually used. Unless, as I've said (I seem to be repeatedly repeating myself redundantly today) you actually use the service locator adapter class.

Try running your app after deleting ServiceLocation.dll and you'll see it's not actually required.

 

Apr 28, 2010 at 10:00 PM
ctavares wrote:

You don't need to distribute the ServiceLocation DLL unless you're actually using the ServiceLocation adapter. There's a reference, but you don't hit it unless you're explicitly using that class.

Having said that, VS will automatically copy ServiceLocation.dll when you build, but it's not actually used. Unless, as I've said (I seem to be repeatedly repeating myself redundantly today) you actually use the service locator adapter class.

Try running your app after deleting ServiceLocation.dll and you'll see it's not actually required.

 

Thank you!