我遇到了WPF的问题,即程序集的早期版本已加载到我的应用程序中,所以我们说一个Xceed.WPF.Toolkit而不是v.2.0。我正在编写此应用程序的扩展程序,该程序需要较新版本的工具箱(例如v.3.4)。
我认为,在安装该应用程序的插件时,该插件向基本应用程序添加了额外的功能,如果我将新的Xceed v.3.4添加到GAC,它将能够使用该应用程序中提供的新控件来解析XAML。组装,一切都会好的。但是,我一直得到这个:
我的程序集显然已安装在GAC中:
是否有一种方法可以使我缺少的通过GAC发现新的装配体版本?
我曾在调用WPF Assembly.LoadFrom()
之前尝试使用InitializeComponent();
,但即使程序集加载正常,初始化时它仍会引发XAML异常。
任何想法都会受到赞赏。
编辑:
谢谢您使用汇编绑定日志查看器的建议。我能够从中提取以下日志。加载Xceed工具箱时的主应用程序将使用以下日志绑定到3.0版:
*** Assembly Binder Log Entry (3/17/2019 @ 12:19:24 AM) ***
The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable C:\Program Files\Autodesk\Revit 2019\Revit.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: Where-ref bind. Location = C:\Program Files\Dynamo\Dynamo Core\2\nodes\Xceed.Wpf.Toolkit.dll
LOG: Appbase = file:///C:/Program Files/Autodesk/Revit 2019/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = Revit.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\Program Files\Autodesk\Revit 2019\Revit.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Attempting download of new URL file:///C:/Program Files/Dynamo/Dynamo Core/2/nodes/Xceed.Wpf.Toolkit.dll.
LOG: Assembly download was successful. Attempting setup of file: C:\Program Files\Dynamo\Dynamo Core\2\nodes\Xceed.Wpf.Toolkit.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Xceed.Wpf.Toolkit, Version=3.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4
LOG: Re-apply policy for where-ref bind.
LOG: Post-policy reference: Xceed.Wpf.Toolkit, Version=3.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4
LOG: GAC Lookup was unsuccessful.
LOG: Where-ref bind Codebase does not match what is found in default context. Keep the result in LoadFrom context.
LOG: Binding succeeds. Returns assembly from C:\Program Files\Dynamo\Dynamo Core\2\nodes\Xceed.Wpf.Toolkit.dll.
LOG: Assembly is loaded in LoadFrom load context.
然后是我的扩展程序尝试使用以下日志加载3.4版本:
*** Assembly Binder Log Entry (3/17/2019 @ 12:19:29 AM) ***
The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable C:\Program Files\Autodesk\Revit 2019\Revit.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: Where-ref bind. Location = C:\Users\username\AppData\Roaming\Dynamo\Dynamo Revit\2.0\packages\archi-lab.net\bin\Xceed.Wpf.Toolkit.dll
LOG: Appbase = file:///C:/Program Files/Autodesk/Revit 2019/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = Revit.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\Program Files\Autodesk\Revit 2019\Revit.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Attempting download of new URL file:///C:/Users/username/AppData/Roaming/Dynamo/Dynamo Revit/2.0/packages/archi-lab.net/bin/Xceed.Wpf.Toolkit.dll.
LOG: Assembly download was successful. Attempting setup of file: C:\Users\username\AppData\Roaming\Dynamo\Dynamo Revit\2.0\packages\archi-lab.net\bin\Xceed.Wpf.Toolkit.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Xceed.Wpf.Toolkit, Version=3.4.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4
LOG: Re-apply policy for where-ref bind.
LOG: Post-policy reference: Xceed.Wpf.Toolkit, Version=3.4.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4
LOG: Found assembly by looking in the GAC.
LOG: Switch from LoadFrom context to default context.
LOG: Binding succeeds. Returns assembly from C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Xceed.Wpf.Toolkit\v4.0_3.4.0.0__3e4669d2f30244f4\Xceed.Wpf.Toolkit.dll.
LOG: Assembly is loaded in default load context.
谁能帮助我理解这些含义?