Conflict for System.Runtime.CompilerServices.Unsafe between Npgsql and System.Threading.Tasks.Extensions

0

I have downloaded EntityFramework6.Npgsql 6.4.0 nuget. As a dependent, Npgsql 4.1.2 was installed along with the nuget.

While running the code, observed following error:

=== Pre-bind state information === LOG: DisplayName = **System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0**, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a  (Fully-specified) LOG: Appbase = file:///C:/Program Files (x86)/Agilent Technologies/Sample Scheduler for OpenLab/Bin/ LOG: Initial PrivatePath = NULL Calling assembly : Npgsql, Version=4.1.2.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7.
=== LOG: This bind starts in default load context. LOG: No application configuration file found. 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.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a LOG: Attempting download of new URL file:///C:/Program Files (x86)/X/Y/Bin/System.Runtime.CompilerServices.Unsafe.DLL. WRN: Comparing the assembly name resulted in the mismatch: Revision Number ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

To fix this, I have copied the System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0 into my Bin directory.

After this, I got the following error:

=== Pre-bind state information === LOG: DisplayName = **System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1**, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a  (Fully-specified) LOG: Appbase = file:///C:/Program Files (x86)/Agilent Technologies/Sample Scheduler for OpenLab/Bin/ LOG: Initial PrivatePath = NULL Calling assembly : System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51.
=== LOG: This bind starts in default load context. LOG: No application configuration file found. 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.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a LOG: Attempting download of new URL file:///C:/Program Files (x86)/X/Y/Bin/System.Runtime.CompilerServices.Unsafe.DLL. WRN: Comparing the assembly name resulted in the mismatch: Revision Number ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Due to this incompatible dependency on the same library with different versions, I could not go forward.

Please help, how to fix this.

c#
postgresql
entity-framework-6
npgsql
asked on Stack Overflow Dec 25, 2019 by Kandarpa

1 Answer

0

As per @ShayRojansky inputs. I added binding redirects in my app.config file.

My application have an Entity library which will do all the DB operations. I added Nugets for this Entity library project in my VS.

After the build, these binding redirects not added to my application app config. I manually updated the EXE.app.config and this issue is resolved.

answered on Stack Overflow Dec 28, 2019 by Kandarpa

User contributions licensed under CC BY-SA 3.0