sidewafflev2 icon indicating copy to clipboard operation
sidewafflev2 copied to clipboard

Support for Item Templates

Open shaggygi opened this issue 8 years ago • 8 comments
trafficstars

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:

  1. 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.
  2. Once project is loaded in VS, right-click the project or any project folder in Solution Explorer.
  3. Click Add > New Item...
  4. In the Add New Item Dialog, navigate to your extension node (e.g. Demo.Console) under Visual C# Items.
  5. 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.
  6. Name the item.
  7. Click Add.
  8. Item with boilerplate code is added to the project/folder that was selected in Solution Explorer (step 2).

shaggygi avatar Aug 21 '17 16:08 shaggygi

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.

sayedihashimi avatar Aug 21 '17 20:08 sayedihashimi

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.

sayedihashimi avatar Aug 21 '17 20:08 sayedihashimi

FYI I've updated the title of this issue

sayedihashimi avatar Sep 08 '17 18:09 sayedihashimi

@sayedihashimi do you have any update on Item template support?

attilah avatar Oct 19 '17 17:10 attilah

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)

sayedihashimi avatar Oct 20 '17 17:10 sayedihashimi

Sounds good, I'll try it and get back to you.

attilah avatar Oct 20 '17 17:10 attilah

@attilah did you have a chance to try it?

sayedihashimi avatar Nov 28 '17 18:11 sayedihashimi

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

vtherry avatar Jul 03 '18 12:07 vtherry