Mixed mode assembly error

BlearyEye
BlearyEye used Ask the Experts™
on
I'm getting this runtime exception for C# 4.0 program App1 in VS 2010

Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

After poking around, I saw http://social.msdn.microsoft.com/Forums/en/windowsazure/thread/a8fd9cc6-f347-4c50-8dd5-147ecd686325, and made the indicated change to App.config:
     <startup useLegacyV2RuntimeActivationPolicy="true">

This works fine when App1 runs stand-alone ... except that I need to launch App1 as a process from App2. When I do that, the exception recurs.

App2's config file also includes the indicated change, and I supposed that App1, when launched by App2, would use App2's config file. But maybe not.

Ideas?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Both those links (which I'd seen) advise changing App.config to include
     <startup useLegacyV2RuntimeActivationPolicy="true">
I've done that already. Or am I missing something?

Stand-alone, all is well. The problem is when App1 is launched as a process by App2.
As it turns out ... I wasn't running App1 from where it was compiled (the .exe had been copied elsewhere first). Hence the config file was not in the folder and that's the reason for the error. I changed App2 so that it runs App1 from it's original location, and all is well.

Author

Commented:
I sorted it out myself, and the one comment did not contribute beyond what I'd already done.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial