Unable to load assembly System.ComponentModel.Primitives, Version=4.2.2.0

Posted by: bagattini on 23 November 2023, 12:10 am EST

    • Post Options:
    • Link

    Posted 23 November 2023, 12:10 am EST

    I have an Active Reports 17 project that I’m now moving to .NET 6, from .NET Framework 4.8; after the upgrade, this error arose and I’m not able to compile it anymore:

    
    The file or assembly 'System.ComponentModel.Primitives, Version=4.2.2.0, Culture=neutral, 
    PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies could not be loaded. Reference assemblies do 
    not need to be loaded for execution. You can only load them in the context of the reflection-only loader. 
    (Exception from HRESULT: 0x80131058)'
    

    Note that this is a translation of the message I’m getting, as the original is localized in my language.

    Some of the referenced packages are also marked as deprecated and some others appear quite old. Should I follow a different approach instead of migration?

    Also worth to mention that the amount of references needed to have simply AR, viewer and PDF export is pretty unmanageable, I count over 70 of them. Maybe I’m missing some piece here too.

    Any help would be greatly appreciated.

    Matteo

  • Posted 27 November 2023, 5:29 pm EST

    Hi Matteo,

    Try adding the following entry into the .csproj file:

    <PropertyGroup>
      <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
      <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
    </PropertyGroup>
    

    You can also refer to the following links for more information:

    >> Also worth to mention that the amount of references needed to have simply AR, viewer and PDF export is pretty unmanageable, I count over 70 of them. Maybe I’m missing some piece here too.

    You just need to add the following packages to add ActiveReports, Viewer and PDF export capabilities into your application:

    • GrapeCity.ActiveReports
    • GrapeCity.ActiveReports.Viewer.Win
    • GrapeCity.ActiveReports.Export.Pdf

    All other required dlls will be added automatically while installing the above 3 packages. You may also refer to the following attached sample for a demo application implementing PDF export with both Page and Section Reports in .NET 6.

    If the issue still persists, please provide us with a sample stripped-down application replicating the same so that we can investigate into it further and assist you better. Also, share the exact screenshot of the error that you are encountering.

    Attachment:SamplePDFExport.zip

Need extra support?

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

Learn More

Forum Channels