Using old DLLs in C# .Net 4.0
this is actually a follow up to a question I asked yesterday about problems with using older DLLs in Visual C# 2010. I have added the configuration file and the DLL runs well. The issue I'm having is that I would like to avoid having my entire project run in legacy mode.
I have gone around this by creating a new console project with command line access to all the functions I need from the DLL and read the output in my main project. This way it acts as a separate component, and I don't have to worry about legacy mode affecting anything in my main project.
The problem is that I feel as though this will really slow down my application in the long run, and since what I am developing needs to be fast, I was wondering if there is another approach to doing this. As I mentioned in the previous question, I cannot rebuild the DLL in 4.0.
Sounds like you really misunderstand what that setting means. It most certainly doesn't mean that your project "runs in legacy mode", it is the exact opposite. The .NET 4.0 CLR version will be used by your old DLL with that setting. Instead of the new policy available in 4.0 that allows it to run with an old version of the CLR. Also known as in-process side-by-side feature. The new policy however doesn't support mixed-mode assemblies, that's why it complained.
You really don't want run it in a separate .exe with command line redirection, that's horrible. It is not only slow, it will make your app unreliable when the 'host' process dies on an unhandled exception but your main app doesn't notice. Very hard to diagnose.