gpt4 book ai didi

c# - NuGet 更新后的 FileLoadException

转载 作者:太空狗 更新时间:2023-10-29 23:22:13 31 4
gpt4 key购买 nike

在更新所有 NuGet 包后,我的一个应用程序在启动时开始崩溃并出现 FileLoadException:

Could not load file or assembly 'Microsoft.Practices.ServiceLocation, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.

这是在将 ServiceLocation 升级到版本 1.3.0.0 之后,我仔细检查了所有程序集以确保它们使用的是该版本。然后我运行 Fuslogvw 来诊断仍然引用旧版本的程序集:

LOG: DisplayName = Microsoft.Practices.ServiceLocation, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///C:/Users/Charlie/AppData/Local/Programs/MyClient/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MyClient.exe
Calling assembly : Microsoft.Practices.Prism.UnityExtensions, Version=5.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===

因此,UnityExtensions(另一个 NuGet 包)仍然引用旧版本。但这应该没问题,因为我已经将 bindingRedirect 添加到我的 app.config 文件中:

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Practices.ServiceLocation" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.3.0.0" />
</dependentAssembly>
</assemblyBinding>

但这似乎没有什么区别。我的应用程序以 .NET Framework 4.5.1 为目标,我已经尝试打开和关闭 AutoGenerateBindingRedirects。换句话说,我几乎什么都试过了。这是怎么回事?

最佳答案

解决此问题所需要做的就是更新所有项目中的所有 PRISM 和 Unity 相关包。不需要编辑绑定(bind)重定向。

查看详情 codeplex

关于c# - NuGet 更新后的 FileLoadException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26475938/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com