我有一项服务,它通过 NuGet 包引用同一解决方案中的少数其他库和一些库。
我有一个库Microsoft.ApplicationInsights.Log4NetAppender
和另一个Microsoft.ApplicationInsights.ServiceFabricNative
似乎不同意Microsoft.ApplicationInsights
.
所以在我的 app.config 我有以下内容:
<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>
但是当我编译后查看 service.exe.config 文件包含的内容时,我发现:
<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>
这很奇怪,因为解决方案中没有其他库引用该版本。
这会导致引发异常并表示无法加载此类库的版本 2.12.0.21496 的问题。
我错过了什么?尽管我做了所有尝试,但还是任意数字?
注意:这些是在服务结构解决方案中引用其他库的服务