共用方式為


How to: Troubleshoot templates

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

If a template fails to load in the development environment, there are several ways to locate the problem.

Validate the vstemplate file

If the vstemplate file in a template doesn't adhere to the Visual Studio template schema, the template may not appear in the New Project dialog box.

To validate the vstemplate file

  1. Locate the .zip file that contains the template.

  2. Extract the .zip file.

  3. On the File menu in Visual Studio, choose Open > File.

  4. Select the vstemplate file for the template, and choose Open.

  5. Verify that the XML of the vstemplate file adheres to the template schema. For more information on the vstemplate schema, see Template schema reference.

    Note

    To get IntelliSense support while authoring the vstemplate file, add a xmlns attribute to the VSTemplate element, and assign it a value of http://schemas.microsoft.com/developer/vstemplate/2005.

  6. Save and close the vstemplate file.

  7. Select the files included in your template, right-click, and choose Send to > Compressed (zipped) folder. The files that you selected are compressed into a .zip file.

  8. Place the new .zip file in the same directory as the old .zip file.

  9. Delete the extracted template files and the old template .zip file.

Enable diagnostic logging

You can enable diagnostic logging for template discovery by following the steps in Troubleshoot template discovery (extensibility).

See also