0
我正在使用StructureMap在我的應用程序的開始加載插件。在應用程序啓動時,當我創建容器我做了一個簡單的掃描,如:StructureMap無法從插件框架中的文件加載程序集
internal static IContainer Init()
{
var container = new Container(a =>
{
a.Scan(scan =>
{
scan.TheCallingAssembly();
scan.WithDefaultConventions();
scan.AssembliesFromPath($"{AppDomain.CurrentDomain.BaseDirectory}Plugins");
});
});
ConfigureDebugSubstitutions(container);
return container;
}
但我在控制檯中看到這些錯誤:
StructureMap could not load assembly from file <filepath>
我最終通過手動加載避過它目前文件到AppDomain中是這樣的:
private static void LoadPluginAssemblies()
{
var pluginAssemblies = Directory.GetFiles($"{AppDomain.CurrentDomain.BaseDirectory}plugins", "*.dll");
pluginAssemblies.Each(a =>
{
Assembly.LoadFile(a);
});
}
但我很好奇,爲什麼我碰到structuremap這個消息開始。我looked at the code,它看起來像任何錯誤只是處理。有什麼想法嗎?我使用的版本是4.0.1.318,我沒有注意到這一點,直到我從版本3.1.4.143升級了StructureMap。另外,如果它很重要,我使用.Net v4.6.1。