I have a service that references few other libraries in the same solution and some libraries via NuGet packages.
I have a library Microsoft.ApplicationInsights.Log4NetAppender
and another one Microsoft.ApplicationInsights.ServiceFabricNative
which seem to disagree on the version of Microsoft.ApplicationInsights
.
So in my app.config I have the following:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.ApplicationInsights" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.15.0.44797" newVersion="2.15.0.44797" />
</dependentAssembly>
</assemblyBinding>
But when I go and see what the service.exe.config file contains after I compile I found:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.ApplicationInsights" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.12.0.21496" newVersion="2.12.0.21496" />
</dependentAssembly>
</assemblyBinding>
which is strange as no other library in the solution has a reference to that version.
And this causes an issue where an exception is thrown and it says that cannot load version 2.12.0.21496 of such library.
What am I missing? Whey the arbitrary numbers despite all my attempts?
Note: these are services referencing other libraries in a service fabric solution