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.
So I have a legacy .NET 2 GUI application. Redoing this application is out of the question.
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.
What you need to do here is factor out the shared utilities into DLLs that target the 2.0 framework. These DLLs can then be used in both a 2.0 and 4.0 .Net process. .Net places a very high bar on backwards compatibility and in the vast majority of scenarios a 2.0 DLL can be run without changes in 4.0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With