Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# .NET DLL Won't Build Because of System.Web conflicts

I'm having an issue with my Class Library in Visual Studio C# Express 2010. The project is configured with a target framework of the .NET 4.0 (not Client Profile).

In my class library, I have added a reference to System.Web to get the URL Encoding to work for my oAuth library.

When building the DLL, and the associated testing 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 follow 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 it does this, but that's why I came here. I've tried retargeting the class library to 3.5, but that did nothing but mess it up further.

I've also tried to re-add the System.Web to the references, but that didn't help either.

Any suggestions?

like image 823
sammarks Avatar asked Feb 01 '11 21:02

sammarks


1 Answers

Target the full .NET Framework 4.0 for access to System.Web (not the Client Profile):

  • .NET Framework Client Profile assemblies

enter image description here

like image 151
JohnB Avatar answered Sep 30 '22 00:09

JohnB