Yesterday I faced an issue: I needed to host an .NET 3.5 application in a .NET 3.0 web server, because the .NET 3.5 web server wasn’t available at time. The application was built using Linq to Sql instead of “traditional” CRUD classes. So I had no choice, but make the app run.
Well, a workaround is to make a local copy of the referenced assemblies; in my case, System.Data.Linq.dll and System.Core.dll.
- First, configure the target framework of the projects using Linq to .NET 3.0. The .NET 3.5 references will be removed.
- Then, copy System.Data.Linq.dll and System.Core.dll in the solution, wherever you prefer (in my case, the root folder).
- 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.
- Set the SpecificVersion property of the references to true. This will prevent compiling errors.
- Compile.
- Run the app!
Although I get your samples to work (which are ASPX web apps), I have not been able to apply the same method to a Windows Forms application… Could you say whether you think I should or should not be able to use this same approach for a Windows Forms app targeting .net 3.0 ?
Hey, I figured it out, how you do it with Windows Forms apps.
Open the project file with a text editor, and change the
3.5 tag to
3.0
I’m finding it slightly amusing that that is all you have to do to get it to work, but it seems to be so… just need to test my app running against a real 3.0 framework (not just the version simulated by VS2008).
My last post got mangled by the submit process it should have said:
Change the RequiredTargetFramework tag.
Ie.
RequiredTargetFramework>3.53.0<RequiredTargetFramework