开发者

Can't add a reference to System.Web to my Windows Service application

I'm trying to create a Windows Service in VS2010 but can't seem to add System.Web as reference. When I browse for it and add it manually I get an exclamation mark ove开发者_如何学运维r the reference. I've tried adding it for other projects and it works fine, just not for a windows service project. Is there a reason for this? I need it to call System.Web.HttpUtility.UrlEncode. Is there alternative method I can use?


It sounds like your project is configured to target a given framework profile, likely one of the new "Client" distributions. It is telling you that the DLL you've added is not in the targeted profile.

If you look in your project properties, there will be a target framework option under "Application" or possibly "Build".


One perhbaps rather silly amendmend: Maybe you run in the same problem like I did. I read a lot about changing the target framework. The question for me was: How? In the solution explorer I always hit the top node and "properties" but got a dialog which has only some complile options - nothing more! I want to add the hint that you have to mark your WCF library project first, THEN enter the project properties in VS2010 using the context menu and you will see a totally different properties page: Where you can change the behavior from client project to normal .NET 4.0. Almost took me half an hour...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜