jay@imarkup.com (1) [Avatar] Offline
#1
The first chapter states "This means that the applications you’ll build using
LINQ can run in a “bare” .NET 2.0 runtime!" .... Is this true? Or will it require our runtimes to install .NET 3.0 ... or .NET 3.5?
Thanks!
fabrice.marguerie (224) [Avatar] Offline
#2
Re: LINQ support on .NET 2.0?
Hi Jay,

Absolutely. Here is a test I did with a program built with VS 2008 Beta 2:
1) Create a new console application
2) Keep only System and System.Core as referenced assemblies
3) Set Copy Local to true for System.Core, because it does not exist in .NET 2.0
4) Use a LINQ query in the Main method. For example the one below.
5) Build
6) Copy all the bin output to a machine where only .NET 2.0 is installed
7) Run

It should run without any problem. At least it did for me. A sample .NET 3.5 LINQ application did run on a machine where neither .NET 3.0 nor .NET 3.5 have been installed ever.

Warning: This may not work in all cases. I know that .NET 2.0 SP1 is installed with .NET 3.5. It may be required under certain circumstances, but I don't know which. I my case, I didn't use .NET 2.0 SP1, and to the best of my knowledge there is not separate installation for it yet anyway.

The sample code I used:

class Program
{
static void Main(string[] args)
{
var processes =
from process in System.Diagnostics.Process.GetProcesses()
where process.ProcessName.StartsWith("s", StringComparison.InvariantCultureIgnoreCase)
select new {process.Id, Name = process.ProcessName};

foreach (var process in processes)
Console.WriteLine(process);
}
}

Fabrice
rama.vavilala (5) [Avatar] Offline
#3
Re: LINQ support on .NET 2.0?
Are there any restrictions in doing so? It works technically but is such a thing supported by Microsoft?

BTW: It is a nice book you got especially the samples

Message was edited by:
rama.vavilala
fabrice.marguerie (224) [Avatar] Offline
#4
Re: LINQ support on .NET 2.0?
I don't think the restrictions are clearly documented by Microsoft yet.
In fact, someone has just reported to me that in order to use LINQ to SQL on .NET 2.0, the Service Pack 1 of .NET 2.0 is required. I guess this service pack will be made available without having to install .NET 3.5.
Once .NET 2.0 SP1 is installed, I expect that all LINQ applications will run fine.

PS: I'm glad you like the book smilie
Enuratique (2) [Avatar] Offline
#5
Re: LINQ support on .NET 2.0?
Microsoft recently released the distributable for the .NET 2.0 Framework SP1. I'm in the middle of a project but I will try to confirm whether 2.0 SP1 on a 3.5 "virgin" computer will run LINQ assemblies...

http://www.microsoft.com/downloads/details.aspx?familyid=79BC3B77-E02C-4AD3-AACF-A7633F706BA5&displaylang=en
jwooley (123) [Avatar] Offline
#6
Re: LINQ support on .NET 2.0?
Fabrice's steps should run without 3.5 for LINQ to OBJECTS queries. If you want to do LINQ to SQL, you will need to include a reference to System.Data.Linq. Similarly, if you want to do LINQ to XML, you will need to reference System.Xml.Linq. Both of these are in the 3.5 directory. You will need the 2.0 SP1 if you use the designer or SQL Metal to generate your LINQ to SQL classes in order to use the INotifyPropertyChanging interface as that was added as part of SP1. If you hand create your object mapping, you may be able to get by without SP1, though you may loose the change tracking in the process.

Jim
Enuratique (2) [Avatar] Offline
#7
Re: LINQ support on .NET 2.0?
Thanks Jim! I figured this was the case but I'm glad there's something definitive. There are many, many contradictory answers to this very question floating around the web (in part to disruptive changes between the CTP and final versions of these frameworks).
412624 (2) [Avatar] Offline
#8
thank man this helpful.
???????gclub