Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

I want to know please, If there is any solution that allow me to Use a DLL that require .Net4.0 or higher to be used with application that i have to made with .Net2.0 .

Any solution Please.
thank's
Posted
Updated 28-Jan-16 23:38pm
v2

No. The problem is that .NET apps specify - and check - the .NET version they need at load time, and this means that if you referenced a later version assembly it wouldn't have the right framework available when you tried to run it.
That's why VS complains when you try to add a later assembly as a reference.
Your only option is to raise the level of your main app to equal or above that of the DLL, or recompile the DLL to use a lower .NET version.
 
Share this answer
 
Comments
BillWoodruff 29-Jan-16 6:13am    
Griff, see what you think of this:

https://code.msdn.microsoft.com/windowsdesktop/Using-a-NET-4-Based-DLL-bb141db3

Looks like nightmare code to me.
OriginalGriff 29-Jan-16 6:22am    
Brrr...hacky or what? Just because it physically can be done doesn't mean it should! :laugh:
Not what I'd want to see in any production code. and a lot more work to implement and maintain than upping the Assembly version in the first place!
Answer is NO.
.Net frameworks (v2.0 or higher) are not forward compatible.

surprisingly, I got following link. which you can look into it
How To Use a .NET 4 Based DLL From .NET 2 Based Application? | Arik Poznanski's Blog[^]
 
Share this answer
 
Comments
Richard Deeming 29-Jan-16 11:31am    
That's the same article that Bill linked to in the comments to solution 1.
koolprasad2003 29-Jan-16 22:55pm    
ohh... yes. I missed that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900