Is Linq going to interfere with normal C# 2.0 projects

I see such questions here and there: “Is Linq going to interfere with normal C# 2.0 projects?”.

Here is my guess. There are two parts of the issue.

  1. Compiler. Linq needs a new C# (or compiler which might not work as expected (as Linq is in preview phase at this time). However, the Linq compiler kicks in only when explicitly set and the setting resides in .csproj file when you create a new Linq project:  <Import Project=”$(ProgramFiles)\LINQ Preview\Misc\Linq.targets” />. So, if you don’t want Linq compiler, don’t create a Linq project or replace the Import directive with this one: <Import Project=”$(MSBuildBinPath)\Microsoft.CSharp.targets” />. I haven’t tested the scenario but it should work.
  2. VS2005 integration. To support the syntax changes (from, select, where, …) Linq has to patch IDE – otherwise you would get errors everywhere new syntax is used. This patch doesn’t affect the final binaries thus you don’t need to do anything. Ok, I have a sense that it kills some IDE features but if you can live with that then it is ok. Otherwise you can uninstall it by running C:\Program Files\Linq Preview\Bin\Uninstall Visual Studio.IDE Support.cmd. Of course, there is also Install Visual Studio.IDE Support.cmd command located in same folder. Again, I didn’t try it yet but it should work.

The bottom line is – theoretically it shouldn’t affect C# 2 production.
While Linq doesn’t cause any evident showstoper problem you have to understand that Linq is in preview phase (not even beta yet) so I wouldn’t recommend to anyone installing Linq on production machine.

Leave a Reply