6

I have encountered the following problem.

I have created a new lib project targeting .net framework 4.6.2 and referenced System.Runtime.InteropServices.RuntimeInformation package via NuGet. (The Object Browser is displaying that that dll has version 4.0.1.0, (in nuget i pointed to instal ver 4.3))

I reload the project, to check if there are no problems with references.

Now I install Microsoft.AspNetCore, I reload the project, and the reference to System.Runtime.InteropServices.RuntimeInformation and System.Net.Htpp are gone.

enter image description here

ps. installing .netstandard package did not help.

Does anyone had a similar problem ?

aph5
  • 771
  • 2
  • 7
  • 23
  • Please include the actual warning from the output window (as text). A screenshot of warning icons is not particularly useful. – Martin Ullrich Sep 04 '17 at 11:45
  • Which version of visual studio are you using? – Martin Ullrich Sep 04 '17 at 11:45
  • @MartinUllrich vs 2017 15.3.3 – aph5 Sep 04 '17 at 18:54
  • @MartinUllrich I only found this: Warning The referenced component 'System.Runtime.InteropServices.RuntimeInformation' could not be found. ClassLibrary1 – aph5 Sep 04 '17 at 19:12
  • question has been retargeted more broadly on https://stackoverflow.com/questions/48520188/could-not-load-file-or-assembly-system-runtime-interopservices-runtimeinformati – qqtf Aug 23 '22 at 10:21

2 Answers2

7

System.Runtime.InteropServices.RuntimeInformation the lowest support .net framework version is 4.7.1. You can see the detail in System.Runtime.interopservices.runtimeinformation

doublnt
  • 541
  • 9
  • 18
3

In my case adding

<PropertyGroup>
  <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>

to the csproj file helped. I'm still getting missing references, but while running the project I do not get any missing file exceptions

aph5
  • 771
  • 2
  • 7
  • 23
  • 3
    This may be related to a Visual Studio update, more info here: https://developercommunity.visualstudio.com/content/problem/95070/could-not-load-file-or-assembly-systemruntime-vers.html – adrian Sep 27 '17 at 14:38
  • 1
    I had an issue using OpenCvSharp with .NET 4.6.2 throwing `System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=0.0.0.0` and this fixed it. Thank you! – p3tch Jul 18 '22 at 14:55
  • @p3tch I have the same problem with OpenCvSharp but I can't fix it, do you have some clue? – jæk Aug 03 '22 at 06:40
  • @jæk have you added System.Runtime.InteropServices.RuntimeInformation from nuget? If not, try that – p3tch Aug 04 '22 at 08:00