Starts in:
2 DAYS
0 HR
36 MIN
23 SEC
Starts in:
2 D
0 H
36 M
23 S
Open Closed

Missing --template-source parameter when creating a module using abp add-module command #2225


User avatar
0
Radoslav created

I want to have a total control over what my startup templates (app and module) migh look, so I can make my own changes to abp provided templates. For example I can successfully create a new application where I explicitly have app-4.4.4.zip inside D:/AbpStartupTemplates/rel-4.4/templates/app (with my change). Let's say I have a readme.file inside that Zipfile in asp.net-core folder.

abp correctly picks my local templated packaged in app-4.4.4.zip file: abp new Acme.Bookstore --template app --create-solution-folder true --ui mvc --tiered true --mobile none --dbms SqlServer --database-provider ef --connection-string Server=localhost;Database=AcmeBookstore;Trusted_Connection=True --no-random-port true --template-source D:/AbpStartupTemplates/rel-4.4/templates/app --version 4.4.4 --local-framework-ref --abp-path D:/abpdev --preview false

It seems that the add-module command doesn't have that option to select custom local --template-source argument. It is ignored. D:\TestApps\Ravco.Rstate> abp add-module Acme.Bookstore.Author --new --version 4.4.4 --template-source "D:/AbpStartupTemplates/rel-4.4/templates/module

I think that this is missing feature as it is needed to allow local template for module which might be modified from the original.

[06:06:45 INF] Creating your project... [06:06:45 INF] Project name: Acme.Bookstore. [06:06:45 INF] Template: module [06:06:45 INF] Version: 4.4.4 [06:06:45 INF] Output folder: D:\TestApps\Acme.Bookstore\modules\Acme.Bookstore.Author [06:06:46 INF] Using cached template: module, version: 4.4.4 [06:06:49 INF] Check out the documents at https://docs.abp.io/en/abp/latest/Startup-Templates/Module [06:06:50 INF] 'Acme.Bookstore.Author' has been successfully created to 'D:\TestApps\Acme.Bookstore\modules\Acme.Bookstore.Author'

  • ABP Framework version: v4..4.4
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

5 Answer(s)
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Hi @Radoslav

    You're right, we can't support custom source while adding module right now.

    We're working some amazing feature that solves that problem but it'll take a little bit more time and won't be shipped with v5.0

  • User Avatar
    0
    Radoslav created

    @enisn,

    I really expected this flag to be part of add-module command.
    What can I do in the meantime. I can certainly change a cached version of the zip. What feature are you planning?

    I noticed that add-modules adds its own common.props file per module on the solution level that each project uses. I expected these projects to use a common common.props on applicaton level which is ../../../.. away from module projects. I didn't see how to automate deploymnet for SaaS application based on abp.io and automated billing for resources used.

    Rad

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    I can't provide a way that works perfectly in any situation. Each module has different parts and extensions (maybe), the current version of CLI cant guarantee your module will be installed properly if you replace the cache, but it's a way to try.


    For the current version (v5.0), the best way to install module is manual installation. Adding dependencies to .csproj files and [DependsOn(typeof(...))] attribute over module class manually is the most consistent way.

  • User Avatar
    0
    Radoslav created

    I can't provide a way that works perfectly in any situation. Each module has different parts and extensions (maybe), the current version of CLI cant guarantee your module will be installed properly if you replace the cache, but it's a way to try.


    For the current version (v5.0), the best way to install module is manual installation. Adding dependencies to .csproj files and [DepensOn(typeof(...))] attribute over module class manually is the most consistent way.

    @enisn Can you please explain the steps. I hardly understood what you said. I am new to abp.io framework. How to manually install a module? From where? There are 2 ways to install a module? Which way is appropriate for what? abp add-module abp new -t module Also there is a way to install a module using abp.io suite. How is that different from these 2 above.

    I really think that apb.io should provide a template for microservices in community based abp.io version

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    You need to add project references first.

    Same project layers should be referenced by same project layer. For example:

    • YourApp.Domain -> YourModule.Domain

    • YourApp.Domain.Shared -> YourModule.Domain.Shared

    • YourApp.Application -> YourModule.Application

    • YourApp.Application.Contracts -> YourModule.Application.Contracts

    • YourApp.HttpApi -> YourModule.HttpApi

    • YourApp.HttpApi.Client -> YourModule.HttpApi.Client

    • YourApp.Web -> YourModule.Web

    ...

    To do that operation, go to your .csproj file, for example YourApp.Domain.csproj and add following reference:

      <ItemGroup>
      
        ...
      
        <!-- Place correct path to your module -->
        <ProjectReference Include="..\..\modules\YourModule.Domain\YourModule.Domain.csproj" />
      <ItemGroup>
    

    Then you should add the DependsOn attribute over your YourAppDomainModule class:

    [DependsOn(typeof(YourModuleDomainModule))] // <-- Add this line.
    public class YourAppDomainModule : AbpModule
    {
        // ...
    }
    

    And make this step for each layer.

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