How do I add System.Web as a reference if I cant find it in the list of references?
Asked Answered
N

2

12

I'm working on a project in C#.Net 4.0. I am trying to use HttpUtility.HtmlDecode. To do so, I added

using System.Web;

to the top of the file. However, no reference to HttpUtility could be found.

After Googling around a little bit I found that the common answer to this question was to add a reference to System.Web.dll by finding it in the list presented by right-clicking on References in the Solution Explorer and clicking "Add Reference...". Unfortunately, this was not in the list. I found System.Web.Services and System.Web.ApplicationServices, but no System.Web, and neither contained what we needed.

Any help appreciated.

Necrotomy answered 6/3, 2011 at 5:16 Comment(0)
L
27

My crystal ball says you are using VS2010. Project + Properties, Application tab, Target framework setting. Change it from the client profile to the regular version.

System.Web is not included in the client profile, that's why you can't find it. Don't worry about the difference, the client profile is only 15% smaller than the regular version. There's very little point to it.

Lentiginous answered 6/3, 2011 at 5:20 Comment(0)
H
7

It took me some time to find out:

  1. Project properties
  2. Click on the Tab Application
  3. In the "Target Framework" drop down, be sure to select ".NET Framework 4" and not the one with the suffix "Client Profile"

for more information:

http://msdn.microsoft.com/en-us/library/cc656912.aspx

The reason you can't find the System.Web is the first sentence:

The .NET Framework 4 Client Profile is a subset of the .NET Framework 4

So, some of the functionality doesn't exists in the client profile, like System.Web.

Henson answered 19/4, 2011 at 2:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.