Linux Silverlight,“命名空间‘System.Net’中不存在类型或命名空间名称‘CookieContainer’”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3677143/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Silverlight, "The type or namespace name 'CookieContainer' does not exist in the namespace 'System.Net'"
提问by davej
I'm running VS2010 pro, and I downloaded a sample Silverlight appwritten in an older version. I did the conversion but now when I go to run it, I get this error. I searched the net, the only recommendation I found was to add a reference to "System.Net" (which didn't make sense, but I did anyway), but this didn't help. The offending code:
我正在运行 VS2010 pro,我下载了一个用旧版本编写的示例 Silverlight 应用程序。我进行了转换,但是现在当我运行它时,出现此错误。我在网上搜索,我发现的唯一建议是添加对“System.Net”的引用(这没有意义,但我还是这样做了),但这没有帮助。违规代码:
public System.Net.CookieContainer CookieContainer {...
回答by AnthonyWJones
The System.Net dll is usually referenced by default but perhaps it wasn't in the older project. Check the version number is 2.0.5.0 and that the file path is something like:-
System.Net dll 通常在默认情况下被引用,但可能它不在旧项目中。检查版本号是 2.0.5.0 并且文件路径是这样的:-
c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\System.Net.dll
c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\System.Net.dll
回答by Vinny Marquez
CookieContainer Class Namespace: System.Net Assembly: System (in System.dll) Supported in: 4, 3.5 SP1
CookieContainer 类命名空间:System.Net 程序集:System(在 System.dll 中)支持:4、3.5 SP1
CookieContainer still exists.
CookieContainer 仍然存在。
Try deleting the reference in your project then add System.net again.
尝试删除项目中的引用,然后再次添加 System.net。