The type or namespace name 'Linq' does not exist in the namespace 'System'

Try to Unload and then reload the concerned project. That will do it.


Put this piece of code in the Configuration file (Web.config) and test it.

<compilation debug="false">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>

Visual Studio 2015 References -> Add Reference -> Assemblies -> select System.Data.Linq


I had an issue with System.Linq not being recognized. The way I solved it was to change the targeted framework of my website from 4.0 to to 3.5 and then switch back to the original targeted framework (in my case 4.0)

  1. Hit Shift+F4 or right click at the project level and select Property Pages in Visual Studio. (Alt+Enter or right click at the project level and select Properties in VS2017.)
  2. Change the Target Framework from .Net Framework 4 to .Net Framework 3.5
  3. Confirm with OK
  4. Repeat this process in reverse so, again hit Shift+F4
  5. Change it back from .Net Framework 3.5 to .Net Framework 4

Hope this helps

Tags:

.Net

Asp.Net

Wcf