{"id":560,"date":"2013-07-09T11:28:18","date_gmt":"2013-07-09T11:28:18","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=560"},"modified":"2013-07-09T11:31:16","modified_gmt":"2013-07-09T11:31:16","slug":"mixed-mode-assemblies-exception","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/mixed-mode-assemblies-exception\/","title":{"rendered":"Mixed mode assemblies exception"},"content":{"rendered":"<p>Occasionally I get caught out by an assembly in .NET having been compiled in, say, .NET 2.0 and now wanting to use it in a newer version of .NET, for example .NET 4.0.<\/p>\n<p>You&#8217;ll probably see an error like the following <\/p>\n<p><em>System.IO.FileLoadException: Mixed mode assembly is built against version &#8216;v2.0.50727&#8217; of the runtime and cannot be loaded in the 4.0<\/em><\/p>\n<p>Obviously if I could recompile the offending 2.0 assembly I would, but this occasionally happens with libraries such as those imported into an application via NuGet and I really don&#8217;t need the headache of finding the original source and rebuilding. <\/p>\n<p>So to fix this simple add the following to the App.Config in the configurations section<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;startup useLegacyV2RuntimeActivationPolicy=&quot;true&quot;&gt;\r\n   &lt;supportedRuntime version=&quot;v4.0&quot;\/&gt;\r\n&lt;\/startup&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Occasionally I get caught out by an assembly in .NET having been compiled in, say, .NET 2.0 and now wanting to use it in a newer version of .NET, for example .NET 4.0. You&#8217;ll probably see an error like the following System.IO.FileLoadException: Mixed mode assembly is built against version &#8216;v2.0.50727&#8217; of the runtime and cannot [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[49],"tags":[],"class_list":["post-560","post","type-post","status-publish","format-standard","hentry","category-net"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=560"}],"version-history":[{"count":3,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/560\/revisions"}],"predecessor-version":[{"id":562,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/560\/revisions\/562"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}