Target FrameWork: Net Core 5.0 IDE: Visual Studio 2019
Project Type: WebAPI
use DI version: autofac 6.1.0 use Automapper version: 10.1.1
Error Description: I'm trying to learn ApplicationPart(https://docs.microsoft.com/zh-cn/aspnet/core/mvc/advanced/app-parts?view=aspnetcore-5.0) , and when i load the applicationpart class library with assembly
var mvcBuilder = services.AddMvc(); var assemblies = AssemblyHelper.GetAssemblies(AppSetting.ModuleDir); foreach (var assembly in assemblies) { if (AppSetting.LoadModules == null || !AppSetting.LoadModules.Contains<string>(assembly.GetName().Name)) { continue; } mvcBuilder.SetCompatibilityVersion(CompatibilityVersion.Version_3_0).AddApplicationPart(assembly); }
and then , i register type with autofac or any DI tools
builder.RegisterModule(new AutoMapperModule(AppDomain.CurrentDomain.GetAssemblies()));
or
services.AddAutoMapper(typeof(MappingProfile));
enter image description here
iget this eroor enter image description here
but if load applicaitonpart without assembly,It's a direct reference to the project i can get success run ....
please , tell me why ? i get the trouble a long time
1.4m articles
1.4m replys
5 comments
56.9k users