Could not load file or assembly 'System.IO.Pipelines'

1

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.
.net
asked on Stack Overflow Jan 2, 2019 by fizch • edited Jan 2, 2019 by fizch

1 Answer

1

Use Microsoft's "Assembly binding log viewer" (Fuslogvw.exe), it tells you what binding requests are being processed and which fail.

https://docs.microsoft.com/en-us/dotnet/framework/tools/fuslogvw-exe-assembly-binding-log-viewer

If fuslogvw.exe is not installed on the production environment then check this: using FUSLOGVW.EXE on a machine with no Visual Studio installed

answered on Stack Overflow Jan 2, 2019 by Siraf

User contributions licensed under CC BY-SA 3.0