引用类型'Assembly'声称它是在'System.Runtime'中定义的,但是找不到 [英] Reference to type 'Assembly' claims it is defined in 'System.Runtime', but it could not be found

查看:430
本文介绍了引用类型'Assembly'声称它是在'System.Runtime'中定义的,但是找不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从更新到VS2017 15.7.1以来,我的Xamarin PCL项目在UWP App.xaml.cs文件中显示以下错误.

Since updating to VS2017 15.7.1 my Xamarin PCL project is showing the error below in the UWP App.xaml.cs file.

错误CS7069对类型为"Assembly"的引用声称它是在"System.Runtime"中定义的,但找不到它

Error CS7069 Reference to type 'Assembly' claims it is defined in 'System.Runtime', but it could not be found

违规行被复制到下面. IntelliSense可以在线工作.

The offending line is copied below. IntelliSense works on the line.

Xamarin.Forms.Forms.Init(e);

例如,现在也有很多冲突警告消息;例如, 警告:发现不同版本的"System.Net.Http"之间的冲突无法解决.

There are also now a lot of conflict warning messages, for example; Warning Found conflicts between different versions of "System.Net.Http" that could not be resolved.

目标.NET框架是4.5,所有NuGet库都是最新的.

The target .NET framework is 4.5, all NuGet libraries are up to date.

到目前为止,我已经尝试添加System.Runtime作为参考,并重新安装了所有NuGet库,以消除错误而没有成功.

So far I've tried adding System.Runtime as a reference and re-installed all NuGet libraries to get rid of the error without success.

我仍在寻找Xamarin的出路,任何解决此问题的指南将不胜感激.

I'm still finding my way around Xamarin, any guidance to fix this would be appreciated.

谢谢, 左

推荐答案

最近发生在我身上.这是通过使用PCL创建Xamarin应用程序并将目标从 .NET标准2.0 更改为 .NET标准1.4 来完成的.在所有项目中将Xamarin.Forms从3.0.0.446417版本降级到2.5.1.527436版本后,它进行编译时没有错误.

This happened to me recently. It was from creating an Xamarin application with PCL and changing the target from .NET standard 2.0 to .NET Standard 1.4. After downgrading the Xamarin.Forms from version 3.0.0.446417 to version 2.5.1.527436 in all the projects, it compiled without errors.

说明(根据请求): 如果要在Fall Creators Update(版本6.332)之前定位,则需要删除对.NET Standard 2.0的所有引用.

Explanation (per request): If you are Targeting before Fall Creators Update (version 6.332), you will need to remove all references to .NET Standard 2.0.

Xamarin Forms 3.x使用.NET标准2.0.由于您的定位目标是Fall Creators Update(版本6.332),因此PCL必须是.NET Standard 1.x.

Xamarin Forms 3.x uses .NET standard 2.0. Since you are targeting below Fall Creators Update (version 6.332) the PCL will need to be .NET Standard 1.x.

更多信息 查看全文

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