2017-09-01 79 views
0

请你帮我解释为什么会出现这个错误?System.Net.Http.HttpClientExtensions的模糊使用

error:Severity Code Description Project File Line Suppression State Error CS0121 The call is ambiguous between the following methods or properties: 'System.Net.Http.HttpClientExtensions.SetBearerToken(System.Net.Http.HttpClient, string)' and 'System.Net.Http.HttpClientExtensions.SetBearerToken(System.Net.Http.HttpClient, string)' ImportTrustsApp C:\@Noha Basiony\NowInfinity Web\web\smsf.web\ImportTrustsApp\Program.cs 45 Active

enter image description here

+0

[This](https://stackoverflow.com/questions/31729186/c-sharp-compiler-cs0121-the-call-is-ambiguous-between-the-following-methods-or)问题可能是如果你碰巧使用ReSharper,这会很有帮助。 – Poosh

回答

1

看来,旧版本的System.Net.Http.HttpClientExtensions 组件已经被缓存,现在他们与新安装的组件冲突。请按照以下步骤,将帮助你解决这个问题:

  1. 删除当前的System.Net.Http.HttpClientExtensions参考。
  2. 添加新的System.Net.Http.HttpClientExtensions参考。
  3. 关闭Visual Studio。
  4. 清除项目的Bin和Obj文件夹。
  5. 重建您的应用程序。
+0

@Noha Basiony,我希望这有用吗? –