[英]MEF plugin dependency not loading as plugins directory is not checked
我遇到了MEF沒有為加載的組件獲取依賴關系的問題。 我們有一個目錄結構,如下所示:
C:/ MSMQ / DistributionService / [主要應用]
C:/ MSMQ / Providers / [插件組件]
當然,我們正在使用DirectoryCatalog,該插件被選中,但其中一個依賴項不是。 錯誤消息是:
2012-11-02 10:46:59,379 [1] FATAL - Assemblies required by Provider are not found
System.IO.FileNotFoundException: Could not load file or assembly 'BusinessObjects, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'BusinessObjects, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null'
=== Pre-bind state information ===
LOG: User = <redacted>
LOG: DisplayName = BusinessObjects, Version=1.5.0.0, Culture=neutral, Public
KeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/MSMQ/DistributionService/
LOG: Initial PrivatePath = NULL
Calling assembly : DistributedServicePropertyComponents, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\MSMQ\DistributionService\Distr
ibutionService.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: Policy not being applied to reference at this time (private, custom, partia
l, or location-based assembly bind).
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
2012-11-02 10:46:59,401 [1] FATAL - Assemblies required by Provider are not found
System.IO.FileNotFoundException: Could not load file or assembly 'BusinessObjects, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'BusinessObjects, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null'
=== Pre-bind state information ===
LOG: User = B2B\addisona
LOG: DisplayName = BusinessObjects, Version=1.5.0.0, Culture=neutral, Public
KeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/MSMQ/DistributionService/
LOG: Initial PrivatePath = NULL
Calling assembly : DistributedServicePropertyComponents, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\MSMQ\DistributionService\DistributionService.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: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
我相信這類似於MSDN上的一個問題: http : //social.msdn.microsoft.com/Forums/en-US/MEFramework/thread/b34ef4f4-e1f1-4f06-bd42-d7b3d5060f6f/ - 但我不明白答案。
有沒有辦法提供從中提取問題的路徑,或任何其他建議的解決方案?
我們最近才開始遇到這個問題,但是在我們的源代碼管理歷史記錄中,我看不到任何我希望發生的變化。
您的一個或多個插件依賴於BusinessObjects
程序集,而您的宿主應用程序不引用此程序集。 您可以執行以下任一操作來解決此問題:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.