Is there a way to use LINQ query syntax with .NET 3.0 projects?

后端 未结 3 1092
遥遥无期
遥遥无期 2021-01-18 15:37

I have a project which can only be deployed on a server running .NET 3.0. I desperately want to use LINQ to simplify some excruciatingly tedious logic. Is there a simple way

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-18 15:55

    Taken from http://codebeat.wordpress.com/2008/06/23/using-linq-in-net-30/:

    1. First, configure the target framework of the projects using Linq to .NET 3.0. The .NET 3.5 references will be removed.
    2. Then, copy System.Data.Linq.dll and System.Core.dll in the solution, wherever you prefer (in my case, the root folder).
    3. Add them as references in all the corresponding projects. Visual Studio will warn about the assemblies need a later version of the framework. Press Yes.
    4. Set the SpecificVersion property of the references to true. This will prevent compiling errors.

    I tried this, and it worked, but beware of Mike Atlas's caution about the legal ramifications of deploying these 2 files.

提交回复
热议问题