System.Net.Http.HttpClient Microsoft.AspNetCore.TestHost.TestServer.CreateClient()

601 views Asked by At

For some reasons, I am unable to run any tests when using Microsoft.AspNetCore.TestHost package. Here's the exception thrown:

System.MissingMethodException : Method not found: 'System.Net.Http.HttpClient Microsoft.AspNetCore.TestHost.TestServer.CreateClient()'.

Any idea?

1

There are 1 answers

2
Gabriel Robert On

I had to put this in my project csproj.

  <PropertyGroup>
    <TargetFramework>net461</TargetFramework>
    <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  </PropertyGroup>