3

I have a web project in visual studio 2012 that I am working with over an ftp connection. I am getting the error that the Linq does not exist in the namespace System.Data and Linq does not exist in the namespace System. Visual studio displays an error and will not give code suggestions, however, the code runs fine on the IIS server.

My web.config contents are below.

I have read over the many questions and articles on this problem and was still unable to find a working solution.

<system.web>
<compilation debug="true" strict="false" explicit="true" urlLinePragmas="true">
  <assemblies>
    <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="System.Data.Services.Client, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Data.Services.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Data.Entity, 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.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  </assemblies>
</compilation>
<pages>
  <namespaces>
    <clear/>
    <add namespace="System"/>
    <add namespace="System.Data.Linq"/>
    <add namespace="System.Linq"/>
    <add namespace="System.Xml.Linq"/>
  </namespaces>
</pages>

2
  • Why have you got some version 2.0.0.0 stuff in there. Have you changed the target framework at some point? Commented Oct 27, 2012 at 17:54
  • Those appear to be the latest versions of those assemblies. Commented Oct 27, 2012 at 20:29

4 Answers 4

6

Try to manually add the reference to System.Data.Linq in your project.This should hopefully resolve your problem.

Project -> References -> Add reference -> System.Data.Linq

Sign up to request clarification or add additional context in comments.

1 Comment

I tried this, however, the web.config file was not changed when the reference was added. I also tried removing the reference from the web.config and then adding it again.
2

This comes a little late, but in the interest of "giving back"..... When I had this issue (VS 2010 running website through IIS), I had to change the target framework to something else, save the changes, and then change it back to v 4.0 (the original my project was built with). (Right-click Project -> property pages -> Build -> "Target Framework"). That cleared up the issue. Not sure how or why. =)

Comments

0

In Visual Studio, check that the project is targetted to a version of the .NET framework that includes Linq. Right click on the project, then look for the Target Framework option. If this is set to v2, everything else that VS tells you will be based on v2 - the available assemblies, the versions of the base class library assemblies, etc.

3 Comments

The project is targeting .NET 3.5, and all of the required LINQ assemblies are in the GAC.
I think that is valid - .NET verisons 3 and 3.5 added extra libraries but kept the .NET 2 runtime, so some of the base DLLs will be v2.
Is there a SupportedRuntime element in the config file?
0

This happens to me when I upgrade from VisualStudio 2013 to 2015. I encounter to these errors while the Project build doesnot comes to the end and stops after some warnings. I resolve these warnings, and when I solve the last warning: Could not load file or assembly 'Microsoft.ReportViewer.WebForms, Version=11.0.0.0, . . .

the error: the Linq does not exist in the namespace System

get solved.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.