Binding redirect not working correctly

binding dapper

Question

<runtime>
<dependentAssembly xmlns="urn:schemas-microsoft-com:asm.v1">
  <assemblyIdentity name="Dapper.SqlMapper" publicKeyToken="032d34d3e998f237"  culture="neutral"/>
  <bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.38.0.0"/>
</dependentAssembly>

I am trying to learn dapper and I am having to use a binding redirect but am having trouble getting it to work. This is what I have so far. I am getting this error, An exception of type 'System.TypeLoadException' occurred in Dapper.dll but was not handled in user code

Additional information: Could not load type 'Dapper.SqlMapper' from assembly 'Dapper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

Expert Answer

publicKeyToken="032d34d3e998f237"

vs

PublicKeyToken=null

You can't redirect a non-strong-named assembly to a strong-named one.


Popular Answer

Additional information: Could not load type 'Dapper.SqlMapper' from assembly 'Dapper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

I was getting this exact error and couldn't get past it. Then I got rid of the nuget package and instead copied the SqlMapper.cs into my project and the problem went away.



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why