0
我有一個MEF不導出插件的問題,顯然只有在安裝在c:\ Program Files(x86)中時纔會導出。MEF無法識別程序文件(x86)中的導出
我正在爲Windows服務實現一個非常簡單的MEF插件系統。
出口的TestService.dll(插件)
[Export(typeof(IScheduledService))]
public class Service: IScheduledService
{ ... }
進口
public class ScheduledServices: IEnumerable<IScheduledService>
{
[ImportMany(typeof(IScheduledService))]
private List<IScheduledService> _services { get; set; }
...
}
組成
var catalog = new DirectoryCatalog(PluginDirectory);
var container = new CompositionContainer(catalog);
container.ComposeParts(pluginCollection);
這在測試中正常工作,並通過Windows窗體等驅動。它使用「InstallUtil」作爲服務安裝時甚至可以工作。但是,當彙總到Windows安裝程序並安裝在C:\ Program Files(x86)中時,它不會接收導出;
System.ComponentModel.Composition Information: 6 : The ComposablePartDefinition
'TestService.Service' was ignored because it contains no exports.
我在想它必須與某種CAS /權限有關嗎?
任何幫助表示讚賞!