I am having a peculiar error when I try to add a LinqDataClasses object in Visual Studio.
I’ve got a SQL Server 2008 database that I’ve pulled into VS2010’s Server Explorer.
When I create the LinqDataClasses, everything is okay, but whenever I add certain tables, I get hundreds of errors.
Most of the errors are of the type:
The type name {1} does not exist in the type {2}
E.g.:
The type name ‘Data’ does not exist in the type ‘MyApplication’
These errors occur in the LinqDataClasses designer page (the designer.cs page to the .dbml file).
I can eliminate some of these errors by prefixing global:: in front of every system library (e.g. global::System.Data.Linq), but I have used LinqDataClasses before and not had this issue.
Any thoughts?
Thanks.
Is any of your classes called “System” or “Data” or something else that might alias with a system type? Maybe the problem is not having two classes but the specific class that you add 2nd?!
The key to solving this bug is to treat the compiler errors in the generated code the same as your own compiler errors. That leads to the deeper cause (in your case a duplicate name).