Exception in ConfigureContainer

Topics: Prism v4 - WPF 4
Nov 8, 2011 at 3:55 PM

Hi,

After updating Unity package via NuGet manager to version 2.1.505.0  I got the following exception on executing base.ConfigureContainer() in UnityBootstrapper derived class :

Could not load file or assembly 'Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Application worked pretty well before this update.

Previous version of unity is 2.0

Developer
Nov 9, 2011 at 11:30 AM
Edited Nov 9, 2011 at 1:22 PM

Hi,

We tried to reproduce the error that you are describing by updating various QuickStarts included in the Prism guidance to the Unity 2.1.505.0 version using the NuGet manager, but we couldn’t reproduce your problem (all the QuickStarts worked properly). We tried this using both .NET Framework 4 and .NET Framework 4 Client Profile in the QuickStarts' projects when applicable, but it worked appropriately as well.

Also, we updated the Prism library to the Unity 2.1.505.0 version, ran its tests and found that they all pass. It seems that your problem might be caused by a missing reference.

You can find a version of the Modularity QuickStart with Unity using the Unity 2.1.505.0 version in this SkyDrive account (under the name ModularityWithUnity2-1-5.zip). This sample might be useful for you to compare your solution to it, so as to find possible differences that might be causing the exception you mentioned.

If this does not help you solve your problem, it would be helpful if you could provide us with a repro sample application, so we can help you troubleshoot it.

I hope you find this helpful.

Guido Leandro Maliandi 
http://blogs.southworks.net/gmaliandi

Nov 9, 2011 at 3:06 PM

Hi

Thanks for reply.

Yes, the matter was in assembly reference. For some reason when Nuget manager updated the Unity assembly, the reference to ServiceLocation was gone from the project... magic.

I thint the reason is somewhere inside the NUGet package, e.g it tries to set the ServiceLocation  reference  to new location (\packages\Unity.2.0\lib\SL30 vs \packages\Unity.2.1.505.0\lib\NET35) but the assembly itself was not included in the package.

Or something like. Anyway, it's nothing to do with Prism :)