Galin Iliev's blog

Software Architecture & Development

LINQ projects in VS "Orcas"

Yesterday I installed VS "Orcas" January CTP on my machine in order to take deeper look at things that are comming.

I was a bit surprised I could not find VS LINQ project templates and compiler throws compile error on correct linq statement.

This was kind of strange - The VS version that introduces LINQ return compile error on correct LINQ statement ???!?!?!?

The problem was only in referenced  assemblies as this post says.

So to have LINQ syntax in your VS "Orcas" you have to:

  • Add reference to LINQ assemblies located in C:\WINDOWS\Microsoft.NET\Framework\v3.5.*. You can reference them all or only those you need (The important ones are System.Core.dll, System.Data.Entity.dll, System.Data.Linq.dll and System.Xml.Linq.dll
    The core is for the standard linq queries, where Data.Linq and Xml.Linq are what the old DLinq and XLinq were. )
  • Add using clauses at the top of source files.
    using System.Linq;
    using System.Data.DLinq;
    using System.Xml.Linq