在.NET 4.0环境下用MagickNet.DLL做缩略图 报错"混合模式程序集是针对"V2.0.50727"版的运行时生成,在没有被指其他信息的情况下,无法在4.0运行时中加载该程序集"看了网上改app.config 的方法
但是我的app.config原内容和教程上要改的完全一样 不需要修改<?xml version ="1.0"?>
<configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <requiredRuntime safemode="true" imageVersion="v4.0.30319" version="v4.0.30319"/>
        <supportedRuntime version="v4.0" sku="client" />
    </startup>
</configuration>
求高人赐教啊
或者给个4.0环境下编译的MagickNet.DLL
不胜感激!

解决方案 »

  1.   

    我今天也遇到一个问题:
    我用Winform里调用一个C++写的dll,三个函数签名为:
            [DllImport("User32.dll")]
            public static extern int MessageBox(int h, string m, string c, int type);
            [DllImport("DLL.dll")]
            public static extern void MyBox();
            [DllImport("DLL1.dll")]
            public static extern void MyBox(int iNum);
    如果在.net3.5下,一切都正常.
    如果以.net4.0来运行,前两个方法没问题,最后一个死法报错:
    'MyBox' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.这几个方法是专门用来测试的,我是要在WPF(.net4.0)下调用C++写的函数.
    现在我有个想法就是在WPF(.net4.0)调用.net3.5下的方法abc(),再用abc()调用C++的函数,
    在此解决这个问题,你这个问题如果解决了,我的问题也可能多一个方案了。
      

  2.   

    如果以.net4.0来运行,前两个方法没问题,最后一个死活报错
      

  3.   

    我也遇到了这个问题。WPF调用C++的,麻烦解决了告诉我一下啊
      

  4.   

      <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0" />
      </startup>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="XXX" publicKeyToken="32ab4ba45e0a69a1" culture="neutral"/>
            <codeBase version="v2.0.50727" href="XXX.dll"/>
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    我的解决了,这样可以
      

  5.   

    我想用MagickNet.DLL 将PDF图片转化成其他格式的图片进行处理,有办法吗?
    请赐教