aspnetboilerplate: Problem in using FolderPlugInSource

I’ve a multi module system and I’m migrating it to ABP v0.10.1.2. I’m facing the below issue.

Component Abp.AutoMapper.AbpAutoMapperModule could not be registered. There is already a component with that name. Did you want to modify the existing component instead? If not, make sure you specify a unique name.

Stack Trace: 

[ComponentRegistrationException: Component Abp.AutoMapper.AbpAutoMapperModule could not be registered. There is already a component with that name. Did you want to modify the existing component instead? If not, make sure you specify a unique name.]
   Castle.MicroKernel.SubSystems.Naming.DefaultNamingSubSystem.Register(IHandler handler) +579
   Castle.MicroKernel.DefaultKernel.AddCustomComponent(ComponentModel model) +55
   Castle.MicroKernel.DefaultKernel.Register(IRegistration[] registrations) +69
   Castle.Windsor.WindsorContainer.Register(IRegistration[] registrations) +46
   Abp.Modules.AbpModuleManager.RegisterModules(ICollection`1 moduleTypes) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Modules\AbpModuleManager.cs:127
   Abp.Modules.AbpModuleManager.LoadAllModules() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Modules\AbpModuleManager.cs:72
   Abp.AbpBootstrapper.Initialize() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\AbpBootstrapper.cs:138
   HammadSystem.Web.MvcApplication.Application_Start(Object sender, EventArgs e) in D:\src\HammadSystem\src\HammadSystem.Web\Global.asax.cs:21

[HttpException (0x80004005): Component Abp.AutoMapper.AbpAutoMapperModule could not be registered. There is already a component with that name. Did you want to modify the existing component instead? If not, make sure you specify a unique name.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +544
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +186
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +343

[HttpException (0x80004005): Component Abp.AutoMapper.AbpAutoMapperModule could not be registered. There is already a component with that name. Did you want to modify the existing component instead? If not, make sure you specify a unique name.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +112
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +716

The system core modules dlls plus Abp dlls are located in the bin Folder The System modules are located in modules folder and because it depend on abp and the some of the core system modules the dlls are also copied in this folder. I’ve added this section in the web.config

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="bin;modules"/>
       <dependentAssembly>.....
 </assemblyBinding>

Before adding this section, This system wan’t able to load the dlls that my plug in depends on. Am I doing something wrong? Thanks,

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (13 by maintainers)

Most upvoted comments

One another option may be AppDomain.AssemblyResolve Event (https://msdn.microsoft.com/en-us/library/system.appdomain.assemblyresolve(v=vs.110).aspx). ABP can register to this event and check plugin folders for unknown assemblies.

Thanks, I use this fo .NET CORE:

/// <binding AfterBuild='copy-modules' />
"use strict";

var gulp = require('gulp')  
var clean = require('gulp-clean');

var paths = {
    devModules: "../Modules/",
    hostModules: "./Modules/"
};

var modules = [
    'CMS/Fibit.SmartWeb.Module.CMS'
];

gulp.task('clean-module', function () {
    return gulp.src([paths.hostModules + '*'], { read: false })
    .pipe(clean());
});


gulp.task('copy-modules', ['clean-module'], function () {
    modules.forEach(function (module) {
        gulp.src([paths.devModules + module + '/Views/**/*.*', paths.devModules + module + '/wwwroot/**/*.*'], { base: module })
            .pipe(gulp.dest(paths.hostModules + module));
        gulp.src([paths.devModules + module + '/bin/Debug/net461/Fibit*.*', "!"+ paths.devModules + module + '/bin/Debug/net461/Abp*.*'])
            .pipe(gulp.dest(paths.hostModules + module + '/bin'));
    });

});

For me, I’ve added the below lines for every project in the post-build event command line xcopy “$(ProjectDir)$(OutDir)$(TargetName).dll” "$(SolutionDir)MYAPP.Web\modules" /Y xcopy “$(ProjectDir)$(OutDir)$(TargetName).dll.config” "$(SolutionDir)MYAPP.Web\modules" /Y xcopy “$(ProjectDir)$(OutDir)$(TargetName).pdb” "$(SolutionDir)MYAPP.Web\modules" /Y

This takes the .dll and config and pdb files to the modules folder in the web application after every build.