无法在Visual Studio 2017 15.7.2中构建带有Prism的Xamarin.Forms [英] Xamarin.Forms with Prism not building in Visual Studio 2017 15.7.2

查看:103
本文介绍了无法在Visual Studio 2017 15.7.2中构建带有Prism的Xamarin.Forms的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有Prism MVVM的Xamarin.Forms,在Visual Studio 2017 15.7.2中有构建问题.

I have a Xamarin.Forms with Prism MVVM, having build problem in Visual Studio 2017 15.7.2.

该项目是在Visual Studio 2017 15.6.2中使用Prism模板创建的,并且运行良好.

This project was created in Visual Studio 2017 15.6.2, with Prism template, and was working perfectly.

我决定将IDE从15.6.2更新到15.7.2,并且我的项目停止工作,并出现以下错误:

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.

我已经将Xamarin.Forms更新为3.0.0.482510,什么也没有.

I have already update Xamarin.Forms to 3.0.0.482510 and nothing.

但是,如果我使用VS 2017 15.7.2创建了一个没有Prism的Xamarin项目并更新了所有引用,那么它的构建就不会出现此错误.所以,我认为问题是棱镜模板.

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.

对我来说,一个选项是降级VS 2017,但我宁愿不降级.

One option for me is to downgrade the VS 2017, but I would rather not.

推荐答案

我有同样的问题.

原因:当我的项目目标是android版本8.1时,文件obj/project.assets.json目标"MonoAndroid,Version = v7.1"

Reason: file obj/project.assets.json target "MonoAndroid,Version=v7.1" when my project target android version 8.1

我通过以下方式解决了该问题:

I resolved it by:

  1. 右键单击Android项目=>属性=>应用程序=>编译 使用Android版本=> Android 7.1
  2. 清理并生成项目=>生成成功,然后重新启动IDE.
  3. 右键单击Android项目=>属性=>应用程序=>编译 使用Android版本=> Android 8.1
  4. 清理并构建项目=>构建成功
  1. Right click Android project => Properties => Application => Compile using Android version => Android 7.1
  2. Clean and Build project => build success, and restart IDE.
  3. Right click Android project => Properties => Application => Compile using Android version => Android 8.1
  4. Clean and Build project => build success

文件obj/project.assets.json已更新为"MonoAndroid,Version = v8.1"

File obj/project.assets.json updated to "MonoAndroid,Version=v8.1"

这篇关于无法在Visual Studio 2017 15.7.2中构建带有Prism的Xamarin.Forms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆