Upgrade failed (2.1. => 2.2) Unity, Silverlight

Topics: Prism v2 - Silverlight 4
May 31, 2010 at 2:05 PM

Hi @all,

I tried to upgrade my Silverlight App. from Prism Version 2.1. to 2.2.

Unfortunately I have some problems with Unity.

I replaced the old file Microsoft.Practices.Unity.dll with Microsoft.Practices.Unity.Silverlight.dll and checked the references / namespaces in my App.

When I try to compile the App. I receive this  error:

Error    1    The type 'Microsoft.Practices.Unity.IUnityContainer' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Practices.Unity, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

But i cannot refer to Microsoft.Practices.Unity.dll this is not a Silverlight Library. And I think the the Microsoft.Practices.Unity.Silverlight.dll should be used. Or am I wrong?


Thanks for your help.


Jun 8, 2010 at 4:42 PM

Hi Manullino,

You are right, you should use the Microsoft.Practices.Unity.Silverlight.dll assembly, which is the Silverlight version of Unity 2.0 (remember that Prism 2.2 uses Unity 2.0, as mentioned in this thread).

Your problem is probably caused by the fact that you have replaced the Unity assembly, but not the UnityExtensions assembly. You should replace the reference to Microsoft.Practices.Composite.UnityExtensions version 1.2 with version 2.0 of the same assembly, which you can find inside the Prism 2.2 release.

Please note that, due to the fact that you are upgrading to Unity 2.0, the generic methods such as Resolve<T> are now located in extension methods, so you should change the using statements in your classes. You can find more information about this in this thread.

I hope you find this helpful.

Guido Leandro Maliandi