This project has moved and is read-only. For the latest updates, please go here.

Portable Class Library in VS2011

Jun 1, 2012 at 10:39 AM
Edited Jun 1, 2012 at 10:40 AM

Hi Laurent,

congratulations for your lightweight framework!

I was wondering if it would be a good idea to go to a Portable Class Library with Messaging, Input, and Helpers namespace that will have all the common features of all the frameworks the MVVMLight will target...

The specific ones, could be different dll's for each system (eliminating the conditional compilation directives)

I gave it a try, and it is really nice.

What are your thoughts on this? (despites that this will create breaking changes...)



Jun 10, 2012 at 6:54 PM

Hi Michael,

You can find my portable fork of MVVM Light here:

It's up-to-date with what's in the main release.

Jun 11, 2012 at 10:25 AM


nice work, i will give it a try...

I hope to be included in the nuget distribution, inorder to be more accessible, as soon as the vs2012 is released....



Jun 16, 2012 at 9:32 AM

Appreciate the fork for portable library.  Am looking to use in an upcoming project.

One immediate question however is that I've noticed the IsInDesignMode and IsInDesignModeStatic properties have been removed.  Are you planning on implementing an alternative (e.g. Reflection) to support this?



Jun 16, 2012 at 6:35 PM

Hi rossmhk,

As per your suggestion, I just updated the portable fork to support IsInDesignMode and IsInDesignModeStatic by using reflection to detect the platform and extract the value.

Due to the fact that private reflection throws on WinRT and SL, we can test and check for desktop .NET. Then, we can try to load up the WinRT class, which will fail in SL. Finally, we can try to load the SL version.

In this way, we ultimately know which system it's running on and since the properties we need are all public, there aren't any blockers with using reflection to get the values.


Jun 17, 2012 at 3:48 AM

Thanks Oren. 

I have checked out the code and trying it now.  I am encountering my first problem with running in VS2010/WP7.1 phone app project.  It's returning false when I have the check in my ViewModelLocator class (within my portable library assembly).  Am using the VS2010 XAML designer on a basic View and following the same logic as the MVVMLight application template where it checks in the ViewModelLocator() constructor.  Any issue if this is in different portable library assembly to the View assembly?




Jun 17, 2012 at 3:38 PM

Hi Ross,

Looks like my detection logic wasn't working quite right as when in the VS Designer in SL and WP, it was detecting it as .NET first. I've updated the logic a bit to try to get it more accurate in the designer. I've also added a few test pages for all of the platforms and it seems to be working correctly now.


Can you please check the latest code and see if it works for you?



Jun 18, 2012 at 2:31 AM

Thanks Oren.  Initial test looks good.  Will let you know if anything else crops up.  Appreciate the help.

Jul 3, 2012 at 4:16 PM
Edited Jul 3, 2012 at 4:16 PM

Just pinging this thread to note that I've updated the PCL fork with Laurent's latest changes for V4.

Oct 6, 2012 at 5:32 PM


Prism just released Portable Libraries for framework 4.5 ...

It really would be nice to have MVVM Light distributed on nuget as Portable dll's ..



Nov 17, 2012 at 7:19 PM

Hi Michael,

I've put the PCL version on NuGet here:


Nov 30, 2012 at 2:10 PM

I have created a PCL project that targets .NET 4.5, Silverlight 4, Windows Phone 7.1 and Windows Store Apps and the following message shows when trying to add MVVM Light PCL via NuGet:

Install-Package : Could not install package 'Portable.MvvmLightLibs 4.1.24-beta5'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.0,Profile=Profile2', but the package does not contain any assembly references that are compatible with that framework. For more information, contact the package author.At line:1 char:16

Nov 30, 2012 at 2:39 PM


Do you have NuGet 2.1 installed? Portable Class Libraries were only supported starting in version 2.1.


Nov 30, 2012 at 2:42 PM

That was it. Had a clean install of VS2012 and didn't update NuGet to the latest verstion...