C# – Linq and DataSetExtensions warnings using .NET Framework 2.0 and C# 3

cnet

I am receiving the following warnings:

Warning 1 Could not resolve assembly
System.Xml.Linq. The target framework
required by this assembly (3.5) is
higher than the project target
framework. If this reference is
required by your code, you may get
compilation
errors. ConsoleApplication1

Warning 2 Could not resolve assembly
System.Data.DataSetExtensions. The
target framework required by this
assembly (3.5) is higher than the
project target framework. If this
reference is required by your code,
you may get compilation
errors. ConsoleApplication1

Warning 3 The referenced component
'System.Xml.Linq' could not be found.

Warning 4 The referenced component
'System.Data.DataSetExtensions' could
not be found.

Do you know how to fix them? My project needs to target .NET2.0, but I am allowed to use C# 3 features if they are supported.

Best Answer

System.Data.DataSetExtensions.dll is part of .NET 3.5; it might work simply by bundling the dll, but that isn't the supported route. The "fix" here is to either target .NET 3.5 and have .NET 3.5 as a pre-requisite; or don't use DataSetExtensions (use regular access instead; perhpas with some LINQBridge and just write the missing extension methods you want yourself).

If you aren't using DataSetExtensions in your code, then just remove the unnecessary references to System.Data.DataSetExtensions and System.Xml.Linq (in solution explorer).