我有一个带有Prism MVVM的Xamarin.Forms,在Visual Studio 2017 15.7.2中有构建问题 .
这个项目是在Visual Studio 2017 15.6.2中创建的,带有Prism模板,并且工作得很好 .
我决定将我的IDE从15.6.2更新到15.7.2,我的项目停止工作,得到以下错误:
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.
我已经将Xamarin.Forms更新到3.0.0.482510而且没有 .
但是,如果我创建一个没有Prism的Xamarin项目,使用VS 2017 15.7.2,并更新所有引用,它构建时没有此错误 . 所以,我认为问题是棱镜模板 .
对我来说,一个选择是降级VS 2017,但我不愿意 .
1 回答
我也有同样的问题 .
原因:当我的项目目标android版本8.1时,文件obj / project.assets.json目标“MonoAndroid,Version = v7.1”
我通过以下方式解决了
右键单击Android项目=>属性=>应用程序=>使用Android版本=> Android 7.1进行编译
清理并构建项目=>构建成功,然后重新启动IDE .
右键单击Android项目=>属性=>应用程序=>使用Android版本=> Android 8.1进行编译
清理和构建项目=>构建成功
文件obj / project.assets.json更新为“MonoAndroid,Version = v8.1”