Grape City Word 5 is not working with DocumentFormat.OpenXml 2.12.1

Posted by: RVojnic on 13 January 2023, 1:00 am EST

    • Post Options:
    • Link

    Posted 13 January 2023, 1:00 am EST


    We have recently upgraded our Development Environment to VS2022. We are using ActiveReports 16.2.1, ComponentOne Winforms 2022 and GrapeCity Word 5.

    If we use DocumentFormat.OpenXml 2.13.0 then GC Word 5 is working normally but Export to Excel from Active Reports is not working.

    If we use DocumentFormat.OpenXml 2.12.1 then GC Word 5 is not working but Export to Excel from Active Reports is working.

    Is there any solution where both can work in same application? (it worked for us when we previously used VS2015, AR10 and GC Word 5)

    Thanks, Robert

  • Posted 15 January 2023, 8:03 pm EST

    Hi Robert,

    This seems to be a common issue when using multiple products in an application that are referring to a dll but with different references. As you mentioned, this issue is occurring GC Word is referring to DocumentFormat.Open.XML version 2.13.0 and ActiveReports is referring to version 2.12.1. There are two ways you can try to resolve this issue:

    1. Use a Binding Redirect: For this, I would suggest you to refer to the following page of the Microsoft Documentation:

    Once you have set up the binding redirect you should be able to run the application with just a warning message which would be something like… “Warning: Found conflicts between different versions of the same dependent assembly” which can be ignored.

    1. Ideally I would suggest you to separate out conflicting products in a separate class libraries and refer to the class library in your main project this way you can remove the dependency issue for once and for all.

    This issues occurring for you even though both the products are from the same vendor i.e. GrapeCity because of parallel development of different products. As both the products updates are releases separately and on a different release model and are handled by separate teams this version conflict issue is sometimes inevitable.



  • Posted 17 January 2023, 12:11 am EST

    Hi Akshay

    Thanks for fast reply and suggestions.

    We tried Binding Redirect and this worked in Development Environment (inside Visual Studio) but when we deployed with ClickOnce to Production then it didn’t work.

    Eventually, we managed to solve this by overriding assembly resolve in code.

       Public Sub Main()
            AddHandler AppDomain.CurrentDomain.AssemblyResolve, AddressOf LoadDLLFromDirectory
    	End Sub	
    	Private Function LoadDLLFromDirectory(ByVal sender As Object, ByVal resolveArgs As System.ResolveEventArgs) As System.Reflection.Assembly
            Dim assemblyInfo As String = resolveArgs.Name
            Dim parts = assemblyInfo.Split(","c)
            Dim name As String = parts(0)
            Dim version As Version = Version.Parse(parts(1).Split("="c)(1))
            Dim fullName As String
            If name = "DocumentFormat.OpenXml" AndAlso version.Major = 2 AndAlso version.Minor = 13 Then
                fullName = New FileInfo("DocumentFormat.OpenXml.2.13.0\DocumentFormat.OpenXml.dll").FullName
                Return Nothing
            End If
            Return Assembly.LoadFile(fullName)
        End Function

    Thanks, Robert

  • Posted 17 January 2023, 3:07 pm EST

    Hi Robert,

    Glad to know you were able to resolve this issue!

    Thanks for sharing your solution with us , it will help others who may be experiencing a similar problem.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels