开发者

Using HttpUtility.UrlEncode() makes assembly's namespace "disappear"?

开发者 https://www.devze.com 2023-02-18 02:52 出处:网络
I have 2 C# projects (let\'s call them A and B). Project A is compiled to Class library and project B is compiled to Windows Application. Project B is added a reference to project A. Normally, they ru

I have 2 C# projects (let's call them A and B). Project A is compiled to Class library and project B is compiled to Windows Application. Project B is added a reference to project A. Normally, they run well, without any problem.

I added a line that use HttpUtility.UrlEncode() to project A:

string encoded = HttpUtility.UrlEncode(queryString);

and I also added 'using System.Web' and a reference to System.Web.dll. While project A still be built successfully, when I build project B, it gave me erro开发者_运维技巧rs said that the namespace of project A does not exist. Removing the line that use HttpUtility.UrlEncode() solve the problem, but I really need that method.

Please help me! Thanks in advance.

Edit: I've found the problem: I set the "target framework" property of project B as ".net framework 4 client profile", which seems not support System.Web. Just change it to ".net framework 4" and it works fine.


It may be more helpful to post the actual error message received with all its quirks for more assistance to be given.

0

精彩评论

暂无评论...
验证码 换一张
取 消