Home » Questions » Computers [ Ask a new question ]

LINQ on the .NET 2.0 Runtime

LINQ on the .NET 2.0 Runtime

"Can a LINQ enabled app run on a machine that only has the .NET 2.0 runtime installed?

In theory, LINQ is nothing more than syntactic sugar, and the resulting IL code should look the same as it would have in .NET 2.0.

How can I write LINQ without using the .NET 3.5 libraries? Will it run on .NET 2.0?"

Asked by: Guest | Views: 226
Total answers/comments: 4
Guest [Entry]

"There are some ""Hacks"" that involve using a System.Core.dll from the 3.5 Framework to make it run with .net 2.0, but personally I would not want use such a somewhat shaky foundation.

See here: LINQ support on .NET 2.0


Create a new console application
Keep only System and System.Core as referenced assemblies
Set Copy Local to true for System.Core, because it does not exist in .NET 2.0
Use a LINQ query in the Main method. For example the one below.
Build
Copy all the bin output to a machine where only .NET 2.0 is installed
Run


(Requires .net 2.0 SP1 and I have no idea if bundling the System.Core.dll violates the EULA)"
Guest [Entry]

"There are some ""Hacks"" that involve using a System.Core.dll from the 3.5 Framework to make it run with .net 2.0, but personally I would not want use such a somewhat shaky foundation.

See here: LINQ support on .NET 2.0


Create a new console application
Keep only System and System.Core as referenced assemblies
Set Copy Local to true for System.Core, because it does not exist in .NET 2.0
Use a LINQ query in the Main method. For example the one below.
Build
Copy all the bin output to a machine where only .NET 2.0 is installed
Run


(Requires .net 2.0 SP1 and I have no idea if bundling the System.Core.dll violates the EULA)"
Guest [Entry]

In theory yes, provided you distribute the LINQ specific assemblies and any dependencies. However that is in violation of Microsoft's licensing. Scott Hanselman wrote a blog post about Deploying ASP.NET MVC on ASP.NET 2.0 which is similar to what you are wanting to do.
Guest [Entry]

"You can use the LINQ sources from mono (.NET for Linux) to get LINQ running on .NET 2.0.

IEnumerable<T> : yes
IQueryable<T> : yes
LINQ to XML : has been working in the trunk, but due to further additions, the trunk doesn't compile anymore

Someone has done it here:
LINQ for .NET 2.0"