none
Could not load file or assembly - OpenXML RRS feed

  • Question

  • I have a web site that uses Telerik, which uses OpenXML to generate Excel documents. The Web project and the business projects both reference OpenXML version 2.0.5022.0.  If I open the solution in Visual Studio and view the site using IIS Express, the Excel documents are generated correctly. However, if I build the solution and push it to another web server configured with IIS, I get the 'Could not load file or assembly' page when I attempt to have the site generate an Excel document. The confusing part is that the error indicates that the application is looking for version 2.5.5631.0.  Which is installed on the machines, but I am not trying to use yet.  I did update references to the new versions recently, but that caused Telerik to break.  Now that I've removed those references from the projects and added the old reference back, it seems that the web server keeps trying to look for the newer version-even though the projects all reference version 2.0.5022.0 specifically.  I've attempted copy local and added the DLL to the web servers GAC.  The 2.0.5022.0 version copies correctly and the key is correct, but for some reason the application keeps looking for the new version regardless of what I do.  Does anyone know how to force the application to use the previous version?

    The error:

    Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)


    KJ Dietrich Web Developer

    Wednesday, June 17, 2015 4:09 PM

Answers

  • Not entirely sure why I couldn't roll back the references to the 2.5.x version of Open XML, but I redeployed everything with 2.5.x references, replacing that assembly in my bin folder as well.  Then all of the areas that use Open XML worked, but the areas that use Telerik that uses Open XML did not work.  I then installed the 2.0 version of the OpenXML SDK on the web server and restarted IIS--This fixed the problem.  I attempted to use a binding redirect to point all references of any version to the new version, but that didn't work.  It seems that the Telerik assemblies reference only version 2.0.

    -KJ


    KJ Dietrich Web Developer

    • Marked as answer by KJ Dietrich Tuesday, June 23, 2015 9:18 PM
    Tuesday, June 23, 2015 9:18 PM

All replies

  • Hi KJ Dietrich,

    >>it seems that the web server keeps trying to look for the newer version-even though the projects all reference version 2.0.5022.0 specifically. <<

    As far as I know, we can redirect the assembly via moidfing the config file at user level and machine level. Please check that specifying assembly binding in configuration files correctly.        

    You can get more detail about this topic from link below:
    Redirecting Assembly Versions

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, June 18, 2015 7:10 AM
    Moderator
  • Fei,

    Thanks for the link.  At first glance, it may help.  I've spent all morning verifying that all references point to the 2.0 version of OpenXML, but when the just built application is on the beta web server (even though the web.config references the 2.0 version) it still throws an error looking for the 2.5 version.  I'm having trouble finding where the application could still be referencing the 2.5 version.  Thanks.

    -KJ


    KJ Dietrich Web Developer

    Monday, June 22, 2015 3:01 PM
  • Some additional info:

    I enabled Fusion logging and the following was produced:

    LOG: This bind starts in default load context.
    LOG: Using application configuration file: D:\inetpub\wwwroot\Web\web.config
    LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
    LOG: Post-policy reference: DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

    LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/web/858e8f39/9fa58e55/DocumentFormat.OpenXml.DLL.
    LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/web/858e8f39/9fa58e55/DocumentFormat.OpenXml/DocumentFormat.OpenXml.DLL.
    LOG: Attempting download of new URL file:///D:/inetpub/wwwroot/Web/bin/DocumentFormat.OpenXml.DLL.
    WRN: Comparing the assembly name resulted in the mismatch: Minor Version
    ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

    The reference in web.config is for version 2.0.5022.0.  But for some reason after processing aspnet.config and machine.config, IIS starts looking for v 2.5.5631.0 and it calls it the "Post-policy reference".  The version of the dll in the bin folder is 2.0.5022.0, but since it is looking for 2.5.5631.0 for some reason, it fails. 


    KJ Dietrich Web Developer

    Monday, June 22, 2015 7:09 PM
  • Hi KJ Dietrich,

    Based on my understanding, the machine.config should be first loaded. Have you tried to redirect Assembly versions in web.config?

    If the issue still exits after you haved added it, it seems the issue is more relative to the configuration can't work correctly.

    I suggest that you reopen a new thread in Configuration and Deployment forum to get more effective response.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, June 23, 2015 3:42 AM
    Moderator
  • Not entirely sure why I couldn't roll back the references to the 2.5.x version of Open XML, but I redeployed everything with 2.5.x references, replacing that assembly in my bin folder as well.  Then all of the areas that use Open XML worked, but the areas that use Telerik that uses Open XML did not work.  I then installed the 2.0 version of the OpenXML SDK on the web server and restarted IIS--This fixed the problem.  I attempted to use a binding redirect to point all references of any version to the new version, but that didn't work.  It seems that the Telerik assemblies reference only version 2.0.

    -KJ


    KJ Dietrich Web Developer

    • Marked as answer by KJ Dietrich Tuesday, June 23, 2015 9:18 PM
    Tuesday, June 23, 2015 9:18 PM