Thursday, April 2, 2026

Project templates in Visual Studio 2022

After configuring C and C++ projects countless times, base on these settings, I finally bit the bullet and created a reusable template in Visual Studio 2022. And it’s surprisingly simple: create the project and then go Project → Export Template.

The project name itself can be used inside files with $safeprojectname$ string. In order to have it replaced even inside .rc files, edit the .vstemplate and add:

<TemplateContent>
  <Project TargetFileName="ayylmao.vcxproj" File="ayylmao.vcxproj" ReplaceParameters="true">
    <ProjectItem ReplaceParameters="true">RES\$safeprojectname$.rc</ProjectItem>
  </Project>
</TemplateContent>

There’s no GUI for deleting a template, though. One must manually remove the zip files from two different locations:

  • Documents \ My Exported Templates
  • Documents \ Templates \ Project Templates

To restore a template, simply copy the zip back to:

  • Documents \ Templates \ Project Templates