我的应用程序是从autofac.json文件初始化的:
{
"defaultAssembly": "Application",
"modules": [
{ "type": "Application.Plugin1.Module, Application.Plugin1" },
{ "type": "Application.Plugin2.Module, Application.Plugin2" },
{ "type": "Application.Plugin3.Module, Application.Plugin3" }
]
}
但是每个插件都不是强制性的。
当我使用缺少的插件运行应用程序时,会引发以下异常:
Unhandled Exception: System.InvalidOperationException: The type 'Application.Plugin2.Module, Application.Plugin2' could not be found. It may require assembly qualification, e.g. "MyType, MyAssembly".
at Autofac.Configuration.Core.ConfigurationExtensions.GetType(IConfiguration configuration, String key, Assembly defaultAssembly)
at Autofac.Configuration.Core.ModuleRegistrar.RegisterConfiguredModules(ContainerBuilder builder, IConfiguration configuration)
at Autofac.Configuration.Core.ConfigurationRegistrar.RegisterConfiguration(ContainerBuilder builder, IConfiguration configuration)
at Autofac.Module.Configure(IComponentRegistry componentRegistry)
at Autofac.ContainerBuilder.Build(IComponentRegistry componentRegistry, Boolean excludeDefaultModules)
at Autofac.ContainerBuilder.Build(ContainerBuildOptions options)
如何忽略应用程序文件夹中不存在的插件?