Visual Studios 2012 Export Project Template with Files - c++

I can export a project to a template just fine, however, things are missing in the new project.
My goal is to create a template for code testing that requires some custom project/build/linking configurations. I found that I can preserve all these custom settings in an exported project. In addition to these settings is a directory that contains a .dll and .lib file. I have my paths set up as $(ProjectDir)\supp\tester.dll
-and-
$(ProjectDir)\supp\tester.lib
in their respective locations for linking.
The problem is that when I export the project as a template, and create a new project from the template, I am missing the tester.lib file in the supp directory. I even tried unzipping the template file and adding the tester.lib file back to SUPP, and rezipping it. I still cannot create a project from the template that includes the tester.lib file. Only the tester.dll file is created.
Do I have to set something up to tell VS to include this file in the template??
Thanks!

I got it working, although I am not sure if it was the most correct solution.
I had to export my project, unzip the resulting template, copying the tester.lib file to the unzipped file, and manually edit the templates .vstemplate file by adding:
<ProjectItem ReplaceParameters="false" TargetFileName="tester.lib">tester.lib</ProjectItem>
under the <Project><\Project> section. I then rezipped the files and put it in the Templates directory in the Visual Studios user area. Project I create with this template now include both the tester.dll and tester.lib files.

Related

How to replace the source file with my own source file (from download or edit) in Xcode?

I'm using Xcode as an IDLE editor of C language. I downloaded an SDK package from a algorithm competition website and compiled it successfully on the terminal, but now I have a need to compile and run the source .cpp file(that inside the SDK packadge) directly by Xcode, so:
Is there a way to replace the CPP source file of command-line-tools project with the CPP source file that I specify the path of it?
Or is there a way to creat a new command-line-tools project from the specified path CPP source file?
I've now Solved this problem through the method one whitch says "Is there a way to replace the CPP source file of command-line-tools project with the CPP source file that I specify the path of it?", but still have no idea about method two.
Just creat a symbolink of CPP source file and right-click the project, add the alias to project. Because the "add" is copy in fact, instead of "import" or "open". Only by copying the alias can the purpose of modifying the source file be achieved.

VS2015 Express & VS2017: Document cannot be opened: It has renamed, deleted or moved

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?
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.

Can't find location project for template file

When I specify a different project form the main file it can't find it and the generation process fails. Does Resharper expect a separate project to be in the folder as the original project? My project 'DataAccess' is in a different folder.
The following works find if I remove "DataAccess".
Else it creates the other files, but doesn't fill them in, and gives the following error...

Changing Visual Studio default path for .cpp, .h file

I would like Visual Studio to automatically put my .h file in a folder /ProjectPath/include and my src file in /ProjectPath/src. That way, if I use the "Create class wizard" for instance, it would put the good path by default without me having to change the folder. Anyone know what setting I should change to get this behaviour when I add file ?
Thanks,
Jean-Philippe
You can right click on a folder in solution explorer and go to properties, you need to set the Filter property.
For example the Source Files folder by default has a filter like this in a C++ project: cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx

VS2010 - Add template to New Project window

I am trying to add a new project template for an often used pattern. Starting from the class library template I have done the following (it still does not show up in the new project window):
opened the .vstemplate file
changed name and description to 'hard coded' values (my template). The values in there pulled from the csharpui.dll resources.
changed the TemplateID, DefaultName, and ProjectItems included.
saved these to the ProjectemplatesCache folder and as a zip in the ProjectTemplates folder.
restarted VS2010 and checked the new project location which should have shown my new template.
specifically, the folders I saved to were..
C:\program files\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache\CSharp\Windows\1033\HostComm.zip (the zip is the folder name, not a zip file)
and
C:\program files\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\CSharp\Windows\1033 (this folder has a HostComm.zip file in it)
Has anyone else done this? Can it be done? If it can then what did I miss?
Doing this by hand is pretty courageous. Having a folder name with an extension .zip sounds wrong, I don't see a similar one in the existing templates. Watch out for the shell's habit of turning .zip archives into folders.
Best thing to do is to use the documented procedure to create a project template and verify what effects it has so you can repro them accurately yourself. Create a new project, using one of the existing templates as a starter. You might as well make it look as close as possible to the ultimate template you want to end up with, add project items as desired.
Then use File + Export Template. Next. Fill in the text boxes, note the Output location. Finish. Have a look-see at the generated .zip file.