Base solution for your next web application
Open Closed

Build failed on Regenerate Entity #8368


User avatar
0
-bitman created

Hello AspNetZero Team,

I am encountering a Build Failed error whenever I tried regenerating an entity from having them removed for a Tenant. Meaning, originally they were created for multitenancy but I suddenly realized they should just be for the host. I tried unticking the Tenent check box from the RAD Tool to regenerate the entity but I get a build failed error and it does not reflect my changes to the database.

Please advise.

Thank you!


6 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    I get a build failed error

    Please share the details of the error.

  • User Avatar
    0
    -bitman created

    -> CurrenciesAppService.cs is being generated. -> ICurrenciesAppService.cs is being generated. -> CurrencyConsts.cs is being generated. -> CreateOrEditCurrencyDto.cs is being generated. -> CurrencyDto.cs is being generated. -> GetAllCurrenciesForExcelInput.cs is being generated. -> GetAllForLookupTableInput.cs is being generated. -> GetAllCurrenciesInput.cs is being generated. -> GetCurrencyForViewDto.cs is being generated. -> GetCurrencyForEditOutput.cs is being generated. -> Currency.cs is being generated. -> CurrenciesExcelExporter.cs is being generated. -> ICurrenciesExcelExporter.cs is being generated. -> AppPermissions.cs is being modified. -> AppAuthorizationProvider.cs is being modified. -> EntityHistoryHelper.cs is being modified. -> SonetaDbContext.cs is being modified. -> CustomDtoMapper.cs is being modified. Running add-migration... Build started... Build failed. Running update-database... Build started... Build failed. -> currencies.component.ts is being generated. -> currencies.component.html is being generated. -> create-or-edit-currency-modal.component.html is being generated. -> create-or-edit-currency-modal.component.ts is being generated. -> view-currency-modal.component.html is being generated. -> view-currency-modal.component.ts is being generated. -> admin.module.ts is being modified. -> admin-routing.module.ts is being modified. -> app-navigation.service.ts is being modified. -> service-proxy.module.ts is being modified. -> Soneta.xml is being modified.

    Code generation is complete. Press ENTER to exit...

    I even dropped and created the database from scratch but I get the same error and no tables were created.

  • User Avatar
    0
    maliming created
    Support Team

    What error message do you get when building your project?

    dotnet build
    
  • User Avatar
    0
    -bitman created

    PM> dotnet build Soneta.Web.sln Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core Copyright (C) Microsoft Corporation. All rights reserved.

    Restore completed in 76.82 ms for C:\Soneta\aspnet-core\src\Soneta.Core\Soneta.Core.csproj. Restore completed in 68.63 ms for C:\Soneta\aspnet-core\src\Soneta.Application.Shared\Soneta.Application.Shared.csproj. Restore completed in 76.24 ms for C:\Soneta\aspnet-core\src\Soneta.Core.Shared\Soneta.Core.Shared.csproj. Restore completed in 6.21 ms for C:\Soneta\aspnet-core\src\Soneta.EntityFrameworkCore\Soneta.EntityFrameworkCore.csproj. Restore completed in 1.27 sec for C:\Soneta\aspnet-core\src\Soneta.Migrator\Soneta.Migrator.csproj. Restore completed in 1.26 sec for C:\Soneta\aspnet-core\src\Soneta.GraphQL\Soneta.GraphQL.csproj. Restore completed in 1.39 sec for C:\Soneta\aspnet-core\src\Soneta.Application\Soneta.Application.csproj. Restore completed in 34.19 ms for C:\Soneta\aspnet-core\test\Soneta.ConsoleApiClient\Soneta.ConsoleApiClient.csproj. Restore completed in 3.17 sec for C:\Soneta\aspnet-core\src\Soneta.Web.Core\Soneta.Web.Core.csproj. Restore completed in 1.96 sec for C:\Soneta\aspnet-core\test\Soneta.GraphQL.Tests\Soneta.GraphQL.Tests.csproj. Restore completed in 2.77 sec for C:\Soneta\aspnet-core\src\Soneta.Web.Public\Soneta.Web.Public.csproj. Restore completed in 2.81 sec for C:\Soneta\aspnet-core\src\Soneta.Web.Host\Soneta.Web.Host.csproj. Restore completed in 1.16 sec for C:\Soneta\aspnet-core\test\Soneta.Test.Base\Soneta.Test.Base.csproj. Restore completed in 1.2 sec for C:\Soneta\aspnet-core\test\Soneta.Tests\Soneta.Tests.csproj. Soneta.Core.Shared -> C:\Soneta\aspnet-core\src\Soneta.Core.Shared\bin\Debug\netstandard2.0\Soneta.Core.Shared.dll Authorization\AppAuthorizationProvider.cs(57,17): error CS0128: A local variable or function named 'postalCodes' is already defined in this scope [C:\Soneta\aspnet-core\src\Soneta.Core\Soneta.Core.csproj] Authorization\AppAuthorizationProvider.cs(71,17): error CS0128: A local variable or function named 'countries' is already defined in this scope [C:\Soneta\aspnet-core\src\Soneta.Core\Soneta.Core.csproj] Authorization\AppAuthorizationProvider.cs(78,17): error CS0128: A local variable or function named 'currencies' is already defined in this scope [C:\Soneta\aspnet-core\src\Soneta.Core\Soneta.Core.csproj] Soneta.Application.Shared -> C:\Soneta\aspnet-core\src\Soneta.Application.Shared\bin\Debug\netstandard2.0\Soneta.Application.Shared.dll Soneta.ConsoleApiClient -> C:\Soneta\aspnet-core\test\Soneta.ConsoleApiClient\bin\Debug\netcoreapp3.1\Soneta.ConsoleApiClient.dll

    Build FAILED.

    Authorization\AppAuthorizationProvider.cs(57,17): error CS0128: A local variable or function named 'postalCodes' is already defined in this scope [C:\Soneta\aspnet-core\src\Soneta.Core\Soneta.Core.csproj] Authorization\AppAuthorizationProvider.cs(71,17): error CS0128: A local variable or function named 'countries' is already defined in this scope [C:\Soneta\aspnet-core\src\Soneta.Core\Soneta.Core.csproj] Authorization\AppAuthorizationProvider.cs(78,17): error CS0128: A local variable or function named 'currencies' is already defined in this scope [C:\Soneta\aspnet-core\src\Soneta.Core\Soneta.Core.csproj] 0 Warning(s) 3 Error(s)

    Time Elapsed 00:00:18.16

  • User Avatar
    0
    maliming created
    Support Team

    Can you manually resolve these build error based on the error message first?

  • User Avatar
    0
    -bitman created

    I went ahead and recreated everything from scratch. If you are able to replicate this from a clean build and just try to create a simple entity that has a tenant and then remove it from tenancy after all the migration, you will encounter the issue. Hopefully something the tool can fix in the furture. Especially for the likes of me that would want to rely mostly on the tool for scaffolding and regeneration of the assets. Nonetheless, I appreciate your help maliming. You have a great RAD tool. I will continue to push forward with my project and report back any issues I may find.