Portable version to support all platforms

Mar 7, 2012 at 5:04 PM
Edited Mar 7, 2012 at 5:17 PM

I wanted to propose using the new VS 11 Portable libraries to enable a single instance of the CommonServiceLocator to work with .NET 4, SL4+, WP7.1+, WinRT and XBox 360.

The only breaking change is that IServiceProvider has been removed from WinRT and so isn't available for portable libraries. From an API perspective, in my test build, I simply moved the single GetService method to the IServiceLocator interface instead.

Between using it as a Portable Library and the removal of IServiceProivder, the changes would warrant a version bump to 2.0 to prevent accidental conflicts. If you can get that built and put on to NuGet, it would enable you to have a single binary that all platforms can reference.


Mar 8, 2012 at 2:04 PM


Apr 27, 2012 at 12:20 PM


Apr 28, 2012 at 2:05 PM
Edited Apr 28, 2012 at 2:06 PM

I added an issue for this: Portable version to support all platforms.

Let's vote.

Aug 29, 2012 at 6:42 PM

Just wanted to update on this as with the RTM bits, IServiceProvider is in the PCL, so it's possible to target .NET 4, SL4, WP7 and Windows Store as-is. It would be great if you could publish an official portable version signed with the same key.


Oct 6, 2012 at 5:55 PM

The new PCL version is missing the NeutralResourcesLanguageAttribute. That's generating a compiler warning:

Warning 1 The assembly "C:\Users\Public\Downloads\CodePlex\MVVMLight\GalaSoft.MvvmLight\Portable\packages\Portable.CommonServiceLocator.1.2\lib\portable-net4+sl4+wp7+win8\Microsoft.Practices.ServiceLocation.dll" does not have a NeutralResourcesLanguageAttribute on it. To be used in an app package, portable libraries must define a NeutralResourcesLanguageAttribute on their main assembly (ie, the one containing code, not a satellite assembly). C:\Users\Public\Downloads\CodePlex\MVVMLight\GalaSoft.MvvmLight\Portable\packages\Portable.CommonServiceLocator.1.2\lib\portable-net4+sl4+wp7+win8\Microsoft.Practices.ServiceLocation.dll GalaSoft.MvvmLight.Test.Portable.WinRT

Can you please add the attribute and re-release the PCL binary?


Nov 27, 2012 at 8:39 PM

The PCL version has been updated to include the NeutralResourcesLanguageAttribute.

Feb 2, 2013 at 12:54 PM

it's great that you built a PCL Version! However, it doesn't seem to be available on NuGet. Are there any plans to provide it via NuGet?

Feb 2, 2013 at 1:05 PM

I packaged them up as Portable.CommonServiceLocator on NuGet until the official package is updated.
Feb 2, 2013 at 1:10 PM
Cool! I found it. Thanks for the quick reply