Skip to content

PdfSharp conflict exception #4840

Closed
Closed

Description

@itg-assistant

Vincent Pfammatter asked 2025-08-26 15:36:11 UTC

Hello,

I create a new program with the following actions:

  • Create a new WiseJ application (Wisej 3 Web Application .NET Framework 4.8)

  • Upgrade the Wisej 3 NuGet package to 3.5.22.

  • Install the NuGet package PDFsharp 6.2.1.

  • Add the line "PdfDocument outputPDFDocument = new PdfDocument();" in the function Program.Main().

The solution compiles well but the creation of a instance of PdfDocument generates the following exception:

Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Te same process with a Console App (.NET Framework 4.8) project generates no exception.

What can I do to avoid this exception?

Best regards

Edit: Add solution files example zip.

Activity

  1. itg-assistant commented on Jun 16, 2026

    @itg-assistant
    Author

    Julie (ITG) answered 2025-08-27 15:03:28 UTC

    It's a dependency issue, not a Wisej issue.

    The reason why it works in a console app and not in a Wisej app is because of this line here 

    
    

    What this line does is that it essentially imports what is called a metapackage implicitly, named Microsoft.AspNetCore.App , and Microsoft.Extensions.Logging.Abstractions is part of it.

    To fix it, add this to web.config:

    <runtime>
    		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    			<dependentAssembly>
    				<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
    				<bindingRedirect oldVersion="1.0.0.0-9.9.9.9" newVersion="8.0.0.2"/>
    			</dependentAssembly>
    			<dependentAssembly>
    				<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    				<bindingRedirect oldVersion="1.0.0.0-9.9.9.9" newVersion="6.0.0.0"/>
    			</dependentAssembly>
    		</assemblyBinding>
    	</runtime>
    
  2. added
    BugSomething is broken or behaving unexpectedly.
    on Jun 16, 2026
  3. itg-assistant commented on Jun 16, 2026

    @itg-assistant
    Author

    Vincent Pfammatter answered 2025-08-28 06:42:50 UTC

    Hello Julie,
    Yes, its works.. I didn’t know that the Microsoft.AspNetCore.App contains the Microsoft.Extensions.Logging.Abstractions.
    Thank you.
    Have a nice day

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething is broken or behaving unexpectedly.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions