-
Notifications
You must be signed in to change notification settings - Fork 6k
added sourceName info: create-item & project tuts #36708
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
Conversation
@adegeo Please review. |
Thank you for this submission! I've added a few corrections and suggestions. I think the item template article doesn't need this at all. |
Co-authored-by: Andy (Steve) De George <67293991+adegeo@users.noreply.github.com>
The sourceName doesn't just work with the project templates it is also used for items as well. So that the namespace and class file name is set based on user input |
The namespace must be |
Actually, I was just playing around with this and I don't think it makes sense for the item template. If the user doesn't provide a name, the class name and file name both get created with the same name as the folder. That isn't really a good experience. For the project template, this value makes 100% sense. But not in the item template. Really this needs an optional variable that you could pass into the template. |
OK I looked it up and figured out how to do optional template parameters. It's a big more complicated and requires some more explanation in the article. I actually happen to be working on updating these articles this week (with more modern C# code and other little fixes). If you would like, I can add that stuff to my rewrites. We could just remove the item template content from this PR and push through the project template updates. How does that sound? Or you could update the article too 😁 Let me know what you want to do. The code for the template is: {
"$schema": "http://json.schemastore.org/template",
"author": "Me",
"classifications": [ "Common", "Code" ],
"identity": "ExampleTemplate.StringExtensions",
"name": "Example templates: string extensions",
"shortName": "stringext",
"tags": {
"language": "C#",
"type": "item"
},
"symbols": {
"ClassName":{
"type": "parameter",
"description": "The name of the code file and class.",
"datatype": "text",
"replaces": "StringExtensions",
"fileRename": "StringExtensions",
"defaultValue": "StringExtensions"
}
}
} And you'll need to explain that section. You can see what parameters are allowed with the following command:
|
@adegeo Thank you for the feedback. I have modified the explanation of the create-item-template to match the information you have provided. I figured we should both item and project template files in this PR to avoid having multiple PRs for only 2 files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again!
* added sourceName info: create-item & project tuts * Update docs/core/tutorials/cli-templates-create-project-template.md Co-authored-by: Andy (Steve) De George <67293991+adegeo@users.noreply.github.com> * Updated cli-templates-create-item-template.md * Updated cli-temlates-create-item-template.md * updated create-item-template to have ClassName optional --------- Co-authored-by: Andy (Steve) De George <67293991+adegeo@users.noreply.github.com>
Summary
Added sourceName information to the create-item and create-project cli tutorials as it is an essential property when creating dotnet cli templates
Internal previews