tags:

views:

168

answers:

4

We started to develop a new application using .NET 4.0 Beta 2. Should we recompile our existing libraries targeting .NET 4.0 framework even if they do not use new features?

A: 

I would recommend it, even if it is just to satisfy everyone that there are no risks in using the libraries in .NET 4.0

harriyott
A: 

.NET 4.0 uses a new CLR, so assemblies built for .NET 2.0 or 3.5 cannot interoperate easily (without COM or such) with ones built for .NET 4.0. You'll want to rebuild any of those assemblies that you plan to use with your new .NET 4.0 program.

bdonlan
This is not true. Unlike the 2.0 CLR, the 4.0 CLR can host 2.0 + 4.0 CLR assemblies in a single process. This is one of the major new CLR features in .NET 4.
Reed Copsey
Yes but they still need to use COM or something to interoperate, right?
bdonlan
I'm using third party commercial libraries compiled for .net 2.0 in a 4.0 targeted application just fine -- did nothing but set target to 4.0 and it works.
JoeJoe
+3  A: 

You do not need to do so, but it is good practice.

One of the new features in .NET 4 is the ability for multiple versions of the CLR to be hosted in one process. This makes it easy for a .NET 4 application to use CLR 2.0 assemblies.

However, there is most likely some extra overhead involved in having both versions of the CLR hosted (I haven't seen specifics on this, though).

Reed Copsey
A: 

It depends. I'd say if you don't have a lot of external dependencies, go for it. Just be aware that your customers will need to have .NET 4 on their systems. That might not be a big deal if you're selling software, but if you're deploying to an internal enterprise, you'll need buy in from IT staff.

If you do have a lot of external dependencies (O/RM, IoC container, logging, etc.) and those dependencies are not compiled for .NET 4, you'll end up with multiple versions of the CLR loaded in your app. You might want to profile your app and see how it performs before making the leap.

Andy S