0
votes

Hi Stackoverflow community,

I am in the process of creating a .Net Standard 2.0 Library project for my Xamarin Cross Platform App.

For the Droid project which references the above project I am getting the following error for one of the NuGet packages:


Can not resolve reference: 'GalaSoft.MvvmLight', referenced by 'NetStdLibProject'. Please add a NuGet package or assembly reference for 'GalaSoft.MvvmLight', or remove the reference to 'NetStdLibProject'.    NetProject.Droid

I have added following NuGet Packages to my NetStdLibProject project:

  1. MVVMLight (5.4.1.1)

  2. MVVMLightLibs (5.4.1.1) [This has following warning]

(Package 'MvvmLightLibs 5.4.1.1' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.)

Please advise if there is a way to handle this scenario, or even if I am missing something. Also, please let me know if I need to include other related/beneficial packages.

PS: Me and my colleagues use Visual Studio 2019 (Windows & Mac both, Mac for IOS part to be somewhat specific)

Thanks for reading and any help is highly appreciated.

1
a cursory glance at their webpage shows a .NET Standard version of the lib - nuget.org/packages/MvvmLightLibsStd10 - Jason
Hi @Jason, Thanks for your response. I added MVVMLightLibsStd10 to my NetStdLibProject project. This is how the references now look like: MVVMLight (5.4.1.1) MVVMLightLibsStd10 (5.4.1.1) -> GalaSoft.MvvmLight.dll. This project builds correctly. However, the Droid project is still giving the same reference error. - sum1
Hi @Jason, I removed the .MVVMLight (5.4.1.1) reference as well, from my previous comment. This is how the references now look like: MVVMLightLibsStd10 (5.4.1.1) -> GalaSoft.MvvmLight.dll. This project builds correctly. However, the Droid project is still giving the same reference error. - sum1
See my updated answer, you have to install MVVMLightLibsStd10 for all the project in your solution. - Jack Hua
Hi @JackHua-MSFT, Thanks for your response. I added MVVMLightLibsStd10 to my Droid project as well, as per your recommendation. That caused this error: "Cannot find App.xaml file in this project, no other changes made. If you are installing in a PCL, please use 'MVVM Light Libs Only' instead." Then I installed 'MVVMLightLibs'. Didn't help. If I remove 'MVVMLightLibsStd10' reference, rebuild, I get many errors similar to: "error: package com.google.android.gms.common.api does not exist com.google.android.gms.common.api.ResultCallback" for many similar .java files. - sum1

1 Answers

0
votes

As Jason suggested in the comment, you should install MvvmLightLibsStd10 for .NET Standard:

You should uninstall the MvvmLightLibs package and install MvvmLightLibsStd10 for all projects(sharedPrject,Android.project,iOS.project).

Right click your solution(not single project) and choose Manage Nuget Package for solution.

see my updated screenshot:

enter image description here

Refer: mvvmlight