2012-11-05 39 views
6

我遇到了MEF沒有爲加載組件提取依賴關係的問題。我們有一個看起來像一個目錄結構:未加載MEF插件依賴項作爲插件目錄未檢查

C:/ MSMQ/DistributionService/[主要應用]

C:/ MSMQ /供應商/ [插件組件]

當然,我們使用的是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/ - 但我不明白的答案。

有什麼辦法可以提供從任何其他建議解決方案中選擇問題組合的路徑嗎?

我們最近纔開始有這個問題,但是我看不到我期望在我們的源代碼管理歷史記錄中發生的任何更改。

+0

您是否試圖從簽名(或延遲簽名)代碼加載程序集? –

+0

據我所知,簽名代碼不涉及(框架庫除外)。 – penguat

+0

然後你是否試圖從32位代碼加載64位程序集? –

回答

1

您的一個或多個插件依賴於BusinessObjects程序集,而您的主機應用程序不會引用此程序集。你可以做以下任一操作來解決這個問題:

  1. 從主應用程序添加到該程序集的引用,使插件可以使用它在加載時。
  2. 將此程序集加入您的C:\ MSMQ \ Providers目錄,以便在加載插件並查找該程序集時,他們可以找到並加載它。
+4

此程序集位於C:\ MSMQ \ Providers目錄中,未找到。 – penguat

相關問題