The specified component "System.Net.Http" was not found

I created a new project in VS2017 designed for the .NET Framework 4.6.1, and when I add a link to the NuGet package in System.Net.Http, I get the following warning for it and all its dependencies:

The referenced component 'System.Net.Http' could not be found.

The project (and its solution) compiles, but when I start, I get an exception because I cannot find the assembly when trying to create an instance HttpClient.

I confirmed that it HintPathindicates the correct location in the package folder, and the DLL is there with a size of 193 KB. I deleted the link and tried to add the link to the DLL directly, but to no avail.

I also tried to add the link in Framework> Assemblies, but no matter what I do, the link has a warning icon and the link properties look like this:

System.Net.Http Reference Properties

I tried the following:

  • NuGet
  • , NuGet NuGet
  • Update-Package -reinstall
  • ( )

, , , . ?

+6
3

TL;DR - Fabric .NET Standard; .NET Framework .


, System.Net.Http, .

netstandard1_6, System.Net.Http ( ) . , ! , "" .NET Framework, , .

, , , :

  • .NET Standard .NET Framework
  • Fabric x64, .NET Standard .

!

+7

. , Dependency Behavior NuGet "Lowest", . , , , . System.Net.Http.Formatting.Extensions System.Net.Http 2.20..., .NET 4.7.1.

"" Nuget . , . , NuGet, Dependency Behavior Highest.

+3

sometimes it’s useful to delete all existing links. Then reload the project, and each error icon in the links will be removed. Then add each link manually.

0
source

Source: https://habr.com/ru/post/1687953/


All Articles