When I use the Project -> Export template
option in Visual Studio 2017, the resulting ZIP file includes the main project files, but not any of the *.cp
The problem is in your .vstemplate
file. What you need to do is edit it so that VS knows that there is supposed to be additional files. Unzip the file that was exported, add the files you want, then open the .vstemplate
file. The part of the .vstemplate
you should change is between the <TemplateContent>
tags:
<TemplateContent>
<Project TargetFileName="project.vcxproj" File="project.vcxproj" ReplaceParameters="true">
<ProjectItem ReplaceParameters="false" TargetFileName="$projectname$.vcxproj.filters">project.vcxproj.filters</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="file1.cpp">file1.cpp</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="file2.h">file2.h</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="input.txt">input.txt</ProjectItem>
</Project>
</TemplateContent>
This tells VS to add the files file1.cpp
, file2.h
and input.txt
to the project when you make it. Just change the names to the files you want, save everything and rezip the folder.
yeah, I just put the source within it, ...I've had luck exporting code from github because it contains multiple projects... It's this stupid thing ... under Project Dependencies "The Project Dependencies option is only available in a solution with more than one project" so I have no option to select the source. ...they made it like this on purpose but I don't know why.
You need to manually edit the .vstemplate file and add <CreateInPlace>true</CreateInPlace>
in the <TemplateData>
tag so it looks like this:
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
<TemplateData>
<Name>TemplateTest</Name>
<Description><No description available></Description>
<ProjectType>JavaScript</ProjectType>
<ProjectSubType>
</ProjectSubType>
<SortOrder>1000</SortOrder>
<CreateNewFolder>true</CreateNewFolder>
<CreateInPlace>true</CreateInPlace>
<DefaultName>CodovaTemplateTest</DefaultName>
<ProvideDefaultName>true</ProvideDefaultName>
<LocationField>Enabled</LocationField>
<EnableLocationBrowseButton>true</EnableLocationBrowseButton>
<Icon>__TemplateIcon.ico</Icon>
</TemplateData>