PDA

View Full Version : compilation error when using linq


terra
03-13-2010, 03:53 AM
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"/>

CrystalCMS
03-13-2010, 04:58 AM
Have you also included a reference to System.Core?

terra
03-13-2010, 05:37 AM
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>

CrystalCMS
03-14-2010, 12:52 AM
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 ;)

wisemx
03-14-2010, 06:11 AM
Hi,
Joe is spot-on about this typically being related to System.Core
Even though you have added it as an assembly you should make sure the binary exists.
Look at this thread for walk-through:
http://social.msdn.microsoft.com/Forums/en-US/vcsharp2008prerelease/thread/960c0401-6dba-47db-8a96-a2e343f6cbe4