Cannot add System.Web.dll reference
Asked Answered
D

5

45

I'm trying to use the HTTP functions contained in the System.Web.dll assembly. However, whilst the dll seems to exist in the same directory as every other dll Visual Studio 2010 references in my project, it fails to link in and raises a warning - "The referenced component 'System.Web' could not be found". The dll, however, is definitely there within the same folder as all others referenced by the project and selecting it in 'browse for reference' mode allows me to add it - it then fails to fill in the 'Path' property. Am I doing something wrong? How can I make System.Web available in my project?

Any help is much appreciated!

Edit: I don't have any reference to System.Web in the .Net tab of the 'Add Reference' window.

Darnelldarner answered 18/9, 2010 at 12:32 Comment(1)
I just went into the csproj file and added: <Reference Include="System.Web" /> and it pulled the correct version from the GAC after the project reloadedRositaroskes
F
33

If you target .NET 3.5 or 4 client profile, you won't see ASP.NET assemblies.

Besides, you should try to use HTTP classes in System.Net.

Friable answered 18/9, 2010 at 13:19 Comment(1)
Just to specify, for individuals who might happen upon this question via Google (like I did), you need to right-click the project -> properties -> then change the "Target framework" which will probably be ".NET Framework 4 Client Profile" to just ".NET Framework 4".Nicolas
D
79

For people that cant find "System.Web" at .Net References, this might be the answer:

"you need to right-click the project -> properties -> then change the "Target framework" which will probably be ".NET Framework 4 Client Profile" to just ".NET Framework 4".

The answer was given by Tinister (thanks) as a reply to a previuos post. But I thought it was a little bit hidden at his original post. So i put it here to make it easer to be seen. Hope it helps.

Delayedaction answered 15/7, 2011 at 18:19 Comment(1)
what about windows phone?Gingham
F
33

If you target .NET 3.5 or 4 client profile, you won't see ASP.NET assemblies.

Besides, you should try to use HTTP classes in System.Net.

Friable answered 18/9, 2010 at 13:19 Comment(1)
Just to specify, for individuals who might happen upon this question via Google (like I did), you need to right-click the project -> properties -> then change the "Target framework" which will probably be ".NET Framework 4 Client Profile" to just ".NET Framework 4".Nicolas
B
10

System.Web should be referenced from the GAC. This assembly has nothing to do in your application folders.

alt text

Bedchamber answered 18/9, 2010 at 12:35 Comment(1)
I don't have those .NET references - only System.Web.Services and System.Web.ApplicationServices shows up.Darnelldarner
I
8

1 right click on References in Solution Explorer and press add reference...

2 choose the browse tab and go to C:\Windows\assembly\GAC_32\System.Web\System.Web.dll and add the dll file to your references.

Infract answered 20/7, 2011 at 14:22 Comment(0)
R
0

Are you trying to add a reference to the System.Web.dll file itself? System.Web is in the GAC on any Windows system, so when you add the reference in your "Add Reference" dialog, choose System.Web from the .NET tab.

Rankle answered 18/9, 2010 at 12:36 Comment(1)
I don't have those .NET references - only System.Web.Services and System.Web.ApplicationServices shows up. Hence trying to add the dll itself.Darnelldarner

© 2022 - 2024 — McMap. All rights reserved.