0

我在 .NET 4.5(VS 2012)中有一个 ASP.NET MVC4 Web 应用程序项目。它在VB中。它无法加载 System.Data.Linq 命名空间(包含所有类和子命名空间)。项目有一个对 System.Data.Linq.dll 的引用集。

任何想法问题出在哪里?

当我尝试添加 Linq2Sql 类时,我收到这样的警告:

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.   

和这样的错误:

System.Data.Linq.DataContext

但这只是一个开始:如果我尝试使用 System.Data.Linq 命名空间中的任何内容,我会收到一个错误,例如,如果我尝试使用 System.Data.Linq.Mapping.DatabaseAttribute,我会收到这样的错误:

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

1 回答 1

1

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.

于 2014-10-29T10:32:14.997 回答