Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'GalaSoft' MvvmLight could not be found in Portable project

I have cloned a solution, it contains multiple projects based on GalaSoft MvvmLight library, also it has two Portable Projects. I have installed all required nuget packages and references but I am not able to build these portable projects and its required to build these portable projects first because all other projects reference it.
I got this(below) error in every file GalaSoft is used. Its a Portable class library project.

Error 64 The type or namespace name 'GalaSoft' could not be found (are you
missing a using directive or an assembly reference

I have referenced this(below) Portable MvvmLight libraries in this project

\MvvmLightLibs.4.4.32.7\lib\netcore45\GalaSoft.MvvmLight.dll
\MvvmLightLibs.4.4.32.7\lib\netcore45\GalaSoft.MvvmLight.Extras.dll

and here is the platform target
portable project platform-target


I have tried cleaning and restarting visual studio. I am stuck at this issue for more than 2 days now. Also, I have tried checking and unchecking "Build" option in Configuration Manager (i have read it somewhere) but didnt work.

Also, there are other 44 warnings. All of them looks similar to below warning.

Warning 28 The primary reference "GalaSoft.MvvmLight" could not be resolved
because it has an indirect dependency on the framework assembly "System.Linq.Expressions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile158". To resolve this problem, either remove the reference "GalaSoft.MvvmLight" or retarget your application to a framework version which contains "System.Linq.Expressions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".

EDIT: Question title revised

like image 285
TaLha Khan Avatar asked May 21 '15 17:05

TaLha Khan


1 Answers

So your problem is that mvvm light has no package targeting your PCL profile.

When you download the package using nuget install MvvmLightLibs you can see that the package contains the assemblies for only one PCL profile. Mvvm light supports portable-net45+wp8+wpa81+netcore45+monoandroid1+xamarin.ios10. But your PCL targets .NETPortable,Version=v4.5,Profile=Profile78. If you wan’t your project to be compatible with mvvm light you have to remove the sl5 target.

enter image description here

like image 195
musium Avatar answered Oct 27 '22 14:10

musium