'GalaSoft' MvvmLight could not be found in Portable project
Asked Answered
S

1

13

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

Sekofski answered 21/5, 2015 at 17:59 Comment(4)
You need to go bug them on nuget. Tried installing nuget.org/packages/MvvmLightlibs in a PCL targeting 4.0, 4.0.3 and 4.5 and none of the packages would install as they claim they aren't compatible. This is the package they instruct you to install when your project is a PCL. Their project that's specifically stated for PCL nuget.org/packages/Portable.MvvmLightLibs says it's depreciated and to use the MvvmLightLibs package. So something is wrong here on their end.Lamented
@Will I have tried adding \Portable.MvvmLightLibs.4.4.32.1\lib\portable-net45+wp8+win8+wpa81\GalaSoft.MvvmLight.Extras.dll as a reference but still getting same error.Sekofski
You can try adding the mayflower while standing on your head, it doesn't matter. What they say is PCL compatible isn't. Your error isn't anything to do with you, it's all their problem. They are going to have to fix it, it appears to me. You should bring this issue to the attention of the Galasoft folks. I think they're a good bunch and should be willing to help you. Good luck.Lamented
Anyhow, poked the HDIC, hopefully he'll stop by and help.Lamented
B
1

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

Barbel answered 29/5, 2015 at 22:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.