to run both 3.5 and 4.0 web apps?
I found that I needed 3.5 even though I have 4 installed. Without 3.5 I was getting GfxUI has stopped working error. Despite installing the latest Intel Drivers for G41 chipset The error would persist. I then found a post which said it requires .net3.5 and as soon as I installed this I was OK. So... as previously said it all depends on the apps you have installed. If they need 3.5 then you need to install both.
To add one more point...
All Frameworks prior to 4.0 [4.0 CLR] (yes, even 3.5.1) are based on the 2.0 CLR. Microsoft has made every attempt to make 4.5 [4.5 CLR] a "seamless" in place upgrade (or service [if not feature] pack).
Like another astute commented stated above, if you have dependencies for 3.5.1 that can't be transitioned, choices are a bit more limited. Does anyone know if the Entity and LINQ stacks have been fully transitioned from the 3.5.1 Framework? I'm assuming that it has, but not sure.
Another note... Simply installing 4.5 on some servers... with MOSS2K7, SP2010 services may be fun... ;-o
http://msdn.microsoft.com/en-us/magazine/ee819091.aspx
It appears you need to install side by side.
I remember reading something once from Microsoft that stated:
".NET 4.0 adds in-process side-by-side compatibility with earlier versions of the Framework. This feature allows an application process to simultaneously run part of its code using the .NET Common Language Runtime (CLR) 4 and other parts using older versions of the CLR."
So to answer your question you only need both if your application uses features from both or altenatively you have separate web applications that use .NET 3.5 and .NET 4.0.
.NET 4.0 should be fine by itself, as long as you can upgrade your 3.5 applications to 4.0. This page has some useful infrmation.
Heres where I read it.
Only 4.0 should be enough, there could be some issues though - for example J# does not work on .net 4.0