Mixed mode assembly error when Com Addin linked with .net 4.5.1 loading another com object linked with .net 2.0 RRS feed

  • Question

  • All,

    Initially our addin was written in VS 2008 and linking .net 3.5. Everything was working fine until we converted into VS 2013.

    Now, the addin is linked with .Net 4.5.1 and creating another COM object linked with .net 2.0. We got this error.

    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.

    We searched and found out that we can use the following in the config file which resolved this issue.
     <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/></startup></configuration>

    Our customer installed the product and our addin loads fine but they have 3rd party VSTO addin which does not load. If we add

    <supportedRuntime version="v2.0"/> into x.exe.config file, then VSTO addin loads, our addin loads but creation of COM object (.net 2.0) fails with this error (fusion log).

    ERR: Rejecting IJW module built against v2.0.50727 because it could be loaded into another runtime in this process.

    Any help is greatly appreciated.



    Thursday, November 27, 2014 12:31 AM

All replies

  • Hello Vela,

    You need to rebuild the mixed mode assembly against the .net framework 4 CLR.

    Thursday, November 27, 2014 11:50 AM
  • Thanks Eugene but unfortunately we don't have control over 3rd party addins and we can't rebuild.

    1. TestAddin4.5 - Our Addin linking .Net 4.5.1 framework

    2. 3rdPartyAddin2.0 - 3rd party addin used by TestAddin4.5. We cant reach this company.

    3. VSTOAddin - 3rd Party addin which we can't control again. We requested them to upgrade to .net 4.5.

    Any other suggestions.

    Thursday, November 27, 2014 4:02 PM
  • There is a chance that other add-ins can use .net 2.0 CLR. I'd suggest rebuilding the mixed-mode assembly instead.
    Thursday, November 27, 2014 5:50 PM