LINQ to SQL – "Problem" with converted projects

Recently I converted an existing project to Visual Studio 2008.

As I wanted to build a simple data access layer, I tried to add a LINQ-to-SQL (DMBL) file.image

Seems like there's something missing here..!! No LINQ-to-SQL file!

So I tried adding a new (native 2008 and not converted) project... Voila! There it was "LINQ-to-SQL"!

So why didn't it just work in the first place?

I compared the two project files with the windiff tool, by simply entering windiff at the Visual Studio Command Prompt: What I found out should have been obvious to me before:

The new Visual Studio 2008 project had <TargetFrameworkVersion>3.5</TargetFrameworkVersion> in it, the converted former Visual Studio 2005 project hadn't.

WHAM! Of course this is the problem: LINQ requires .NET 3.5 😉

So I opened the project properties of the .NET 2.0 project and upgraded the "Target Framework" to .NET 3.5!


So always be sure, you work in a .NET 3.5 project, when using LINQ!

Comments (1)

  1. Relieved says:

    Wow, thanks for documenting this, I’ve been searching all over and couldn’t find any reference.  But as you say, it’s pretty obvious once you know the answer 😐

Skip to main content