无法加载文件或程序集Microsoft.IdentityModel.令牌.dll/Microsoft.IdentityM



这简直要了我的命。我已经清除了有问题的程序包,卸载了程序包,重新安装,尝试添加<PackageReference>,尝试使用<targetFrameworks>针对多个框架。。。所有这些,我在运行时仍然会遇到这个错误。

我有一个。NET Standard 2.0库,该库正由。NET Framework 4.8项目。该框架项目没有引用任何IdentityModel。令牌/Jwt对象。我已经手动将程序集从中的包位置复制到有问题项目的bin文件夹中,它似乎没有改变结果。

融合日志

*** Assembly Binder Log Entry  (1/7/2021 @ 11:38:12 AM) ***
The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.
Assembly manager loaded from:  C:WindowsMicrosoft.NETFrameworkv4.0.30319clr.dll
Running under executable  REDACTEDREDACTEDbinDebugREDACTED.exe
--- A detailed error log follows. 
=== Pre-bind state information ===
LOG: DisplayName = System.IdentityModel.Tokens.Jwt, Version=6.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file: REDACTED
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = REDACTED.exe
Calling assembly : REDACTED.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: REDACTEDREDACTEDbinDebugREDACTED.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:WindowsMicrosoft.NETFrameworkv4.0.30319configmachine.config.
LOG: Post-policy reference: System.IdentityModel.Tokens.Jwt, Version=6.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///REDACTED/REDACTED/bin/Debug/System.IdentityModel.Tokens.Jwt.DLL.
LOG: Assembly download was successful. Attempting setup of file: REDACTEDREDACTEDbinDebugSystem.IdentityModel.Tokens.Jwt.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: System.IdentityModel.Tokens.Jwt, Version=6.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Binding succeeds. Returns assembly from REDACTEDREDACTEDbinDebugSystem.IdentityModel.Tokens.Jwt.dll.
LOG: Assembly is loaded in default load context.

在对其进行了额外的观察之后,发现引用的根项目文件(我们做的事情有点不同(。NET Framework项目需要对未加载的程序集的引用。

不知道为什么,但可能与MVVM有关,并使用根项目作为应用程序的包装器/驱动程序。

最新更新