bc-csharp icon indicating copy to clipboard operation
bc-csharp copied to clipboard

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

Open GentiSe opened this issue 6 months ago • 1 comments

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

GentiSe avatar May 28 '25 14:05 GentiSe