Visual Studio 2013 export Property Sheets to Template - c++

I am Creating a C++ Project template and using the export template wizard to do it.
I had added a custom property sheet to my template project (the one which am going to export)
on successfully exporting my project template I created a new project using the template, but the project fails to load saying that it can't find the property sheet (it mentions the project directory path and says no such file exists).
I know the same question has been asked before : Exporting .props files in project template VS2012/13
But it has no answer for a year
I even tried including the property sheet as part of the project before exporting. still the same error
Please Help!
Edit:
I even tried manually putting the .props file into the zip archive it still shows the same error.
I think the new project gets loaded before the .props file gets added to the new project directory.
Note : Manually putting the .props file into the new project directory and then reloading the project works. but I don't want to copy paste it every time I create a new project from the template.

Related

How to create "Multi Project Template With Custom Wizard" in Visual Studio 2017

I'm looking for help on making a multi project template (i.e. a deploy-able solution that contains multiple projects) with a custom wizard (to enable custom parameters to be entered).
I've followed "How to: Create Multi-Project Templates" to make the multi project template. This is working.
I've followed "How to: Use Wizards with Project Templates" to make my wizard in my VSIX files. This is working.
However, I can't get them to work together. I can either deploy my multi project template without a wizard OR I can get all of my individual project templates to show in the project gallery, via my VSIX file, with a working custom wizard.
Any ideas on how to combine the two methods?
I was able to adopt an answer from this blog.
The key is to package all of your exported projects (which come in ZIP which you have to extract) and your root .vstemplate file into a ZIP. This ZIP then needs to be an imported project template in your VSIX project.
Lastly, your wizard needs to be its own separate project you can reference in any of your individual project templates or in your VSIX. I had my wizard being created in my VSIX which just didn't seem to work.
As stated by Dan, you need to have your multi-project templates in a zip file.
However, you do not need to have the wizard code in a separate project, you can have it all in your VSIX project.
I your VSIX project, to add a reference to your .zip file, open your source.extension.vsixmanifest designer -> Assets -> New -> Select type Project Template and Source 'File on filesystem' and select your zip file.
Make sure to also add your VSIX project as Assembly if you haven't already: New -> Select type Assembly and Source 'a project in current solution' and select your VSIX project. (This is probably why it didn't work for Dan)
In your multi-template.vstemplate file you need to add a reference to the VSIX dll as described in "How to: Use Wizards with Project Templates" using <WizardExtension>
In addition you can also add a <CustomParameters> section inside <TemplateContent> if you want to set up default custom parameter values. See here for more info: "The registration elements for customizing the template wizard"
Example:
<CustomParameters>
<CustomParameter Name="$mycustomparameter1$" Value="value1"/>
<CustomParameter Name="$mycustomparameter2$" Value="value2"/>
</CustomParameters>

VS2017 multi project template with shared projects

I created a multi project template for use with VS2017, including a console application and two shared projects. I can see the template showing up, but whenever I try using it to create a new project I get an error stating that the "projitems"-file of the first shared project was not found in the path \AppData\Local\Temp\<seemingly randomly generated name>\<SharedProjectName>\<SharedProjectName>.projitems. After I dismiss the error the solution is still created, but only the shared projects are in there.
The situation is reproducable by using this template I uploaded to my OneDrive:
https://1drv.ms/u/s!At78FKXjEGEoh7F-vo5XppZBOImatA
And I created the template using this simple solution:
https://1drv.ms/u/s!At78FKXjEGEoh7F_QkSugfzie8I0mg
What I did is:
Exported each of the projects individually using "Project" -> "Export Template...".
Extracted the exported ZIP files to represent the desired folder structure. Each project got its own folder as you can see in the project template ZIP file.
Created a "vstemplate"-file with the help of MSDN, and included the three project files with their relevant paths.
Zipped the three folders and the new "vstemplate"-file up and moved it to the Visual Studio templates folder (Documents\Visual Studio 2017\Templates\ProjectTemplates\Visual C#).
What did I do wrong?

vsix multi template project creates an extra folder

I am trying to create a multi project template (.vsix) file. One of the projects has a reference to two nuget packages. Everything works fine except for the part where the project itself gets created. It creates an additional folder under the root folder. So if I call my project "Prj1" it will create the sub projects under Prj1 -> Prj1 -> Sub Projects. I dont want it to do this, and as a result of this the package references and everything does not work. I tried searching the web for a solution and all I found is this
Issue with visual studio template & directory creation
But here also I am not sure if this solves the problem based on the comments. Is there any standard fix for this?

Visual Studio 2010, error when including headers from another folder within the same solution space

I am new to Visual Studio 10 c++, I imported a sample project, the project came with multiple folders in the same solution space project, each with files in it, including any of those files in any other file within any of the project worked perfectly then I added another filter to the project, it worked fine but the files in it can not be included in any of the original project files, is there anything am missing out? I followed these instructions when creating the folder
Right Click project
Click Add
Select New Filter
change Filter Name
Right Click Filter
Add
Select Class
And could someone tell me how to make the Filters and file in them visible in explore, the Sample project came with Visible Filters/Folders so there has to be a way of making them visible in explore and VS, here are Images showing what I mean, in the project I have the laneDetector filter which does not exist in project folder
Showing My VS project layout with LaneDetector filter/folder visible
Showing My VS project in explore with no LaneDetector filter/folder

How to create a folder in Visual Studio C++ 2012

I have started my first bigger project with Visual Studio 2012 in C++. I will structure my Source-files in folders, but I can not find where I can create real folders, like in the windows explorer. So here is my question.
How can I create real folders in my project?
The IDE has a command for that, "New Folder". It is even present in the Project + Add context menu, something you can see when you look at the context menu with Tools + Customize. It is however hidden in the C++ IDE. Intentionally.
Its important to understand why it is hidden. It keeps you out of trouble, the kind of trouble you'll get into when you create folders with Explorer.
At issue is the way C++ files get built. They produce an .obj file when the compiler is done with them. That obj file is stored in a directory whose name is a project setting. You see it with Project + Properties, General, Intermediate Directory setting. For an individual .cpp file, it is C/C++, Output Files, Object File Name. The default for that one is $(IntDir) a macro that tells the compiler to use the Intermediate Directory setting. With the default settings, all .obj files for the Debug build end up in the Debug subdirectory. Release subdirectory for the Release build. Regardless where the .cpp was stored.
Maybe you see the bear trap by now. If you create a subdirectory with .cpp files then you'll get in trouble when that subdirectory has a .cpp file whose name is identical to another .cpp file in another subdirectory. They produce an .obj file with the same name. One overwrites the other, which ever one was compiled last. That produces very mystifying linker errors. You'll get duplicate symbol errors because the last built .obj file is linked twice and missing symbol errors for the overwritten .obj file.
So go ahead and create a subdirectory but beware this problem. You have to change the Object File Name setting for the .cpp file if such a collision happens.
This is mildly annoying, however, here is what can be done:
Create the new folder in Visual Studio. This does not create a new folder in the file system. Add a new item to the folder. Choose the proper directory for the item.
For example, if your project is at %Documents%\Project, and your new folder name is Folder, then you add a new item to that folder at %Documents%\Project\Folder.
Visual Studio 2012 will put the item in the folder where you want it. If you add a new item, it will default to the same folder. That is where the annoying part comes in. If you create 3 folders for all your project items and try to add a new item to each folder, Visual Studio will try to put all 3 items in the same place in the file system (the last folder you added a new item to), while putting items into the correct Visual Studio folder.
It is possible there is a setting for this in Visual Studio. I haven't found it. I also haven't looked that hard.