Sunday 7 June 2015


Share/Bookmark

Introduction

In this post we will see how to fix the exception due to mixed mode assembly while working with version 4.0 of runtime.

Background

I was working with a project which uses an older mixed mode assembly and I got an exception like mixed mode assembly is built against another version of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information. When I was able to fix this, I felt like this should be shared with all so that people can save their time.

Using the code

Mixed mode assembly is built against another version of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
If you are using .net version 4.0 there can be a chance of getting an error like this.
Additional information: 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.
This error happens because of the support for side-by-side runtimes, .NET 4.0 has changed the way that it binds to older mixed-mode assemblies. These assemblies are, for example, those that are compiled from C++\CLI. Currently available DirectX assemblies are mixed mode.

How did I fixed it

To fix this, You have to add the below settings to your App.config file under configuration tag.
<startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
    <requiredRuntime version="v4.0.20506"/>
</startup>


Categories:

0 comments:

Post a Comment

Dear reader, Your comment is always appreciated. I will reply to your queries as soon as possible.

1. Make sure to click on the Subscribe By Email link to be notified of follow up comments and replies. Or you can use Subscribe to: Post Comments (Atom) link.
2. Only English comments shall be approved.
3. Please make your comments self-explanatory. Comment in such a way that it explains the comment so that a counter question can be avoided and can be replied with proper answer on the first go.