10
votes

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

2

2 Answers

13
votes

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.

1
votes

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.