Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why cant a .net 4.0 project reference a 4.5 assembly?

Tags:

c#

.net-4.5

I am working on a project targeting .NET 4.0 and now I need to reference a third party dll which was built targeting .NET 4.5. It seems that visual studio does not accept that? Why? VS shows me that dll name does not exist in current context.

like image 437
dev hedgehog Avatar asked Nov 17 '14 12:11

dev hedgehog


1 Answers

Because you are referencing to the higher version. Microsoft can be backcompatible, but not "future compatible". You need to convert your entire project to higher vesion, in order to be able to use that binary.

Don't know what tecnology you are talking about exactly, but if that asp.net, consider that in vNext you are able to deploy your own version of the cloud clr on the server. So you may have 2 versions of your app, one targetting 4.5, other 4.0.

Introducing vNext. Repeat, if this concerns you.

like image 144
Tigran Avatar answered Oct 21 '22 10:10

Tigran