views:

21

answers:

2

I have a website that is currently running under .NET 3.5. I am thinking of making it run under 4.0, but I use many 3rd-party DLL's for compressing, Bit.ly, Twitter, XML, etc. If these DLL's were created for .NET 3.5 (in VS2008), will they continue to run under 3.5? Or is 4.0 somehow backwards compatible for old libraries?

+1  A: 

If these DLL's were created for .NET 3.5 (in VS2008), will they continue to run under 3.5?

There's no such thing as running under 3.5. .NET assemblies are compiled against a .NET version and then loaded and executed by the CLR. .NET 3.5 uses CLR 2.0 and .NET 4.0 uses CLR 4.0.

So if your application is running under the CLR 4.0 those assemblies will run under the CLR 4.0 which is backwards compatible with assemblies compiled against .NET 3.5. There could be some caveats if those assemblies call unmanaged functions but otherwise they should work just fine.

Go ahead and try running them.

Darin Dimitrov
A: 

If they're purely managed code, I'd expect them to work just fine under .NET 4. If they use unmanaged APIs, I believe there can be some problems, and you may need to rebuild those libraries - but if they're open source, that shouldn't be a problem.

(I know that there's one database provider who at least until recently only provided .NET 3.5 DLLs, and they didn't work in .NET 4 precisely because they used unmanaged APIs via P/Invoke. I don't know the details of what's changed in that area, unfortunately - I tend to avoid P/Invoke like the plague :)

Jon Skeet