Open Closed

abp cli app template creation did not turn SaaS off #10204


User avatar
0
abmag created

Used abp cli to create mvc app with SaaS turned off.

Expected: SaaS and Multi-tenant turned off

Observed: SaaS tables were present in the database, Multi-tenant feature was turned on

To reproduce see:

https://github.com/magentuseu/abp-tests


3 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    1. Solution
    • In ABP v10.x, the “SaaS” module and Multi-tenancy are controlled by two different things:

      • SaaS module presence (adds Saas* tables) depends on whether the template includes Volo.Saas.* packages and calls builder.ConfigureSaas() in your DbContext mapping. If included, SaaS tables will be created regardless of MultiTenancy being enabled or not.
      • Multi-tenancy behavior (tenant filter, tenant resolution, etc.) is controlled by AbpMultiTenancyOptions.IsEnabled or the MultiTenancyConsts.IsEnabled flag in the template.
    • What happened in your case:

      • Creating an MVC app “with SaaS turned off” using CLI disables multi-tenancy (so the app behaves as single-tenant), but if the selected template variant still references SaaS module packages, migrations will create SaaS tables anyway. This is expected if the solution includes SaaS module; turning multi-tenancy off does not automatically remove SaaS module or its tables.
    • How to create a solution with both SaaS and Multi-tenancy off (no SaaS tables, no multi-tenant behavior):

      1. Generate the project without SaaS module:
        • Use a template/option that doesn’t include SaaS. In ABP CLI, select the “without SaaS” option during creation. If you already created the solution and SaaS came in, remove it:
          • Remove Volo.Saas.* package references from:
            • Your .Domain, .Application, .EntityFrameworkCore, .HttpApi, .HttpApi.Host (and .Web) projects.
          • Remove module dependencies:
            • Delete [DependsOn(typeof(AbpSaas…))] lines from your module classes.
          • Remove EF Core mappings:
            • In your DbContext(s), delete builder.ConfigureSaas(); calls.
          • Remove SaaS UI/menu/permissions if present.
          • Delete SaaS migrations or add a new clean migration after removing mappings.
      2. Ensure multi-tenancy is disabled:
        • In your Domain.Shared project’s MultiTenancyConsts.cs: public static bool IsEnabled = false;
        • Or in configuration: Configure<AbpMultiTenancyOptions>(options => options.IsEnabled = false);
      3. Regenerate migrations and database:
        • Delete existing migrations that include Saas* tables (and the database if it was created).
        • Add a new initial migration and update the database. Now no Saas* tables will be created and the application will run as single-tenant.
    • Notes for v10.1 MVC template:

      • If you want single-tenant and no SaaS, the safest path is to create a template variant that doesn’t include SaaS at all. If SaaS is included by mistake, removing the packages + mappings and re-creating migrations is sufficient.
      • Disabling multi-tenancy alone will not remove SaaS tables if the SaaS module is referenced.
    1. Sources
    • https://docs.abp.io/en/abp/latest/CLI
    • https://abp.io/docs/latest/framework/architecture/multi-tenancy
    • https://github.com/magentuseu/abp-tests

    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    abmag created

    The "-no-saas" arg has been used. Still, SaaS assemblies and tables were present.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you try to use --no-multi-tenancy for abp new command?

    Thanks.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on December 10, 2025, 12:02
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.