EasyAbp / AbpHelper.CLI

Providing code generation and more features to help you develop applications and modules with the ABP framework.
MIT License
285 stars 95 forks source link

Unknown ABP project structure #213

Open zyknow opened 1 year ago

zyknow commented 1 year ago

i using abphelper on my microservice project to create crud,but i got error

this is error and command info

(base) PS G:\AbpMicroservice\ms\src\services\product> abphelper generate crud Student -d G:\AbpMicroservice\ms\src\services\product --skip-db-migrations --skip-permissions --skip-get-list-input-dto --separate-dto --entity-prefix-dto --skip-ui --skip-view-model --skip-localization --skip-test --skip-entity-constructors [15:49:24 INF] Use directory: G:\AbpMicroservice\ms\src\services\product [15:49:24 INF] Command 'crud' started.

[15:49:24 DBG] ProjectInfoProviderStep Input [excludeDirectories]: [15:49:24 ERR] Error while invoking activity activity-5 of workflow 1a7554fc61a9433496dd9d6cf81e87f8 System.NotSupportedException: Unknown ABP project structure. Directory: G:\AbpMicroservice\ms\src\services\product at EasyAbp.AbpHelper.Core.Steps.Abp.ProjectInfoProviderStep.OnExecuteAsync(WorkflowExecutionContext context, CancellationToken cancellationToken) in /home/runner/work/AbpHelper.CLI/AbpHelper.CLI/src/AbpHelper.Core/Steps/Abp/ProjectInfoProviderStep.cs:line 35 at Elsa.Services.ActivityInvoker.InvokeAsync(WorkflowExecutionContext workflowContext, IActivity activity, Func`2 invokeAction) [15:49:24 ERR] Error activity: { "Name": null }

this is my product service files structure

G:. │ AbpMicroservice.ProductService.sln ├─src │ ├─AbpMicroservice.ProductService.Application │ │ │ AbpMicroservice.ProductService.Application.csproj │ │ │ ProductServiceApplicationAutoMapperProfile.cs │ │ │ ProductServiceApplicationModule.cs │ │ │ ProductServiceAppService.cs │ │ │ │ │ ├─Products │ │ │ ProductAppService.cs │ │ │ │ │ └─Properties │ │ AssemblyInfo.cs │ │ │ ├─AbpMicroservice.ProductService.Application.Contracts │ │ │ AbpMicroservice.ProductService.Application.Contracts.csproj │ │ │ ProductServiceApplicationContractsModule.cs │ │ │ ProductServiceDtoExtensions.cs │ │ │ ProductServiceRemoteServiceConsts.cs │ │ │ │ │ ├─Permissions │ │ │ ProductServicePermissionDefinitionProvider.cs │ │ │ ProductServicePermissions.cs │ │ │ │ │ └─Products │ │ ProductDto.cs │ │ │ ├─AbpMicroservice.ProductService.Domain │ │ │ AbpMicroservice.ProductService.Domain.csproj │ │ │ ProductServiceConsts.cs │ │ │ ProductServiceDbProperties.cs │ │ │ ProductServiceDomainModule.cs │ │ │ │ │ ├─Products │ │ │ Product.cs │ │ │ │ │ ├─Properties │ │ │ AssemblyInfo.cs │ │ │ │ │ ├─Settings │ │ │ ProductServiceSettingDefinitionProvider.cs │ │ │ ProductServiceSettings.cs │ │ │ │ │ └─Students │ │ Student.cs │ │ │ ├─AbpMicroservice.ProductService.Domain.Shared │ │ │ AbpMicroservice.ProductService.Domain.Shared.csproj │ │ │ ProductServiceDomainErrorCodes.cs │ │ │ ProductServiceDomainSharedModule.cs │ │ │ ProductServiceModuleExtensionConfigurator.cs │ │ │ │ │ └─Localization │ │ │ ProductServiceResource.cs │ │ │ │ │ └─ProductService │ │ en.json │ │ zh-Hans.json │ │ │ ├─AbpMicroservice.ProductService.EntityFrameworkCore │ │ │ AbpMicroservice.ProductService.EntityFrameworkCore.csproj │ │ │ │ │ ├─EntityFrameworkCore │ │ │ IProductServiceDbContext.cs │ │ │ ProductDbContextModelCreatingExtensions.cs │ │ │ ProductServiceDbContext.cs │ │ │ ProductServiceDbContextFactory.cs │ │ │ ProductServiceEfCoreEntityExtensionMappings.cs │ │ │ ProductServiceEntityFrameworkCoreModule.cs │ │ │ │ │ ├─Migrations │ │ │ 20230424034748_Initial.cs │ │ │ 20230424034748_Initial.Designer.cs │ │ │ ProductServiceDbContextModelSnapshot.cs │ │ │ │ │ └─Properties │ │ AssemblyInfo.cs │ │ │ ├─AbpMicroservice.ProductService.HttpApi │ │ AbpMicroservice.ProductService.HttpApi.csproj │ │ ProductServiceController.cs │ │ ProductServiceHttpApiModule.cs │ │ │ ├─AbpMicroservice.ProductService.HttpApi.Client │ │ AbpMicroservice.ProductService.HttpApi.Client.csproj │ │ ProductServiceHttpApiClientModule.cs │ │ │ └─AbpMicroservice.ProductService.HttpApi.Host │ │ AbpMicroservice.ProductService.HttpApi.Host.csproj │ │ appsettings.Development.json │ │ appsettings.json │ │ appsettings.secrets.json │ │ ProductServiceHttpApiHostModule.cs │ │ Program.cs │ │ │ ├─Controllers │ │ HomeController.cs │ │ │ ├─DbMigrations │ │ ProductServiceDatabaseMigrationChecker.cs │ │ ProductServiceDatabaseMigrationEventHandler.cs │ │ │ ├─Properties │ │ launchSettings.json │ │ │ └─wwwroot └─test ├─AbpMicroservice.ProductService.Application.Tests │ │ AbpMicroservice.ProductService.Application.Tests.csproj │ │ ProductServiceApplicationTestBase.cs │ │ ProductServiceApplicationTestModule.cs │ │ │ └─Products │ ProductAppService_Tests.cs │ ├─AbpMicroservice.ProductService.Domain.Tests │ │ AbpMicroservice.ProductService.Domain.Tests.csproj │ │ ProductServiceDomainTestBase.cs │ │ ProductServiceDomainTestModule.cs │ │ │ └─Samples │ SampleManager_Tests.cs │ ├─AbpMicroservice.ProductService.EntityFrameworkCore.Tests │ │ AbpMicroservice.ProductService.EntityFrameworkCore.Tests.csproj │ │ │ └─EntityFrameworkCore │ │ ProductServiceEntityFrameworkCoreTestBase.cs │ │ ProductServiceEntityFrameworkCoreTestModule.cs │ │ │ └─Products │ ProductServiceRepositoryTests.cs │ └─AbpMicroservice.ProductService.TestBase │ AbpMicroservice.ProductService.TestBase.csproj │ ProductServiceTestBase.cs │ ProductServiceTestBaseModule.cs │ ProductServiceTestData.cs │ ProductServiceTestDataSeedContributor.cs │ └─Security FakeCurrentPrincipalAccessor.cs

gdlcf88 commented 1 year ago

The CRUD generator was designed and validated for the normal app/module startup template, but it usually works for multi-module project structures as well. If your project structure is more complex, try debugging the AbpHelper CLI.

zyknow commented 1 year ago

i find the error code is

image

when i change code to this ,it's work and my microservice project can successful build image

even i change the input args to this ,also my microservice project can successful build image

so ,i think this code can be change to better to validation this project it's a TemplateType.Application ?

if (FileExistsInDirectory(baseDirectory, "*.Host.Shared.csproj", excludeDirectories) || FileExistsInDirectory(baseDirectory, "*.Installer.csproj", excludeDirectories))
            {
                templateType = TemplateType.Module;
            }
gdlcf88 commented 1 year ago

Could you please try to improve it?

gdlcf88 commented 1 year ago

This is a part of the module template, which is different from the app template.

zyknow commented 1 year ago

yeah,i find i provide error code on previous conversation should be this code to effect it's TemplateType.Application image

it's could be another obvious different on abp Module and Application template

zyknow commented 1 year ago

so, for easily , it's to add new else if to add new condition to equal it's TemplateType.Application

zyknow commented 1 year ago

and i think this condition else if (FileExistsInDirectory(baseDirectory, "*.DbMigrator.csproj", excludeDirectories)) ,it's to ensure this project is multi layer and abp project ?

zyknow commented 1 year ago

so ,could be change like this code image

first if ,can ensure it's module sln second if else ,can ensure it's a abp sln and it's not single-layer application

so,i think this code can work ,how do you think