Reputation: 672
I have tried to create a custom project template for Visual Studio Community 2017 for c++. I have exported the project as a template, however when I try to access the files I added in a new project, they are not created in the project folder. I can try to open them in the Solution Explorer, but the files themselves are not being created. I have tried to add <CreateinPlace>true</CreateInPlace>
as well as adding the .zip files to the VS template directory, but these had no effect. How would I be able to add the files to the template and get them to show up in a new project?
Upvotes: 1
Views: 223
Reputation: 672
What it actually was is that the .vstemplate
wasn't adding the files as project items, so when I exported the project, it didn't know to look for them.
To fix it I just added
<TemplateContent>
<Project TargetFileName="CS235-Template.vcxproj" File="CS235-Template.vcxproj" ReplaceParameters="true">
<ProjectItem ReplaceParameters="false" TargetFileName="$projectname$.vcxproj.filters">CS235-Template.vcxproj.filters</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="main.cpp">main.cpp</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="Debug.h">Debug.h</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="input.txt">input.txt</ProjectItem>
</Project>
</TemplateContent>
After doing this they worked just fine.
Upvotes: 1
Reputation: 723
Visual Studio stores the template in 3 different locations. The folder that VS tells you is only one of the 3 options. I finally modified the .vstemplate
file in:
Libraries\Documents\Visual Studio 2017\Templates\ProjectTemplates
Right-Click->Extract All
).vstemplate
file<CreateInPlace>true</CreateInPlace>
to the <TemplateData>
sectionThe following answer is a little off topic but it's the one that helped me solve the problem. [Answer][https://stackoverflow.com/a/48274550/4892466]
Upvotes: 0