问题
I have a Xamarin.Forms with Prism MVVM, having build problem in Visual Studio 2017 15.7.2.
This project was created in Visual Studio 2017 15.6.2, with Prism template, and was working perfectly.
I decided to update my IDE from 15.6.2 to 15.7.2, and my project stops working, getting the error below:
Severity Code Description Project File Line Suppression State
Error Your project is not referencing the "MonoAndroid,Version=v8.1" framework. Add a reference to "MonoAndroid,Version=v8.1" in the "frameworks" section of your project.json, and then re-run NuGet restore. AppPrivateCard.Android
A Xamarin.Forms project do not have project.json file, as suggested by the error message, and I already modified the target Android version to Android 27 version (Android Oreo 8.1), but the error persists.
I have already update Xamarin.Forms to 3.0.0.482510 and nothing.
But, if I create a Xamarin project without Prism, using VS 2017 15.7.2, and update all references, it builds without this error. So, I think the problem is the Prism template.
One option for me is to downgrade the VS 2017, but I would rather not.
回答1:
I have the same problem.
Reason: file obj/project.assets.json target "MonoAndroid,Version=v7.1" when my project target android version 8.1
I resolved it by:
- Right click Android project => Properties => Application => Compile using Android version => Android 7.1
- Clean and Build project => build success, and restart IDE.
- Right click Android project => Properties => Application => Compile using Android version => Android 8.1
- Clean and Build project => build success
File obj/project.assets.json updated to "MonoAndroid,Version=v8.1"
来源:https://stackoverflow.com/questions/50553196/xamarin-forms-with-prism-not-building-in-visual-studio-2017-15-7-2