bcgit / bc-csharp

BouncyCastle.NET Cryptography Library (Mirror)
https://www.bouncycastle.org/csharp
MIT License
1.61k stars 542 forks source link

Get conflicts with BouncyCastle.Crypto and BouncyCastle.Cryptography #455

Open robertoldaker opened 1 year ago

robertoldaker commented 1 year ago

I have just installed NuGet package "BouncyCastle.Cryptography" v2.2.1 into an existing .NET 6.0 ASP.NET project.

I can't get anything to compile since I get these type of errors when attempting to use the package.

The type 'Ed25519PublicKeyParameters' exists in both 'BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942' and 'BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938'

Any ideas what I may be doing wrong?

Thanks for your time,

Rob.

peterdettman commented 1 year ago

If you previously were using the Portable.BouncyCastle 1.9.0 NuGet package, that is replaced by BouncyCastle.Cryptography 2+, as it was always a re-packaging of our non-NuGet releases.

Alternatively I suppose you could have been using bccrypto-csharp-1.9.0 (not published to NuGet) and need to remove that dependency.

If neither of those is the case it might be happening indirectly through some other dependency, so you should check the transitive dependencies.

apeiris commented 9 months ago

I am too having same issue. I tried the following

apeiris commented 9 months ago

I had MimeKit installed, and that had reference to 2.0 .. removed it and now can compile

theredcameron commented 8 months ago

Has anyone found a resolution to this issue? I've just run into it.

Kvarkas commented 8 months ago

@peterdettman thanks, I uninstall 1.9 and install 2.2.1 and no erorrs any more.

e8-ZhixinYang commented 3 months ago

For my project I updated the following packages which solved the problem:

MySQL.Data 8.0.32
MySQL.Data 8.3.0

MailKit 2.15.0 BouncyCastle v1.8.3 MailKit 4.5 BouncyCastle v2.1.1

More related packages may be needed to solve this problem and ensure that BouncyCastle in all references remains the same version.