Possible Duplicate:
Can I use a .NET 4.0 library in a .NET 2.0 application?
So I have a legacy .NET 2 GUI application. Redoing this application is out of the question.
I also have a console .NET 4 application that does FTP and other work. It uses LINQ.
Now, I am abstracting the console application (which is .NET 4) into reusable DLLs, etc.
What I want to be able to do is have the GUI app (.NET 2) be able to include those DLL’s and call them. Then just get return values from it.
I think worse case I could just keep it a console app and have the .NET two execute it externally. But I would like the GUI app to be able to execute methods from the .NET 4 piece.
The clients that will be running this app all have .NET 4.
Thanks.
Is changing the framework target to .NET 4 and rebuilding also out of the question? That would probably be the simplest approach – then you’d know you wouldn’t end up in strange situations where you were actually running on CLR v2 and trying to load assemblies which required CLR v4 (and .NET framework v4 assemblies).
In most cases you should simply be able to retarget – while backward compatibility isn’t 100%, it’s pretty good.