我在目标框架设置为 .net 4.0 的情况下开发了一个 WinForm 应用程序,现在我希望添加到一个目标框架设置为 .net 4.5 的项目中。在我将 4.0 WinForm 应用程序添加到我的 4.5 项目后,我的 HttpUtility 对象上不断出现错误。
data += "&batch_data=" + HttpUtility.UrlEncode(batch, System.Text.Encoding.GetEncoding("ISO-8859-1"));
“当前上下文中不存在名称‘HttpUtility’”
我确实包含了 HttpUtility 所在的 System.Web 命名空间。
视觉工作室错误:
CS0234 The type or namespace name 'HttpUtility' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)