tags:

views:

78

answers:

4

Hi,

Can I use .net 3.5 binaries for a library with a .net 4.0 application / what are the negatives if any? In other words is there any reason I should take more time out to download source for the library and build it under .net 4.0 (assuming it builds without any problems I guess) as opposed to downloading the .net 3.5 binaries.

I'm using C# in VS2010.

thanks

+3  A: 

.NET 4.0 is compatible with .NET 3.5 and earlier, but as comments below indicate, best practice would be to recompile with .NET 4.0 when you can.

It is safe (and intended) that you can use assemblies targeting older versions of the framework.

John Weldon
Better not use "on top of". It is hard to understand. I suggest we say on .NET 4 there is backward compatibilities. Besides, if you have the source code of the assemblies, better recompile them against 4 to get more benefits.
Lex Li
@Lex Li-MSFT Are you saying that .NET 4.0 does not depend on .NET 2.0, and .NET 3.5 at all? That is not at all how I understand it.
John Weldon
.NET 4.0 does not "build on top of previous versions". This is only the case for 3.5, 3.0 which are indeed additive releases "on top of" .net 2.0.
Wim Coenen
I would also argue that .Net 4.0 is not compatible with 3.5. See this list of changes made throughout the framework: http://msdn.microsoft.com/en-us/library/ee941656.aspx
Peter Lillevold
+1  A: 

No problems whatsoever. No expected ones anyway but I bet ya microsoft has one up their sleve, they tend to work in mysterious ways :)

Jonas B
+1  A: 

It should be fine but there are some issues that can arise but might now be fixed in the release version. See:

http://krishnabhargav.blogspot.com/2010/02/using-net-35-clr-20-dll-inside-visual.html
Kelsey
A: 

Read Microsoft's advice about .NET 4.0 compatibility in this article: Version Compatibility in the .NET Framework.

Wim Coenen