4
votes

I have portable class library targeted to .NET 4.5 and Windows Store App. According to MSDN this setting should offer MEF but it does not. Namespace System.ComponentModel.Composition is not available (I even tried System.Composition but no luck). It is also not possible to use Microsoft.Composition NuGet package which works with Windows Store App.

The error when installing NuGet version is:

'Microsoft.Composition 1.0.15' already installed. Could not install package 'Microsoft.Composition 1.0.15'.

You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile7', but the package does not contain any assembly references that are compatible with that framework. For more information, contact the package author.

1

1 Answers

2
votes

You need to manually add a reference to the binary from the package. I typically install the package to a platform-specific project (such as .NET Framework 4.5) then just manually reference from portable.

This will be fixed next version of NuGet (2.1) and we'll update the MEF package to coincide with it.