sayedihashimi / template-sample

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Q] Is there a way of converting .vstemplate files?

ivanpovazan opened this issue · comments

I was wondering is there a way to generate template.json from an existing .vstemplate file?
And if there isn't, what would be the preferred approach of upgrading them?

To provide you with more context:
We have a Visual Studio extension which provides custom project templates targeting .NET framework which need to be extended/upgraded to target .NET core as well.

Hi @ivanpovazan there isn't any way to convert from a vstemplate template to a Template Engine (dotnet new) style template. I think the easiest thing to do is to create a new project from your template, and then add the .template.config folder along with template.json and other files that you need.

You could consider creating replacements for vstemplate tokens like $ROOTNAMESPACE$, but I would advise against that. Ideally strings that are being replaced have the following:

  • upper case letters
  • lower case letters
  • special characters

The reason being is that the Template Engine needs to know how to do replacements when a variety of characters are present. To give you a full explanation would take a long time and I don't think we have a doc for it.

Thank you for the answer!