找不到类型或命名空间名称 "WebRequestHandler"

The type or namespace name "WebRequestHandler" could not be found

我正在尝试使用此处列出的 Dropbox.API 代码:

https://github.com/dropbox/dropbox-sdk-dotnet/tree/master/dropbox-sdk-dotnet/Examples/SimpleTest

我将他们的 Program.cs 复制到我的 Program.cs 中,而没有对我 solution/project 中的其他文件进行其他更改。

我得到

The type or namespace name "WebRequestHandler" could not be found.

尽管有这个 using 语句:

using System.Net.Http;

帮助文本说要添加程序集引用,但我不知道要添加什么。

我尝试将 using System.Net.Http 移动到 class 的内部和外部。

我是 C# 和 .Net 开发的新手,所以希望这是一个真正的新手问题。

您是否包含了对 System.Net.Http.WebRequest DLL 的引用?这是找到 WebRequestHandler 的地方,而不是 System.Net.Http.

this article on MSDN

简而言之,您可以通过右键单击项目并执行 Add -> Reference 添加对 System.Net.Http.WebRequest DLL 的引用。期待弹出 window 出现,然后在 System.Net.Http.WebRequest 旁边打勾。

我可以证实这个疯狂:) 你可以通过 NuGet 拉取 System.Net.Http 但不能通过 System.Net.Http.WebRequest:) System.Net.Http.WebRequest 将通过 "Add Reference" 引用.