Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does .net 4.5 work side by side with .net 4.0?

People also ask

Is .NET 4.5 backwards compatible?

The . NET Framework 4.5 and later versions are backward-compatible with apps that were built with earlier versions of the . NET Framework.

Does installing .NET 4.0 will affect existing .NET applications running on previous versions?

In fact, 4.0 uses completely different directories to store its assemblies in. Uninstalling will prevent you from using older programs. It is however possible to run 2.0+ software using the 4.0 runtime, with some extra configuration in the application config file.

Can different versions of NET Framework coexist?

Microsoft designed the . NET Framework so that multiple versions of the framework can be installed and used at the same time. This means that there will be no conflict if multiple applications install different versions of the . NET framework on a single computer.

Is .NET Framework 4.8 backwards compatible?

NET Framework 4.8 is backwards compatible and is capable of running applications specifically targeted for . NET Framework 4.7.


Yes, there are risks of the sort you describe. The .NET 4.0 interface is unchanged, so if you target .NET 4.0, your program will compile and run on XP with .NET 4.0, but the .NET 4.5 implementation of .NET 4.0 contains bugfixes as well. If you rely on .NET Framework not being buggy, and the only available .NET Framework for XP is buggy, your program is going to experience those bugs. I've had this happen with Entity Framework, but there could be other bug fixes as well.


I asked this question on the WPF Forum and was given basiclly the same answer that @hvd gave.

http://social.msdn.microsoft.com/Forums/en/wpf/thread/c05a8c02-de67-47a9-b4ed-fd8b622a7e4a


The accepted answer is very relevant, but let me add an example of a situation where the 4.0 target compiled on a 4.5+ machine is something less useful than a 4.0 with fixed bugs.

If you have any ComReference in your projects, they will invoke tlbimp.exe from .NET 4.5 on the build machine. This may result in your software containing wrappers that reference, for example, a System.Reflection.MethodInfo.CreateDelegate(System.Type) method that only exists in .NET 4.5. You'll get a MissingMethodException on the WinXP machine.

This happened to me when working with the ComAdmin namespace, which are COM objects for access to the COM+ catalog, but I suspect that the problem may be wider.