Skip to content

Ycode/improve cs template error #4384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

y-code
Copy link

@y-code y-code commented Apr 20, 2025

The template list provided by func templates list confused me when I used the template names with func function new --template command because neither of them worked. After looking into the tool's code, I learnt they can be used only within in-process model Functions projects, and we need to specify the --csx option. I also learnt that the tool uses dotnet new templates for the newer C# templates although the func templates list command does list the templates from dotnet new.

As the tool has complexity due to the two template management systems behind the scenes, it should be more self-explanatory and provide clear guidance to users.

This PR adds notes to the tool's outputs, assuming that the most recommended approach is to start simply with func function new without specifying the --template option. There are no functional changes.

It should effectively resolve #2955

Changes

Command 'func templates list'

The command will have two lines of notes under the C# template list.

(Use the templates above with 'func function new ls--csx --template' command within in-process model projects.)
(More templates are available for C#. To list those run 'func funciton new' command without '--template'.)

Command 'func function new --template' with Template Name from 'func templates list'

The command will output the error message:

Template 'Azure Cosmos DB trigger' is for C# script in in-process model. Retry with --csx option to use the template. Or, retry without --template option to see available templates.

Command 'func function new --template' with Invalid Template Name

The command will output the error message:

Unknown template 'AzureDBtrigger'. Retry without --template option to see available templates.

Pull request checklist

  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • I have added all required tests (Unit tests, E2E tests)

@y-code y-code requested a review from a team as a code owner April 20, 2025 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Command func templates list returns invalid templates
1 participant