none
error CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System.Data'

    Question

  • After uninstalling, re-installing and uninstalling and re-installing and uninstalling and spending most of the day doing that, I resorted to using the maintainance (Repair) option of Visual Studio 2008 PROFESSIONAL, I have a limp along IDE. I created a couple of tables, and a stored procedure, created (using the solution explorer) a new item  LINQ to SQL class, dropping the tables and stored procedure on the O/R. I saved this file to commit the changes. Then I dropped a LinqDataSource and a GridView on the page (via designer). When I tried to choose a Data Context object for the LinqDataSource the only choice I have is WebApplication1._Default which does not have the tables. I have a reference to System.Data.Linq and Core. The Web.config contains these lines:

    <assemblies>

    <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

    <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

    <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

    </assemblies>

    And of course the project compiles just fine; however when I run the page I get the above error message.

     

    Any thoughts on how to resolve this error?

     

    TIA

    Allen

    Sunday, May 25, 2008 5:15 AM

Answers


  • Check your project/application settings and ensure that the target framework is set to 3.5.


    --Samir

    Sunday, May 25, 2008 5:26 AM

All replies


  • Check your project/application settings and ensure that the target framework is set to 3.5.


    --Samir

    Sunday, May 25, 2008 5:26 AM
  • I'm having the same issue and my target framework is set to 3.5
    Thursday, July 30, 2009 11:02 PM
  • Greetings,

    I had a similar issue with "System.Data.Linq" when creating my objects within a directory.  The problem was resolved by moving my object to the root of the directory.  As weird as it sounds, that strategy solved it.
    • Proposed as answer by mustapha kone Thursday, September 24, 2009 2:04 PM
    Thursday, September 24, 2009 2:03 PM
  • It's ok to have a reference to assembly

    <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>


    but you need to had the reference to Data.Linq

    <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

    Try it!
    Tuesday, January 05, 2010 1:35 AM
  • Thanks. This solved the issue. Go to Project --> Property Pages --> Build --> select .net framework 3.5. This really solves the problem , as the project when pointing to framework 2.0 does not include a reference to LINQ and when 3.5 framework is selected then the LINQ reference comes automatically.

     

     

    Friday, September 10, 2010 7:51 AM
  • Just a point about VS 2010 at least. I had a project where the project framework was 4 and the version 4 assemblies were being referenced but it still complained that System.Xml did not contain Linq. I solved this by changing the project framework to one that I did not want and then going back into the project properties and selecting framework 4 again. This time it reconfigured something to its satisfaction and the project started compiling.
    Sunday, November 21, 2010 2:04 PM
  • Just a point about VS 2010 at least. I had a project where the project framework was 4 and the version 4 assemblies were being referenced but it still complained that System.Xml did not contain Linq. I solved this by changing the project framework to one that I did not want and then going back into the project properties and selecting framework 4 again. This time it reconfigured something to its satisfaction and the project started compiling.

    OMG...I've been going insane over the past 2 hours...thank goodness I saw this post.  you are awesome!
    Tuesday, January 25, 2011 10:51 PM
  •  

    Had similar issue.  Reference to .dll was there, using statement was there.  Type/namespace error wouldn't quit.  Setting the target Framework to 3.5, then immediately back to 4.0 worked for me as well.  Thanks for making no sense again Visual Studio 2010!

    Tuesday, March 15, 2011 4:47 PM