Could not load file or assembly 'BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies

4

I am trying to integrate the Walmart .NET SDK into a .NET 4.61 MVC 5 app. Using NuGet, I added a reference to BouncyCastle.Crypto 1.8.1.0.

The SDK uses .NET Standard 1.3 and it references BouncyCastle.Crypto 1.8.1.3:

https://github.com/walmartlabs/partnerapi_sdk_dotnet

1.8.1.3 is not available for .NET 4.61.

{"Could not load file or assembly 'BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=null"}

=== Pre-bind state information ===
LOG: DisplayName = BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///C:/Users/example_user/Source/Workspaces/CCC/Test/example_app.Test.DataAccessUnitTest/bin/Debug
LOG: Initial PrivatePath = NULL
Calling assembly : Walmart.Sdk.Base, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\example_user\Source\Workspaces\CCC\Test\example_app.Test.DataAccessUnitTest\bin\Debug\example_app.Test.DataAccessUnitTest.dll.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/example_user/Source/Workspaces/CCC/Test/example_app.Test.DataAccessUnitTest/bin/Debug/BouncyCastle.Crypto.DLL.
LOG: Attempting download of new URL file:///C:/Users/example_user/Source/Workspaces/CCC/Test/example_app.Test.DataAccessUnitTest/bin/Debug/BouncyCastle.Crypto/BouncyCastle.Crypto.DLL.
LOG: Attempting download of new URL file:///C:/Users/example_user/Source/Workspaces/CCC/Test/example_app.Test.DataAccessUnitTest/bin/Debug/BouncyCastle.Crypto.EXE.
LOG: Attempting download of new URL file:///C:/Users/example_user/Source/Workspaces/CCC/Test/example_app.Test.DataAccessUnitTest/bin/Debug/BouncyCastle.Crypto/BouncyCastle.Crypto.EXE.
c#
asked on Stack Overflow Jun 4, 2018 by Joseph Anderson • edited Jun 4, 2018 by shamanth Gowdra Shankaramurthy

2 Answers

2

I had to use the .NET 46 solution. The Walmart.Sdk.Base assembly is built on .NET Standard 1.3. I needed to reference the one for .NET 4.6.

answered on Stack Overflow Jun 4, 2018 by Joseph Anderson
1

My issue was a project building concurrently in the same solution which was referencing an older library through NuGet and occasionally it was overwriting the most recent one. Upgrading the NuGet package in this project fixed the issue.

answered on Stack Overflow Oct 23, 2020 by ceztko

User contributions licensed under CC BY-SA 3.0