Open Closed

Error occurred on DB migration step: MSBUILD #963


User avatar
0
Frontis1 created

ABP version: 4.2.1

Steps to reproduce:

  • abp new CustomerX -t app-pro --create-solution-folder --preview --output-folder p:\development\
  • abp new CustomerX.APIY -t module-pro --preview --create-solution-folder --output-folder p:\development\CustomerX modules --no-ui

I then added the "CustomerX.ApiY" projects necessary to the solution. Because the API has no dependency on a database (it is used to call a thirdparty api) I removed everything which is related to databases (removed the nuget packages, and all the code related).

So this gives me this solution:

And this is the HostModule for the (httpApi.Host) module:

I then run the Suite to add an entity but it gives me this error when i click : Save and Generate:

"Error occurred on DB migration step: MSBUILD : error MSB1009: Project file does not exist. Switch: ../CustomerX.HttpApi.Host Unable to retrieve project metadata. Ensure it's an SDK-style project. If you're using a custom BaseIntermediateOutputPath or MSBuildProjectExtensionsPath values, Use the --msbuildprojectextensionspath option."

I think it is still trying the run the migrations for the CustomerX.ApiY module? All entity files are created correctly but the only thing that is failing, is creating the DB migrations.

Is there a way to fix this?

Kind Regards,

Alfred


12 Answer(s)
  • User Avatar
    1
    Frontis1 created

    Cant reproduce this issue anymore myself. Case closed!

  • User Avatar
    0
    Frontis1 created

    Sorry, have to reopen this. I did some testing this morning and the error did not occur so i thought it was a fault on my side but i just got the error again and pinpointed the issue.

    To reproduce:

    1. run: abp new CustomerX -t app-pro --create-solution-folder --preview --output-folder p:\development\
    2. run: abp new CustomerX.APIY -t module-pro --preview --create-solution-folder --output-folder p:\development\CustomerX\modules --no-ui
    3. Run the DBMigrator so the database get's created and seeded.
    4. Start the abp suite en open the solution in the abp suite.
    5. Add a new entity and press "Save and generate"

    Notice that an error occurs:

    "Unable to retrieve project metadata. Ensure it's an SDK-style project. If you're using a custom BaseIntermediateOutputPath or MSBuildProjectExtensionsPath values, Use the --msbuildprojectextensionspath option."

    To fix this you can do the following:

    Open the abp suite and open the solution BEFORE adding the module OR move the "modules" folder temporary and open the solution in the abp suite.

    My guess is that the msbuildprojectextensionspath is not getting set correclty when the module is already in the solution folder.

    When the error occurs i noticed that the suite has made a OBJ directory in the wrong path:

    So there is definitely somthing going wrong with a path.

  • User Avatar
    0
    alper created
    Support Team Director

    can you try this instead of manually adding the module to the project Create your main solution and then run DbMigrator. Then add this solution to Suite. Open Modules page, click Create a New Module Tick Add to the solution checkbox. This will create a new module into your main solution.

  • User Avatar
    0
    Frontis1 created

    Hi Alper,

    Thanks for your response. This works indeed.

    But what would be the equivalent CLI command?? We would rather add modules via the CLI so we can easily automate our solution-creation.

    I also noticed that when we do the following:

    1. run: abp new CustomerX -t app-pro --create-solution-folder --preview --output-folder p:\development\
    2. run: abp add-module CustomerX.ApiY --new --add-to-solution-file
    3. Run the DBMigrator so the database get's created and seeded.
    4. Start the abp suite en open the solution in the abp suite.
    5. Add a new entity and press "Save and generate"

    everything works as well!

    But in step 2 we use the add-module and this will not add the pro-module unfortunately. Is there a add-module cli command that will add the pro version?

  • User Avatar
    0
    alper created
    Support Team Director

    you can use the following CLI command to add a new module to your existing solution.

    abp add-module ProductManagement --new --solution C:\YourSolutionPath --add-to-solution-file
    

    https://docs.abp.io/en/abp/latest/CLI#options-3

  • User Avatar
    0
    Frontis1 created

    Hi Alper,

    Thanks for your quick response.

    abp add-module ProductManagement --new --solution C:\YourSolutionPath --add-to-solution-file
    

    Is not adding the pro version of the module template (https://docs.abp.io/en/abp/latest/Startup-Templates/Module). For instance, I am missing the host folder:

    I just noticed that the ABP suite is not using the pro version as well when you use the "Create new module" button:

    That's why I used:

    abp new CustomerX.APIY -t module-pro --preview --create-solution-folder --output-folder p:\development\CustomerX\modules --no-ui
    

    because this command WILL add the host folder! But, as far as i know, there is no way to add it to an existing solution?

    But nevertheless i still feel that the ABP suite is containing a bug for solutions which have modules in them, because "save and generate" keeps failing when i create a new entity in the suite. And that is the reason we bought the license.

    Just perform these simple steps and you will see:

    1. run: abp new CustomerX -t app-pro --create-solution-folder --preview --output-folder p:\development\
    2. run: abp new CustomerX.APIY -t module-pro --preview --create-solution-folder --output-folder p:\development\CustomerX\modules --no-ui
    3. Run the DBMigrator so the database get's created and seeded.
    4. Start the abp suite en open the solution in the abp suite.
    5. Add a new entity and press "Save and generate"
    6. Notice that an error occurs
  • User Avatar
    0
    alper created
    Support Team Director

    Are you trying to create an entity to your main project or to your module?

  • User Avatar
    0
    Frontis1 created

    To the main project

  • User Avatar
    0
    yekalkan created
    Support Team Fullstack Developer

    Hi @Frontis1,

    Suite uses pro module template when you create a new module on Create new module dialog. And to make cli use pro module template, add -t module-pro argument to command. example:

    abp add-module ProductManagement --new --solution C:\YourSolutionPath --add-to-solution-file -t module-pro

    For instance, I am missing the host folder

    Yes, there is no host folder and host projects. they are deleted because they are no longer needed to test your module.

    The problem you have encountered should be because of manuel creation of inner module. You should have no problem when you add the module to your solution the way i explained above (Suite Create new module dialog).

  • User Avatar
    0
    yekalkan created
    Support Team Fullstack Developer

    @Frontis1 i also tested the way you added the module and there was no error. May your ABP Suite version be outdated?

  • User Avatar
    0
    alper created
    Support Team Director

    I must say that the ABP CLI version and your project version must be the same.

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11