Creating a template that relates to the PHP language

валера карманов 101 Reputation points
2024-05-07T13:00:06.3+00:00

Tell me how to create a project template for the PHP language. Should the project template be in a zip file or can it be created on the fly?

Visual Studio Extensions
Visual Studio Extensions
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Extensions: A program or program module that adds functionality to or extends the effectiveness of a program.
178 questions
0 comments No comments
{count} votes

Accepted answer
  1. Michael Taylor 49,166 Reputation points
    2024-05-07T14:58:44.93+00:00

    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.


1 additional answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 26,561 Reputation points Microsoft Vendor
    2024-05-08T10:07:11.9966667+00:00

    Hello, if you use the Export Template Wizard feature in VS, the project template is exported into a .zip file and placed in the specified output location (%USERPROFILE%\Documents\Visual Studio <version>\My Exported Templates). 

    If you did not select the option Automatically import the template into Visual Studio in the Export Template Wizard, you need to place the .zip file in the following directory: %USERPROFILE%\Documents\Visual Studio <version>\Templates\ProjectTemplates to make it available in the VS New Project window. 

    You can edit the .vstemplate XML file and add language tag for PHP project template:

    <LanguageTag> Language Name </LanguageTag>

    For more details, please refer to: Add tags to project templates.