PRISM 4.0 + Portable Class Library in VS 11

Apr 2, 2012 at 10:39 AM


I have a portable class library project which targets to NET Framework 4.5, Silverlight 4 and higher, Windows Phone 7 and higher and. NET for Metro style apps. I am working with in Visual Studio 11 beta and I'm also using Prism 4.0 binarys. I have two problems:

1. I can not use the Microsoft.Practices.Prism.Commands.DelegateCommand class. When I compile I get the error  "System.Windows.Input.Icommand is defined in a assembly that is not referenced. You must add a reference to assembly System.Window.Version".

2. I can not add a view to a region with the method regionManager.Regions ["RegionName"]. Add (view). When I compile I get the error "System.Collections.Specialized.INotifyCollectionChanged is defined in a assembly that is not referenced. You must add a reference to assembly System.Window.Version".

Someone knows what is this? I can not use Portable Class Library with PRISM 4.0?

Thanks in advance.

Apr 3, 2012 at 7:29 PM


As far as I know, there is no official guidance in Prism for .NET Framework 4.5, .NET Metro Style applications or Visual Studio 11 beta. So far, the latest version of Prism (version 4.1) was build to target  .NET Framework 4.0 and Silverlight 5; therefore, it would be possible to experience unexpected behaviors or incompatibility issues if you are using it against .NET Framework 4.5. However, you can try rebuilding the Prism library's source code for desktop (which you can find shipped with the latest release) to target the .NET Framework 4.5.

On the other hand, Prism provides three different versions of it's Prism library: for Desktop (.NET Framework 4.0), for Silverlight 5 and for Windows Phone 7. As far as I know, each one is designed to take advantage of the capabilities of the specific platform they are targeting; therefore, the .NET Framework version wouldn't work with Silverlight or Windows Phone 7 an so on.

Based on my understanding, a Portable Class Library project allows to write code that can work in more than one platform. As the Prism library has different versions for each platform, it seems that this scenario is not supported as out of the box. For example, if your Portable Class Library targets both .NET Framework and Silverlight and you reference the desktop version of the Prism library, the Portable Class Library might work correctly when running in desktop but might fail in Silverlight.

Also, according to the following article, the assemblies that figure in the errors you are mentioning are not supported when targeting a .NET Framework platform:


Damian Cherubini