C # .NET DLL will not work due to System.Web conflicts

I had a problem with my class library in Visual Studio C # Express 2010. The project is configured with the target structure of .NET 4.0 (and not with the client profile).

In my class library, I added a link to System.Web to get the URL encoding for my oAuth library.

When creating a DLL and its associated test application, I get the following error:

Error 1 The type or namespace name 'TwitterAPI' could not be found (are you missing a using directive or an assembly reference?) C:\Users\sammarks\Documents\Programming\Twitter.NET\Tester\Program.cs 5 7 Tester 

And I get the following warning message:

 Warning 2 The referenced assembly "C:\Users\sammarks\Documents\Programming\Twitter.NET\TwitterAPI\bin\Release\TwitterAPI.dll" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project. Tester 

I'm not sure why this is so, but why I came here. I tried to redirect the class library to 3.5, but it didn’t help, but it was useless.

I also tried re-adding System.Web to the links, but that didn't help either.

Any suggestions?

+7
source share
3 answers

Define the full .NET Framework 4.0 to access System.Web ( not the client profile):

enter image description here

+9
source

It looks like your class library has a link to a client profile, and your test executable refers to a non-client profile. I am extracting this from a warning:

 ...currently targeted framework ".NETFramework,Version=v4.0,Profile=Client ... 
+1
source

It may seem silly, but have you tried restarting Visual Studio?

Sometimes it tends to skip a link or two.

0
source

All Articles