Suppose there is a code which use 2 third party dll's. one is NLog.Extensions.Logging
version 1.6.1
for logging other is lets say CryptoProvider.dll
written in .net standard 2.0. NLog.Extensions.Logging
internally using Microsoft.Extensions.Logging
version 2.1.0
while CryptoProvider.dll
internally use Microsoft.Extensions.Logging
version 2.0.0
. So now there is a issue regarding version mismatch. So how should I design to CryptoProvider dll. so that resolve the issue .
Asked
Active
Viewed 416 times
1

ProgrammingLlama
- 36,677
- 7
- 67
- 86

jiten
- 5,128
- 4
- 44
- 73
1 Answers
-2
there is a possibility to redirect assembly binding using the app.config
file assemblyBinding\bindingRedirect like below
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
This can redirect all assembly Newtonsoft.Json version references to be resolved to 12.0.0.0
.
Usually VS adds those redirects automatically if installed packages has different dependency versions.
But it works only if there are no breaking changes between the redirected version.
Not sure that it will work to mix between .net framewok and .net core assemblies.
Assembly binding redirect for .net core can be done using deps.json

oleksa
- 3,688
- 1
- 29
- 54
-
2bindingRedirect is only work for .net framework. If I am not wrong. – jiten Feb 03 '20 at 10:07
-
@vikky added link for .net core assembly binding redirection – oleksa Feb 03 '20 at 10:14