There has been some mention of using 4.0 libraries from a 2.0 app, using COM interop. My requirement is slightly different in that I do not want to expose types to my 2.0 app, but I have a Diagnostics.Process.Start(….) command in the 2.0 application which until now, started an external EXE elsewhere on the local drive that had also been compiled under 2.0 framework.
The external EXE has since been upgraded to using framework 4.0 and the Diagnostics.Process.Start no longer works, it seems for this reason.
I have tried to change the framework type under the .csproj files for the called EXE, recompiled and tried that but still no joy, not sure if now that it is under VS2010 it is irreversibly changed to no longer be compatible with 2.0. I wouldn’t have thought this would be an issue as like I said I am not calling types in a library, I am just using Diagnostics.Process.Start to start an external EXE, which surely it shouldn’t matter what version of framework it is compiled under?
Has anyone experienced anything like this?
If you’re launching a brand new process for your 4.0 executable, the framework version should be irrelevant. The two processes are separate with different environments. Can you specify the errors you’re getting when trying to launch the new 4.0 EXE?
If changing the target framework to 2.0 in the new projects fails as well, I’m guessing it’s something else. Maybe code access security, or general permissions?
Edit: If you’re not getting explicit error messages but just seeing your 4.0 EXE start and close without warning, try using tools like ProcMon or DbgView to catch unexpected messages, or add a call to System.Diagnostics.Debugger.Attach() in your 4.0 process’s main entrypoint, to enter debugging and see what’s going on.