compilation error when using linq

Discussion in 'ASP.NET / ASP.NET Core' started by terra, Mar 13, 2010.

  1. When I use linq, I get the below error
    ===
    Compiler Error Message: CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)

    Source Error:

    Line 3: using System.Configuration;
    Line 4: using System.Data;
    Line 5: using System.Linq;
    Line 6: using System.Web;
    Line 7: using System.Web.Security;


    Source File: ..\TestPage.aspx.cs Line: 5
    ====

    I have included the assembly in my web.config
    ====
    <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
     
  2. Have you also included a reference to System.Core?
     
  3. yes. I will provide the list of assemblies

    <add assembly="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.Core, 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"/>
    <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies>
     
  4. Where do you see this error? Locally or when hosted on the server?

    Your web.config looks fine so that's not the problem. Often this error is due to a missing System.Core reference but it's also possibly caused by the absence of a web.config file.

    If I was only seeing this on the hosted application, I would check there is a web.config uploaded for the TestPage.aspx application.

    I'm sorry if it seems like I'm stating the obvious but there's not much to go on here ;)
     

Share This Page