对类型 'Assembly' 的引用声称它在 'System.Runtime' 中定义,但找不到

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

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

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

下面复制了违规行。 IntelliSense 在线工作

Xamarin.Forms.Forms.Init(e);

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

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

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

我仍在寻找解决 Xamarin 的方法,如有任何解决此问题的指导,我们将不胜感激。

谢谢, 左撇子

我在安装 Xamarin Forms 3.0.0.446417 时遇到了同样的问题。我刚回到以前的版本 2.5.1.527436,但是我的 Android 项目失败并显示 "The target "CssG" does not exist in the project."

该版本的 Xamarin Forms 似乎有问题。

这件事最近发生在我身上。它来自使用 PCL 创建 Xamarin 应用程序并将目标从 .NET standard 2.0 更改为 .NET Standard 1.4。将所有项目中的Xamarin.Forms从3.0.0.446417版本降级到2.5.1.527436版本后,编译无误。

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

Xamarin Forms 3.x 使用 .NET 标准 2.0。由于您的目标低于 Fall Creators Update(版本 6.332),因此 PCL 需要是 .NET Standard 1.x。

更多信息here