Aspirerelease/17.0
Watch Aspire live streamsDocumentazioneProva Aspire

aspire template source command

Questi contenuti non sono ancora disponibili nella tua lingua.

aspire template source - Manage global template sources.

Aspire CLI
aspire template source [command] [options]

The aspire template source command manages global template sources. A template source is a named location that contains templates: either a Git repository or an absolute local directory. Sources are stored in the global Aspire configuration, so they apply to every project on the machine.

When at least one source is configured, the interactive aspire new template picker lists templates from each source alongside the built-in templates. If a configured source can’t be read when aspire new discovers templates, the command warns about that source and continues with the others.

Template sources require the aspire.config.json configuration format. If your global configuration still uses the legacy format, these commands fail and direct you to run aspire config info to migrate it.

In the aspire new picker, each source’s templates are grouped under a heading that defaults to the source name. To show a friendlier heading, set the optional displayName key for the source:

Aspire CLI
aspire config set templateSources.company.displayName "Company templates" --global

The source name remains the source’s identity, so sources with identical display names aren’t merged. An empty or whitespace-only displayName falls back to the source name.

Template authors can show a project-derived value as the default in an aspire new prompt. In the template’s .template.config/aspirecli.host.json file (or dotnetcli.host.json if the Aspire-specific file doesn’t exist), set defaultValueSource on an optional string parameter to the name of the coalesce symbol that consumes it:

.template.config/aspirecli.host.json
{
"symbolInfo": {
"displayName": { "defaultValueSource": "displayNameValue" }
}
}
.template.config/template.json (symbols)
{
"displayName": { "type": "parameter", "datatype": "string", "defaultValue": "" },
"displayNameValue": {
"type": "generated",
"generator": "coalesce",
"parameters": { "sourceVariableName": "displayName", "fallbackVariableName": "name" },
"replaces": "DISPLAY_NAME"
}
}

With this configuration, the displayName prompt shows the project name as its default. The parameter must have an empty default, and its fallback can depend only on the project name through regex and coalesce symbols. Otherwise, aspire new reports an invalid prompt default.

The following options are available:

  • -?, -h, --help

    Prints help and usage documentation for the available commands and options.

  • -l, --log-level <Critical|Debug|Error|Information|None|Trace|Warning>

    Set the minimum log level for console output. Use this option to increase diagnostics while troubleshooting or reduce output in scripted runs.

  • --non-interactive

    Run the command in non-interactive mode, disabling all interactive prompts and spinners.

  • --nologo

    Suppress the startup banner and telemetry notice.

  • --banner

    Display the animated Aspire CLI welcome banner.

  • --wait-for-debugger

    Wait for a debugger to attach before running a command.

The following commands are available:

CommandFunction
aspire template source add <name>Add a named template source after confirming you trust it.
aspire template source listList the configured template sources.
aspire template source remove <name>Remove a named template source.
  • Add a template source from a Git repository:

    Aspire CLI
    aspire template source add company --repository https://github.com/example/templates
  • List the configured template sources:

    Aspire CLI
    aspire template source list
  • Remove a template source:

    Aspire CLI
    aspire template source remove company