Skip to content
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

Support for Item Templates #4

Open
shaggygi opened this issue Aug 21, 2017 · 8 comments
Open

Support for Item Templates #4

shaggygi opened this issue Aug 21, 2017 · 8 comments

Comments

@shaggygi
Copy link
Contributor

shaggygi commented Aug 21, 2017

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).
@sayedihashimi
Copy link
Member

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
Copy link
Member

sayedihashimi commented Aug 21, 2017

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 sayedihashimi changed the title Create Item with Boilerplate Code Extension for Project Support for Item Templates Sep 8, 2017
@sayedihashimi
Copy link
Member

FYI I've updated the title of this issue

@attilah
Copy link

attilah commented Oct 19, 2017

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

@sayedihashimi
Copy link
Member

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)

@attilah
Copy link

attilah commented Oct 20, 2017

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

@sayedihashimi
Copy link
Member

@attilah did you have a chance to try it?

@vtherry
Copy link

vtherry commented Jul 3, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants