0

Severity Code Description Project File Line Suppression State Warning The primary reference "System.Net.Http.WebRequest, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" Ccould not be resolved because it has an indirect dependency on the framework assembly "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "System.Net.Http.WebRequest, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".

Ive just cant solve this, anyone know how to solve this?

I didnt change framework version, i kept 4.0

  • Possible duplicate of [ASP.NET web site builds locally, but throws MSB3268 on the build server](https://stackoverflow.com/questions/48118263/asp-net-web-site-builds-locally-but-throws-msb3268-on-the-build-server) – Heretic Monkey Mar 04 '19 at 20:22
  • 1
    This looks like the issue may be similar to [System.Net.Http could not be resolved in the currently targeted framework .NET 4.0](https://stackoverflow.com/questions/16756186/system-net-http-could-not-be-resolved-in-the-currently-targeted-framework-net-4). What versions of the .NET Framework are installed on the computer? – Paul Pearce Mar 04 '19 at 20:24
  • None of them helped. – Toni Jeličić Mar 04 '19 at 21:43
  • @ToniJeličić Have you successfully built this project in the past? Have you tried reinstalling .NET Framework 4.0 to see if that replaces the missing assembly? What other steps have you tried in attempting to resolve this issue? – Paul Pearce Mar 05 '19 at 14:46
  • @PaulPearce Yep – Toni Jeličić Mar 05 '19 at 17:26

3 Answers3

1

Ok after many hours of researching internet i finally found an solution.

After upgrading from MVC 4 - MVC 4.5 Web config in Views havent been modified for correct version of sharp and MVC, as nuget only update webconfig in root.

BUT

After ive modified new problem pop up saying @Action.URL missing assembly , after hours and hours resarching an simple solution has fixed the thing !! ( Delete of BIN and OBJ folders) Offcourse keep it in TRASH maybe you will need some DLL like aspsnippet facebook.

Very traumatic experience.

0

This is an old question, but I ran into a very similar issue today. It happened when i changed my target .NET framework from 4.5 down to 4.0 I solved it by by changing back to .NET framework 4.5 then going to references

enter image description here

right click on references - goto system.net.http and uncheck it then go back and change your target .NET framework to 4.0

As I understand it, the system.net.http assembly doesnt show in .NET 4.0 and as a result, you get the error, but no way to remove the assembly without changing back to the higher version of .NET.

This was the only way I could find to work around it.

Here is the reference assembly page in .NET 4.5

enter image description here

and the same in .NET 4.0 with the error.

enter image description here

Its there and its checked - just not showing on the lower .NET. I was working in visual studio 2019 community edition...

IamSierraCharlie
  • 504
  • 5
  • 10
0

In csproj file, add with specific assembly information of missing, like this:

    <Reference Include="System.Net.Http, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net40\System.Net.Http.dll</HintPath>
    </Reference>
    <Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net40\System.Net.Http.Extensions.dll</HintPath>
    </Reference>
    <Reference Include="System.Net.Http.Primitives, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net40\System.Net.Http.Primitives.dll</HintPath>
    </Reference>
    <Reference Include="System.Net.Http.WebRequest, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net40\System.Net.Http.WebRequest.dll</HintPath>
    </Reference>
    <Reference Include="System.Runtime, Version=2.6.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\packages\Microsoft.Bcl.1.1.10\lib\net40\System.Runtime.dll</HintPath>
    </Reference>
    <Reference Include="System.Threading.Tasks, Version=2.6.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\packages\Microsoft.Bcl.1.1.10\lib\net40\System.Threading.Tasks.dll</HintPath>
    </Reference>