I've searched a lot and can't find a solution to my problem (I've seen similar runtime issues but not build).
I have a .NET 4.7.1 project (class lib) that references a .NET Core project/library. When I try to build I get the following build error:
'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
The code is simple and is just calling an async method in the .NET Core lib. A bit like:
return _dotNetCoreClass.MethodAsync();
I've tried upgrading the project so it uses ProjectReferences and not packages.config. I've installed the System.Runtime package (version 4.3.0). I've updated my project file to include the below:
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
I've also installed the latest NETStandard.Librabry package but I can't get rid of the build error.
netstandard20
in the library you want to include? .NET Full and .NET Core both support .NET Standard, but direct cross-compatibility is a tad more tricky (and to be avoided if possible). – Jeroen Mostert