Skip to content

Type conflict: 'PublicKeyFactory' exists in both BouncyCastle and iTextSharp" #625

@GentiSe

Description

@GentiSe

A type conflict has been encountered in the project due to the PublicKeyFactory type being 'maybe' defined in both of the following assemblies:

  • BouncyCastle.Crypto, Version=1.8.9.0, Culture=neutral, PublicKeyToken=0e99375e54769942
  • itextsharp, Version=5.4.3.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca

⚠️ Note: I have not directly installed or referenced itextsharp in the project. Despite that, the build still reports a conflict involving it, which suggests it may be coming in transitively through another dependency.

This results in the following error during build or runtime:

The type 'PublicKeyFactory' exists in both 'BouncyCastle.Crypto, Version=1.8.9.0, Culture=neutral, PublicKeyToken=0e99375e54769942' and 'itextsharp, Version=5.4.3.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca'

Workarounds Attempted that worked.

  • Package aliasing: I applied an alias to BouncyCastle.Crypto

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions