Dima
Dima

Reputation: 1761

System.Data.Linq not loaded in MVC .NET 4.5

I have an ASP.NET MVC4 Web Application project in .NET 4.5 (VS 2012). It is in VB. It fails loading System.Data.Linq namespace (with all classes and sub-namespaces). Project has a reference set to System.Data.Linq.dll.

Any ideas where is the problem?

When I try to add Linq2Sql classes, I get such warning:

Namespace or type specified in the Imports 'System.Data.Linq' doesn't contain 
any public member or cannot be found. Make sure the namespace or the type is 
defined and contains at least one public member. Make sure the imported element 
name doesn't use any aliases.   

and such errors:

System.Data.Linq.DataContext

But this is just a beginning: if I try to use anything from System.Data.Linq namespace I get an error, for example if I try to use System.Data.Linq.Mapping.DatabaseAttribute, I get such error:

Type 'System.Data.Linq.Mapping.DatabaseAttribute' is not defined.

Upvotes: 0

Views: 547

Answers (1)

jon.v
jon.v

Reputation: 46

I had this same problem - and was able to get past it. I'm not entirely sure which of these steps resolved the issue - but this is what I did.

  1. I had originally created the dbml under app_code/gcm
  2. I removed references to System.Data.DataSetExtensions
  3. I deleted the dbml and recreated it outside of the app_code folder
  4. I built the project (no errors/warnings)
  5. I moved the dbml back to the app_code folder and rebuilt (again no errors/warnings)

Hope that helps you get around this.

Upvotes: 1

Related Questions