Could not load file or assembly System.Net.Http version 4.1.1.0

前端 未结 8 1352
春和景丽
春和景丽 2020-12-09 14:55

I\'m porting a Net Framework 4 dll to Net Core. When porting my unit tests project I get an exception running some specific tests (not all).

System.IO

8条回答
  •  攒了一身酷
    2020-12-09 15:20

    I got the issue, and realized that it was because I had two different references. one reference was from my project library, and the second one was a dependency of a .Net Standard library, and therefore a Nuget package. The steps to solve were the following:

    • Remove the reference to System.Net.Http (project => add reference => remove the reference).
    • Keep the System.Net and System.Net.Http Nuget packages
    • Run Update-Package –reinstall System.Net.Http to bring back the reference.

    Now it works again. :)

提交回复
热议问题