Registered User
Registered User

Reputation: 3699

Can't reference System.Web in a console App

I need to use the HttpUtility in a console app like described in this question UrlEncode through a console application?

The problem is that for some weird reason when I try to add a reference and go to .NET tab, I don't see System.web and also when I go to Recent and chose the System.Web, it adds the reference but with a yellow exclamation mark.

What is wrong, I know that this is a trivial thing...

Upvotes: 3

Views: 5836

Answers (2)

jeffrey_t_b
jeffrey_t_b

Reputation: 1769

Microsoft provides a special "client profile" for the .Net framework, so that application developers can make a smaller/faster deployment package. Although the client profile contains many of the things that simple .Net apps might need (CLR, Windows Forms, etc), oddly enough it doesn't contain the System.Web stuff.

See http://msdn.microsoft.com/en-us/library/cc656912.aspx for more information on what the "client profile" version of the framework contains.

As you discovered, you just need to change the TargetFramework to the normal .Net Framework 4 (in the project properties window), and you will be able to access all of the functions you need.

Upvotes: 10

abatishchev
abatishchev

Reputation: 100358

You need to change target Framework Profile: from Client to Full (at VS project properties window).

Upvotes: 2

Related Questions