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

Keval Langalia
  • 1,762
  • 1
  • 16
  • 29
TaLha Khan
  • 2,413
  • 2
  • 25
  • 39
  • You need to go bug them on nuget. Tried installing https://www.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 https://www.nuget.org/packages/Portable.MvvmLightLibs/ says it's depreciated and to use the MvvmLightLibs package. So *something* is wrong here on their end. –  May 21 '15 at 18:25
  • @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. – TaLha Khan May 21 '15 at 18:32
  • 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. –  May 21 '15 at 19:22
  • 1
    Anyhow, poked the HDIC, hopefully he'll stop by and help. –  May 21 '15 at 19:27

1 Answers1

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

musium
  • 2,942
  • 3
  • 34
  • 67