Export (0) Print
Expand All
1 out of 4 rated this helpful - Rate this topic

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

The different types of LINQ projects require certain imported namespaces (Visual Basic) or using directives (C#) and references. The minimum requirement is a reference to System.Core.dll and a using directive for System.Linq. By default, these are supplied if you create a new Visual C# 2008 project. LINQ to DataSet also requires a reference to System.Data.dll and System.Data.DataSetExtensions.dll and an Imports (Visual Basic) or using (C#) directive.

If you are upgrading a project from an earlier version of Visual Studio, you might have to supply these LINQ-related references manually. You might also have to manually set the project to target the .NET Framework version 3.5.

Note Note

If you are building from a command prompt, you must manually reference the LINQ-related DLLs in drive:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5.

To target the .NET Framework 3.5

  1. In Visual Studio 2008, create a new Visual Basic or C# project. Alternatively, you can open a Visual Basic or C# project that was created in Visual Studio 2005 and follow the prompts to convert it to a Visual Studio 2012 project.

  2. For a C# project, click the Project menu, and then click Properties.

    1. In the Application property page, select .NET Framework 3.5 in the Target Framework drop-down list.

  3. For a Visual Basic project, click the Project menu, and then click Properties.

    1. In the Compile property page, click Advanced Compile Options and then select .NET Framework 3.5 in the Target Framework (all configurations) drop-down list.

  4. On the Project menu, click Add Reference, click the .NET tab, scroll down to System.Core, click it, and then click OK.

  5. Add a using directive or imported namespace for System.Linq to your source code file or project.

    For more information, see using Directive (C# Reference) or How to: Add or Remove Imported Namespaces (Visual Basic).

To enable LINQ to DataSet functionality

  1. If necessary, follow the steps earlier in this topic to add a reference to System.Core.dll and a using directive or imported namespace for System.Linq.

  2. In C# or Visual Basic, click the Project menu, and then click Add Reference.

  3. In the Add Reference dialog box, click the .NET tab if it is not on top. Scroll down to System.Data and System.Data.DataSetExtensions and click on them. Click the OK button.

  4. Add a using directive or imported namespace for System.Data to your source code file or project. For more information, see using Directive (C# Reference) or How to: Add or Remove Imported Namespaces (Visual Basic).

  5. Add a reference to System.Data.DataSetExtensions.dll for LINQ to Dataset functionality. Add a reference to System.Data.dll if it does not already exist.

  6. Optionally, add a using directive or imported namespace for System.Data.Common or System.Data.SqlClient, depending on how you connect to the database.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.