Base solution for your next web application
Open Closed

Issue in running Migrator project after upgrading to version 10.2 #10093


User avatar
0
csona created

Hi,

I am getting following error while running Migration project

Castle.MicroKernel.Handlers.HandlerException: 'Can't create component 'GrowthPlan.GrowthPlanCoreModule' as it has dependencies to be satisfied.

'GrowthPlan.GrowthPlanCoreModule' is waiting for the following dependencies:
- Service 'Microsoft.AspNetCore.Hosting.IWebHostEnvironment' which was not registered.
'

Also what connection string should I specify in app settings for Migrator project (source or destination database)?

Thanks in advance.


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @csona

    Is this happening in the default 10.2 project ? Could you try that ? Migrator project shouldn't use IWebHostEnvironment at all.

    Also what connection string should I specify in app settings for Migrator project (source or destination database)?

    There is no source database in AspNet Zero. Migrator project applies migrations in your project to target database. So, it is the target database.

    Thanks,

  • User Avatar
    0
    csona created

    Hi @ismcagdas,

    Thanks for the reply.

    Regarding database connection string in appsettings.json, it is clear now. Thanks.

    Regarding the other error, it is not occuring in the default 10.2 project. The error is thrown before {ProjectName}CoreModule.PreInitialize method is called. So I am trying to check the dependencies in {ProjectName}.Core project and its dependencies. Could there be any other reason it is trying to load 'Microsoft.AspNetCore.Hosting.IWebHostEnvironment'?

    The dependencies for {ProjectName}.EntityFrameworkCore is as follows:

    Thanks.

  • User Avatar
    0
    csona created

    Hi @ismcagdas

    I have resolved this issue by removing an unwanted dependency on IWebHostEnvironment in {ProjectName}CoreModule.cs that was added by mistake.

    However, I had misinterpreted the use of Migrator project. Actually I would like to migrate the data from one daabase to another. Normal processes like backup & restore or import/export of data would not work due to referntial integrity constraints. Can you please recommend any way to achieve this?

    Thanks in advance.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @csona

    Got it, thanks. AspNet Zero doesn't offer any solution for such data or schema migration. If you are using Visual Studio, you can use its Tools for such migration, see;

    Or you can try a paid tools.