I’ve started to play with Linq2Sql ORM recently and the above error occurred when VS2008 tries to regenerate dbml file changes.

image

First time I didn’t find any other solution than to rebuild the dbml file from scratch. After a while I saw this error again. Google helped me to find out that it is very common problem and is connected to the usings inside the dbml codebihind.

The trick is if you have Northwind.dbml and Northind.cs file which starts with using clause:

using System;
namespace Northwind.DAL
{
    public partial class Product
    {

move the using inside namespace

namespace Northwind.DAL
{
    using System;
    public partial class Product
    {

and re-run Custom Tool from Northwind.dbml context menu in solution explorer. Unbelievable but it helps!

Submit this story to DotNetKicks

Posted in: linq2sql  Tags:

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Comments are closed