Getting Linq to work outside of a Linq project template
I've been playing with the Linq family of technologies using the May CTP, and the other day, I was trying to use Linq from a VS 2005 project but not using the Linq project template.
To get it to work, here's what I had to do:
Add references to the various Linq assemblies -
- System.Query
- System.Xml
- System.Xml.XLinq
- System.Data
- System.Data.DLinq
- System.Data.Extensions
Modify the .csproj file that gets created in Notepad and add the following at the end of the project file:
<Import Project="$(ProgramFiles)\LINQ Preview\Misc\Linq.targets" />
The above magic worked in a non WF (and ofcourse non Linq) project, but did not work for the WF project. I then found out that this will not work with a Windows Workflow Project file because WF uses the C# 2.0 CSharp Code Provider internally to compile the C# workflows, and the C# 3.0 CSharp Code Provider that comes with Linq is not in the GAC. You cannot even add it to the GAC as it is neither signed not delay signed (so you cant skip signature verification with sn -Vr either). I guess we'll just have to wait for an updated CTP drop where this issue is fixed.