0
votes

I'm getting an error I'm having trouble comprehending in a PCL Project referencing Unity PCL:

The primary reference "Microsoft.Practices.Unity" could not be resolved because it was built against the ".NETPortable,Version=v4.5,Profile=Profile78" framework. This is a higher version than the currently targeted framework ".NETPortable,Version=v4.0,Profile=Profile344".

However, my project is 4.5, so is the Microsoft.Practices.Unity reference expecting 4.0? I'm referencing the latest stable Unity, not pre-release, from a PCL project that's targeting 4.5 and all related types of projects.

Interestingly enough, the underlying error says could not resolve "Practices" in the namespace.

Thanks.

1

1 Answers

0
votes

The error message indicates a PCL profile mismatch (Profile 344 is incompatible with Profile 78).

Therefore, you have to fix the reference. Simply go to the packages folder created by NuGet, and go into the folder for the Unity version you use. There you should be able to see whether Unity provides an assembly that matches your project's PCL profile,

http://embed.plnkr.co/03ck2dCtnJogBKHJ9EjY/preview

If no match could be found, you would have to switch to Unity source code and build a version that you can utilize.

The error on "could not resolve Practices" part is expected, as C# compiler can find things like Microsoft.Win32 from BCL namespaces, but it requires extra assembly references so as to resolve Microsoft.Practices.Unity.