How to: Create a LINQ to DataSet project In Visual Studio

The different types of LINQ projects require certain assembly references and imported namespaces (Visual Basic) or using directives (C#). The minimum requirement for LINQ is a reference to System.Core.dll and a using directive for System.Linq.

These requirements are supplied by default if you create a new C# console app project in Visual Studio 2017. If you're upgrading a project from an earlier version of Visual Studio, you might have to supply these LINQ-related references manually.

LINQ to DataSet requires two additional references to System.Data.dll and System.Data.DataSetExtensions.dll.

Note

If you're building from a command prompt, you must manually reference the LINQ-related DLLs in %ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.5.

To enable LINQ to DataSet functionality

Follow these steps to enable LINQ to DataSet functionality in an existing project.

  1. Add references to System.Core, System.Data, and System.Data.DataSetExtensions.

    In Solution Explorer, right-click on the References node and select Add Reference. In the Reference Manager dialog box, select System.Core, System.Data, and System.Data.DataSetExtensions. Select OK.

  2. Add using directives (or Imports statements in Visual Basic) for System.Data and System.Linq.

    using System.Data;
    using System.Linq;
    
  3. Optionally, add a using directive (or Imports statement) for System.Data.Common or System.Data.SqlClient, depending on how you connect to the database.

See also