Linq – The type or namespace name ‘Linq’ does not exist in the namespace ‘System.Data’


We're getting an error when deploying a project to one of our client's servers. The system works fine in our local dev and staging environments. The error is:

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

We've done the obvious checks:
– We have the references in the web.config for System.Data.Linq, System.Core, System.Linq, etc.
– Our project's target framework is 3.5
– We have confirmed that the ASP.NET version in IIS on the client's server is 2.0.50727
– We have confirmed that the server has framework 3.5 installed and contains the System.Data.Linq DLL in the Windows/assemblies folder.

Any other ideas?

Best Solution

I had the same compilation error when building a project from scripts, while Visual Studio 2010 was building the same project fine. When I tried to add the System.Core reference from within VS2010 it came back with an error saying that reference is set implicitly, and wouldn't add the reference.

The solution for me was to add the following reference manually into the csproj file. Note the reference's target framework is explicitly set to 3.5 (this is on top of the project's target framework being set to 3.5):

<Reference Include="System.Core">