Skip to content

.NET compatibility between .NET 4 and 4.5 with referenced assemblies

There aren't many breaking changes between .NET 4 and .NET 4.5, but after reading http://blogs.msdn.com/b/webdev/archive/2012/11/19/all-about-httpruntime-targetframework.aspx I was interested how the compatibility layer would react if the main assembly is compiled for .NET 4.5 and a referenced assembly for .NET 4.

I tested it with the List<T>.ForEach method in the blog post, and it acted like I thought it would: The main assembly specifies the compatibility level. If the main assembly is compiled for .NET 4.5, all referenced assemblies are also executed using .NET 4.5, even if they are compiled for .NET 4.