【发布时间】:2018-07-26 06:01:06
【问题描述】:
每当我调用创建新 HttpClient() 的方法时,我都会遇到异常。没有线索,因为 System.Net.Http 已经被引用了。
public async Task<Stuff> GetOrder(int id)
{
var t = new HttpClient();
}
"InnerException": { "ClassName": "System.IO.FileNotFoundException", "Message": "Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.",
有什么想法吗?
【问题讨论】:
-
请阅读this
-
那种“特定版本”的需求有点奇怪。你是故意设置的吗?为什么?
-
你可以试试去掉绑定重定向,有一个类似的问题:stackoverflow.com/questions/47570912/…
-
我在清理/重建时发现了这一点:(x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2041,5):警告 MSB3277 : 发现不同版本的“System.Net.Http”之间的冲突无法解决。当日志详细程度设置为详细时,这些引用冲突会在构建日志中列出。
-
好吧,用包管理器查看它和/或删除并重新添加相关程序集。
标签: c# .net azure-service-fabric