C# Files not getting added in a custom project template - VS 2017 - visual-studio-2017

I am creating a New Project Template in VS2017 based on ASPNET Core Web API project. I have followed steps as outlined here: https://learn.microsoft.com/en-us/visualstudio/ide/how-to-create-project-templates
The zip file contains all the files (C# files).
When the new project is created based on the above project template, none of the C# files are added to the project.
Are there any special steps or settings to include the C# files?

I know this response is late but it may save someone else some other day.
I had this issue as well and i realized the solution was to include the CreateInPlace tag as a child of the TemplateData tag in the .vsTemplate for the project.
Unzip the zip file and update this template file. Add the following line
<CreateInPlace>true</CreateInPlace>
as a child of the TemplateData tag
<TemplateData></TemplateData>

Related

How do I #include plugin source files in my custom Unreal Engine module?

I'm working with a C++ Unreal Engine project and made my own custom module called MyActor, Unreal Engine automatically created the .cpp and .h files for me. That much appears to be working.
So now I want to include classes or methods from the AppleARKit plugin then override and call them from my custom MyActor module.
First I tried using #include AppleARKitLiveLinkSourceFactory.h because it has theIARKitBlendShapePublisher::PublishBlendshapes method which I want to modify and use.
It didn't work at first with this error: E1696 Cannot open source file AppleARKitLiveLinkSourceFactory.h but I found out I could include them in Visual Studio using the "Include Directories" under Properties like this:
The AppleARKitLiveLinkSourceFactory.h lives in the Public folder but I included the Private folder as well, I don't know if I need to do that. This appeared to work at first but then I got the same error as before for every dependency inside the AppleARKitLiveLinkSourceFactory.h file.
Do I have to include the individual directories for every dependency down the entire chain? Is there an easier way?
When I ran into the issue of including files from a plugin, in my case LidarPointCloud, the following steps worked for me:
1) In my <project-name>.Build.cs file, I added the module name I wished to use (LidarPointCloudRuntime) to the public dependency list
PublicDependencyModuleNames.AddRange(new string[] { "LidarPointCloudRuntime", "Core", "CoreUObject", "Engine", "InputCore" });
I determined the module name by opening the .uplugin file in the plugin's folder, and looked at the Modules section. If multiple module names are listed, you should pick the one that contains the source for the classes you care about.
2) I then rebuilt the project, closed my editor, then right clicked my <project-name>.uproject file and regenerated project files.
After that, I was able to access the .h files in my code.
-Update-
It seems that AppleARKitFaceSupport has dependencies on other plugins that may need to be included. For example, ARSystems.h lives in AugmentedReality. When I add that to PublicDependencyModuleNames and perform the same steps, it can find ARSystem.h.

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.

Visual Studios 2012 Export Project Template with Files

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.

Custom Project Type Templates

When you create a new project in WebStorm, you are given the option to create a new directory structure prepopulated with files: libraries, stylesheets, etc. for patterns like HTM5 boilerplate, Twitter boilerplate, etc.
How does one create one's own template for this? Is importing dummy projects the hack for it?
I suggest not using templates. I find it far more easy and maintainable to create "empty" projects (from existing projects, of course) in a git repo (bitbucket, github, ...), clone one, and start from there.
The .idea should be in the repo, but .idea/workspace.xml should be ignored, as per the documentation.
This gives you the opportunity to gradually refine your template, and share it easily with a team.
Use the LivePlugin plugin to create a project template:
<projectTemplate projectType="foo" templatePath="resources/bar.zip" category="true"/>
Use the Velocity Template Language (VTL) to create a file template:
File and code templates are written in the Velocity Template Language (VTL). So they may include:
Fixed text (markup, code, comments, etc.).
In a file based on a template, the fixed text is used literally, as-is.
File template variables.
When creating a file, the variables are replaced with their values.
#parse directives to include other templates defined in the Includes tab on the File and Code Templates page of the Settings dialog box.
Other VTL constructs.
References
Create project template extensions using "user defined" templates
Creation of Extension to applicationConfigurable
IdeaPlugin.xml
PlatformExtensionPoints.xml
LivePlugin: Plugin for writing IDE plugins
Webstorm Help: File and Code Templates
Configuring JetBrains WebStorm for UI5 development
Webstorm Project and IDE Settings
Idea NodeJS Plugin
Apache Velocity Engine VTL Reference

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.