Project templates are zip files. A template requires a metadata file that can be loaded by the UI + the project file itself (if any) + any files referenced by the project file. In general all you need to do is create a basic project the way you want and then zip it up and add a metadata file describing the template as discussed here.
Note that if you have a project already open in VS then you can use export feature in VS. If you go to the Project menu then there is an option to export the project as a template. This zips up the files and generates the metadata for you.