I'm looking for a way to avoid the need to add dependentAssembly within the app.config file. The actual related project is a library that should be added to a global process. It's not possible to modify the app.config of the global process (.net Framework).
Example of the issue:
1.When adding nuget package Application Insights to my console app => It would not add a 'dependentAssembly' section within my app.config. The Application insights lib works fine when doing a test as well.
2.When adding the nuget package Serilog & Serilog Application Insights, it adds a new 'dependentAssembly' section within the app.config file. This one works fine as well.
However, when removing the 'dependentAssembly' section that is related to application insights, the following error occurs :
Could not load file or assembly 'Microsoft.ApplicationInsights, Version=2.12.0.21496, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
==> This isn't the only serilog plugin that has this kind of issue. The configuration builder includes also 'dependentAssembly' sections within the app.config.
The appconfig example can be found here :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.ApplicationInsights" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.16.0.18277" newVersion="2.16.0.18277" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
The error msg informs that it's looking for Version=2.12.0.21496 while i'm using version 2.16 of application insights. This can be fixed by installing v2.12.., but i don't want to rely on this as it can be different for every server.
Is there another way to define the version nr?
Thank you in advance!
Kind regards, Kurt
User contributions licensed under CC BY-SA 3.0