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

喜欢而已 提交于 2019-11-30 03:37:33

问题


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

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

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

Xamarin.Forms.Forms.Init(e);

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.

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

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.

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

Thanks, Lefty


回答1:


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.

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 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.

More information here.




回答2:


I had the same problem with Xamarin Forms 3.0.0.446417 being installed. I just went back to the previous version, 2.5.1.527436, but then my Android project fails with "The target "CssG" does not exist in the project."

It appears to be a problem with that version of Xamarin Forms.



来源:https://stackoverflow.com/questions/50289010/reference-to-type-assembly-claims-it-is-defined-in-system-runtime-but-it-co

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!