Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 814
Keith Avatar asked Aug 19 '09 20:08

Keith


2 Answers

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">
  <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
like image 115
Ashby Avatar answered Oct 17 '22 02:10

Ashby


From here: 'You'll get this error if you don't have "System.Core.dll" referenced (the assembly which contains the core LINQ APIs). However, all of the default templates should include this reference when you target .NET3.5.'

like image 34
Jason Marcell Avatar answered Oct 17 '22 03:10

Jason Marcell