Open Closed

How to Create Projects from Custom Template #10060


User avatar
0
usama created

What I Want to Achieve

I want to create a custom ABP Commercial template that includes my own modifications (custom base classes, custom methods in existing classes, utilities, etc.) so that every time I create a new ABP project, it starts with my customizations already in place.

Example customization: I added a comment in YourProjectAppService.cs:

protected YourProjectAppService()
  {
      LocalizationResource = typeof(YourProjectResource);
      //this is a test app service comment  // <-- My custom addition
  }

What I Tried

Attempt 1: Using ~/.abp/templates directory

  1. Created a new project: abp new MyCustomTemplate -t app-pro
  2. Made my customizations to the generated files
  3. Zipped the solution as app-pro-9.2.0.zip
  4. Placed it in ~/.abp/templates/app-pro-9.2.0.zip
  5. Ran abp new TestProject -t app-pro Result: The custom template was not used. ABP used the standard template instead.

Attempt 2: Understanding the cache behavior I Ran abp clear-download-cache. This deleted all templates in ~/.abp/templates/, including my custom app-pro-9.2.0.zip Observation: The ~/.abp/templates directory is a managed cache that ABP controls, not a place for custom templates.

My Questions

  1. How can I use a custom template for project creation with the current ABP Studio CLI?
  • Is there a supported way to specify a custom template source directory? - Can I override the default template download behavior?
  1. What is the recommended approach for organizations that want to standardize project templates?
  2. Is there a difference between ABP CLI and ABP Studio CLI regarding template handling?
  • I'm using ABP Studio CLI (the current version) - Should I install the old ABP CLI separately for this feature?

Environment

  • ABP Version: 9.2.0
  • ABP License: Commercial
  • OS: macOS
  • CLI: ABP Studio CLI (current version, installed via dotnet tool install -g Volo.Abp.Studio.Cli)

1 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    1. Solution
    • Current status (ABP Studio CLI 9.2.x): There is no supported way to drop a custom ZIP into ~/.abp/templates or to point ABP Studio CLI to a custom template folder. That directory is a managed download cache and is overwritten by clear-download-cache and by template updates. Overriding the built-in template download behavior is not supported.

    • Recommended, supportable approaches to standardize your organization’s starting point:

      1. Create an Organization Base Solution once, and reuse it

        • Create a new solution with the official template that matches your target ABP/Commercial version (e.g., app-pro for Commercial).
        • Apply all organization-wide changes (base classes, conventions, utility code, settings, CI files, common modules/packages, theme defaults, etc.).
        • Store it in your internal Git repo as a seed project.
        • Workflow for new projects:
          • Clone the base solution as a new repo.
          • Rename namespaces, solution and project names with your own script or tooling.
          • Update Solution Configuration (if needed) and run migrations.
        • Pros: 100% control; survives upgrades; no reliance on CLI “custom templates.”
        • Notes: Keep the base solution synchronized with ABP version updates you plan to use in new projects.
      2. Package your reusable code into modules and NuGet/npm packages

        • Move base classes, common abstractions, shared UI pieces, and utilities into one or more internal ABP modules (backend NuGet packages and, if Angular, npm packages).
        • Start new projects from the official template and immediately add your internal modules via abp add-package / dotnet add package (and Angular equivalents).
        • Pros: Keeps startup templates standard and upgrades simpler; consistent reuse across solutions.
      3. ABP Suite/Studio automation (optional)

        • Use ABP Suite for repetitive CRUD scaffolding and conventions, and keep your customizations in modules and post-create scripts.
        • This does not replace a “custom template,” but reduces manual steps right after creation.
    • ABP CLI vs ABP Studio CLI regarding templates:

      • The legacy ABP CLI (Volo.Abp.Cli) historically supported template source configuration in some older docs, but the current ABP Studio CLI manages and downloads official templates by version. Using the old CLI alongside Studio is not recommended for creating Commercial solutions in 9.x. The Studio CLI is the supported path for project creation and will still not load user ZIPs from ~/.abp/templates.
      • Practical guidance: Do not install or rely on the legacy CLI to inject custom templates. Use the base-solution or reusable-module approaches above.
    • Answer to your specific attempts:

      • Placing app-pro-9.2.0.zip under ~/.abp/templates: Not supported; cache is controlled by the CLI and will be ignored/overwritten.
      • clear-download-cache: Correct observation; it confirms the folder is a managed cache, not an extension point.
    • Minimal example of an internal module approach

    [DependsOn(
          typeof(AbpIdentityApplicationModule) // and other dependencies your base module needs
      )]
      public class MyCompanyBaseApplicationModule : AbpModule
      {
          public override void ConfigureServices(ServiceConfigurationContext context)
          {
              // Configure organization-wide conventions, object mappers, settings, etc.
          }
      }
    

    Then in a newly created project:

    • Add a package reference to MyCompany.Base.Application (NuGet).
    • Add DependsOn(typeof(MyCompanyBaseApplicationModule)) to the Application module.
    • For UI (Angular), publish @myco/abp-ui packages and add them right after creation.
    1. Sources
    • ABP GitHub (general reference for official modules and template practices)
      • https://github.com/abpframework/abp
    • ABP Suite (commercial scaffolding, complements base-solution/module approach)
      • https://abp.io/docs/latest/abp-suite

    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.

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 November 04, 2025, 06:41