1
votes

I converted a project from VS2008 to VS2010, and now I'm getting at runtime:

Unhandled Exception: System.IO.FileLoadException: 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.

Googling the error, it seems that you can force compatibility with old assemblies with useLegacyV2RuntimeActivationPolicy, but that's not what I want - I want to build the offending project against the 4.0 runtime. Apparently the visual studio project conversion wizard didn't do this?

It's a managed C++ project. How do I change the targeted .NET version?

2
This is pretty odd, it should always target 4.0 after converting the project. Open the .vcxproj file with notepad and look for <TargetFrameVersion>. Delete it if it is there. - Hans Passant
all <TargetFrameVersion>s removed from *proj; still no dice - jrr

2 Answers

0
votes

I think that the message is indicating that the project references or includes are .NET Framework V2 instead of V4.

  1. Check that the project is targeted .NET Framework version 4 in the project properties.

  2. Replace the .NET Framework V2 assemblies referenced in the project with versions targeted for .NET Framework V4.

Hope this solves you problem.

0
votes

Okay, figured it out, dumb mistake: I had an old version of the .DLL sitting in the same directory as the .exe. Changed build configuration to copy the current one (v4.0) there. All better.