I recently upgraded my console app project from framework 4.5.2 to 4.6.1. Everything works correctly in the development environment, but when I deploy the full bin folder to my production environment, I get the following error.
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'System.IO.Pipelines, Version=4.6.26919.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I have setup the binding redirect in production as follows:
<dependentAssembly>
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.6.26919.2" />
</dependentAssembly>
The file definitely exists in the bin folder and my production environment has framework 4.6.2 installed. Any ideas?
Updated with output from FUSLOGVW:
*** Assembly Binder Log Entry (1/2/2019 @ 11:47:22 AM) ***
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable {{REDACTED}}\NotificationService.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = System.IO.Pipelines, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
(Fully-specified)
LOG: Appbase = file:///{{REDACTED}}/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NotificationService.exe
Calling assembly : Pipelines.Sockets.Unofficial, Version=1.0.0.0, Culture=neutral, PublicKeyToken=42ea0a778e13fbe2.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: {{REDACTED}}\NotificationService.exe.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.IO.Pipelines, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///{{REDACTED}}/System.IO.Pipelines.DLL.
LOG: Assembly download was successful. Attempting setup of file: {{REDACTED}}\System.IO.Pipelines.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: System.IO.Pipelines, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
ERR: The assembly reference did not match the assembly definition found.
ERR: Run-from-source setup phase failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.