System.Net.Http version conflict causing build warning

前端 未结 1 1957
名媛妹妹
名媛妹妹 2020-12-29 02:44

The nuget package Microsoft.Net.Http.2.0.20710.0 is causing me a build warning because of its use of System.Net.Http, Version=2.0.0.0 which is fighting with version 4 coming

相关标签:
1条回答
  • 2020-12-29 03:32

    You can try the workaround mentioned in this Microsoft Connect bugreport.

    Or you can try and add something like this to your Web.config:

      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" />
            <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    

    Edit:

    This is the workaround in the Connect Bug:

    modify.......: <Reference Include="System.Net.Http">
    to read ......: <Reference Include="System.Net.Http, Version=4.0.0.0">

    0 讨论(0)
提交回复
热议问题