2

Hey I know people have started forums already concerning this problem.

I'm trying to create a SFML project template in VS2015 Express (I've also tried it in VS2017). I've followed many guides and answers to this problem on here, MSDN forums and others.

No matter what I try, the project template cannot open up my source and header files from the original project I created the template from. "Document cannot be opened: It has renamed, deleted or moved."

I'm working with/on: Win10 PC; 64-bit VS Express 2015 for Windows Desktop; v. 14.0.25431.01 Update 3 VS 2017; v. 15.3.5 (rather use VSE 2015 though)

What I've tried: - Opening the MyTemplate.vstemplate file in texteditor, adding true in TemplateData;

  • adding: filename.cpp or filename.h, replacing the filename with the .cpp and .h filenames in the TemplateContent section

  • unchecked Automatically import template when exporting template

  • unzipping, adding source files, rezipping and placing zip file in Templates\Project Templates zipped and unzipped

  • adding new mentioned zip file above (with source files inc.) into My Exported Templates folder

  • haven't deleted Properties folder in MyTemplate.vstemplate bc I couldn't find a file there?

I've been at my desk for around 3 hours and have hit my first roadblock, I don't know what to do. Please assist, guys.

EDIT: Found the problem; although the original .cpp and .h files aren't being added into the exported template.

When I create a new project using my custom template, the source files (from the original project used to create the template) are not automatically added into the new project's files. So I have to manually copy the files from my original project to the new project's folder.

Any way to have the original source files added into the new project's files so I don't have to this manually every time?

1 Answers1

0

I know this is pretty old but I'm going through the same thing and it was driving me crazy. So I figured out how to edit the project template to make it work.

I used Winrar, but I'm sure there's a bit simpler approach but here it goes:

I went to C:\Users\MyName\Documents\Visual Studio 2015\Templates\ProjectTemplates

and opened my SFML template with winrar. I then copied all of my .h and .cpp files from the original project into the template. I did this with another instance of winrar by dragging and dropping the files.

Then, I edited the MyTemplate.vstemplate file. I added a new "ProjectItem"Line by copying and pasting one of the ones already there. For example:

  <ProjectItem ReplaceParameters="false" TargetFileName="ReadMe.txt">ReadMe.txt</ProjectItem>

This was an original line and I copied it and edited it to match one of the files I added. For example, I changed ReadMe.txt to SFML.cpp in a new line.

I did this for all of the new files, saved it and then it worked!

Let it be noted that I did not extract the template .zip at any point.