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

时间:2017-05-17 14:07:23

标签: asp.net-core asp.net-core-testhost

由于某些原因,我在使用Microsoft.AspNetCore.TestHost包时无法运行任何测试。这是抛出的异常:

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

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

我不得不把它放在我的项目csproj中。

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