Oct 07

Visual Studio 2008 Annoyances #0001 (Beta 2): LINQ to SQL DBML file doesn”t regenerate

While the new LINQ features in VS 2008 are great, I’ve had a few problems.  Here is #0001.  Actually #0001 is probably random crashes, but I can’t really narrow that down to repeatable steps. 

After dragging a few tables from my database onto the design surface, all of my LINQ code worked great.   Then I added a new table to the designer and I was not able to access it using LINQ.  It was on the design surface, but the code for the datacontext class was not being regenerated.  I rebuilt, closed VS deleted the compiled DLLs, but no luck.  Pretty frustrating. Obviously a big downside of wizard generated code is that when it’s not working, there isn’t much you can do.

The way I ultimately got it fixed was the following.

  1. Renamed my current .dbml file, “LINQTest.dbml” to “LINQTest2.dbml”

  2. Copied “LINQTest2.dbml” into the same location

  3. Renamed “Copy of LINQTest2.dbml” to “LINQTest.dbml”

  4. Designer regenerated code behind file for “LINQTest.dbml.

  5. Deleted “LINQTest2.dbml”

Not ideal.  Clearly you want to make you changes in large batches if possible.  I imagine this will be fixed in the final version coming out soon.  Still it’s a little surprising that a big feature like this would have an obvious bug in Beta 2.

0 comments , permalink