Can you use DLL.net 3.5 DLL with .net 2.0 website?

I have several DLLs that it would be much easier to use .net 3.5 inside (to use Linq, etc.). I want to use these DLLs with asp.net websites that are currently running asp.net 2.0.

Is it possible? Are there any restrictions or gotchas (for example, asp.net does not call method calls that return .net 3.5 objects such as IQueryable)?

Note. Of course .net 3.5 will be installed on the server.

+6
source share
4 answers

To expand on what foosnazzy said, .NET 3.5 (SP1) is just .NET 2.0 SP2 with some new builds. The only reason not to install it on a website is if the website will not work with .NET 2.0 SP2.

This is very different from what it used to be: installing .NET 1.1 on the .NET 1.0 website, which I was responsible for violating the website, even though the website did not use 1.1 - I installed 1.1 so i could use a specific tool. Upgrading from .NET 1.1 to .NET 2.0 is an even worse nightmare.

But Microsoft found out about this ... NET version 2.0. NET 3.5 SP1 uses the .NET 2.0 Common Language Runtime (CLR). In fact, people who installed 3.5 are often surprised to see IIS settings and see that their websites still appear to be running on .NET 2.0. But this is the same .NET 2.0, with only two service packs. Any site that does not use new builds cannot be affected at all (besides what the service pack can do).

To repeat this, C # 3.0 features are independent of the Framework. For example, you can use anonymous types and lambdas in pure .NET 2.0 code. What you cannot do is use LINQ, as this requires new assemblies in .NET 3.5.

+5
source share

You can use many C # 3 features in .net 2.0, but Linq is not one of them. You must include the Linq DLL, which you are not allowed to distribute separately and must install the full 3.5 runtime.

NOTE. If .net 3.5 is installed, I think that you will have problems if the site is not configured to enable assemblies from 3.5. It can work in a web application project (unlike the Web Forms project), since the dlls are compiled in advance and may contain the necessary links in PE files, but I'm not sure.

+3
source share

3.5 adds to the environment 2.0, everything is fully backward compatible.

+2
source share

Always LinqBridge , which allows you to use Linq To Objects in a .NET 2.0 environment. However, there are some caveats around using it with ASP.Net, depending on whether you are using ASP.NET Web Application or ASP.NET Web Site projects. See this page for more details.

+2
source share

All Articles