sidewafflev2
sidewafflev2 copied to clipboard
Support for Item Templates
It would be nice to have the ability to create an extension for a template pack to add a specific item in existing project/folder. This could allow single or multiple files/items added to your project.
Scenario Steps:
- Create any new C#-type project (Class Library, Console, WPF, etc.). This shouldn't matter since the extension example will be a C#-type in this case.
- Once project is loaded in VS, right-click the project or any project folder in Solution Explorer.
- Click Add > New Item...
- In the Add New Item Dialog, navigate to your extension node (e.g. Demo.Console) under Visual C# Items.
- Select your extension item/file in the middle section. For example, you might have simple single file with default boilerplate code. This would also include your item icon next to item name and the description on right section.
- Name the item.
- Click Add.
- Item with boilerplate code is added to the project/folder that was selected in Solution Explorer (step 2).
We only have support for Project Templates currently. The wizard built by @mlorbetske and team I believe is limited to projects for now. I will discuss with him when I get back to the office on Wednesday.
The workaround for now is to add item templates via the normal .vstemplate approach. You may be able to use TemplateBuilder for the item templates but I've never tested that.
FYI I've updated the title of this issue
@sayedihashimi do you have any update on Item template support?
Item Templates may actually work, but I haven't had a chance to try it out. My understanding to get it to work needs:
- Set type = Item in template.json
- Set the type parameter to Item in .vstemplate
- Add an asset tag in .sourcemanifest to specify item templates can come from the Templates folder. (Copy and paste of existing asset for Project but change to Item)
Sounds good, I'll try it and get back to you.
@attilah did you have a chance to try it?
Hi @sayedihashimi, I have tried to create Item templates based on the tips you've given without success. Do you have a sample showing this ? Any update on Item template support ? Thank you