Reputation: 73918
I'm using C#, EF 4 in asp.net 4 and VS 2010.
I'm trying to load namespace System.Data.Linq
with this code using System.Data.Linq
and I receive this error:
Error 2 The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
Any idea what I'm doing wrong.
Upvotes: 28
Views: 53624
Reputation: 1
For VS 2022 and project on .NET 6.0 --- Project \ Referencies \ search \ MindBox.Data.Linq, everywhere "OK", install (based on personnel expirience)
Also, may be, need install -- Referencies \MS.System.Linq.Queryable (or MS.Queryable, not remember)
After all action LinqToSQL will be work in project.
Upvotes: -1
Reputation: 43
VS Installer
The above answers didn't work for me, my problem was that I needed to add LINQ to SQL tools in Visual Studio.
Upvotes: 3
Reputation: 6203
Try re-change target framework for your project.
Go to Proporties > Application > Target Framework change to another than used now, and next change it back.
Upvotes: 4
Reputation: 608
Just to confirm that Adding the reference to the project didn't work for me because it was already selected.
However, selecting "Copy Local, True" in the Properties pane for the reference made it start working.
Upvotes: 11
Reputation: 1062780
That namespace is LINQ-to-SQL, so you'll also need to add a reference to System.Data.Linq.dll; it won't be added by default just by adding Entity Framework.
Upvotes: 5
Reputation: 23268
Right click your solution/project. Click Add Reference and search for System.Data.Linq and add the reference there and it should compile.
Upvotes: 45