vsix multi template project creates an extra folder - templates

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?

Related

Visual Studio 2019: Linking to folder

I am trying to link to a folder that is not inside the project directory. To give an example,
If my project is in C:\project and I have a folder C:\shared, how can I manage to link C:\shared into the project (and being able to edit/view the files in Solution Explorer) without making a copy of the directory and placing it into the project directory.
I need this due to the fact that many projects will use this folder and it would be ideal to have them edit/use the same files rather than copy the folder into each project individually. That way if a bug is fixed in one project, all other projects will now use the fixed files as well.
For more context, this is a C++ project using Visual Studio 2019.
What I've tried/considered.
Additional include directories
Problem: This does not show the files in the Solution Explorer
Dragging/dropping the folder (or copy/pasting) as seen in another StackOverflow thread.
Problem: This just crashes my visual studio completely. The folder is quite large so I assume that's related to why.
Appreciate any insight on how to proceed. It's really unfortunate that this is a pain, I would think that something like this would be common, but all the posts I've seen related to it have either gone unanswered or could not be applied to my situation.
Thanks.
Shared Projects are the key here.. I just found out they existed. After creating one, drop the folder/files in the same directory that has .vcxitems file. Now in the project you want to include the shared folder, right click your solution, Add -> Existing Project and select your .vcxitems file.

VS2017 renaming projects - the folder already contains an item named

I am reorganizing numerous small solutions/projects into one solution in Visual Studio 2017 but I keep getting error messages like:
The folder already contains an item named 'Staging'
Followed by:
Exception of type 'System.Runtime.InteropServices.COMException' was
thrown
The projects are all in individual folders in a folder called Packages with the project folders named like:
Staging.Finance
Staging.HR
Staging.SharePoint
There is no folder called Staging in the Packages folder and there are no files called Staging in the folder for the project I am trying to rename. The project file name is currently Finance-SSIS which I am trying to rename to Staging.Finance.
There is a project called Staging in my solution but this is in a different folder from these projects.
I can rename the project files outside of Visual Studio but want to understand why I'm getting this error.
Upon searching I came across these three solutions:
Try Restarting Visual Studio.
Open Solution Explorer there is an icon that looks like a many
Pages which is the Show All
Files. Once clicked, one is able to see the hidden, to the visual
studio project, the folder that was causing this error. (Look for
the folder in the View section.). After I deleted the unwanted
folder, and Rebuild Project, You should be able to Create the
controller which will create the view automatically
A project can exist in a solution in only one location. To correct this error:
To show hidden Solution Folders, select the solution or a Solution Folder that contains a hidden Solution Folder and then on the Project menu, select Unhide Folders.
Credits for solution 1 & 2: See original answers
Credits for solution 3: See original post
I suggest to search in main projects file content about 'Staging' . For example take a look at solution file (with .sln extension) content and search about 'Staging', I hope you will find it there!

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?

Setup cocos2d-x application through visual studio 2010 project template

I'm trying to setup an application on Windows 7 using Cocos2D-x.
I followed this tutorial.
I did the following:
Built the library running Build-win32.bat script. Works.
Installed VS2010 project template. Works.
Run successfully all test programs.
Created a new cocos2D-x project through the installed template. Works
When I compile the Hello World application I have the follwing errors:
error C1083: impossible to open inclusion file 'CCstdC.h' No such file or directory
error C1083: impossible to open inclusion file 'cocos2d.h' No such file or directory
It's a wrong include path.
I could fix it by manually modifying include path but since I'm creating project through the template I-d like to solve this, possibly not having to modify paths manually for each new project I'll create.
Did anyone ever had the same issue?Do you know how to fix this?
Well, I setup cocos2dx projects like this:
create an empty win32 app in VS
open the folder contains your .sln file (your solution folder)
open the cocos2dx package (i.e. cocos2d-1.0.1-x-0.12.0.zip) with 7z or something
drag cocos2dx, and optionally CocosDenshion, Box2D, etc. to your solution folder
add cocos2dx project (cocos2dx\proj.win32\cocos2d-win32.vcxproj) into your solution
go to your project's properties, select C/C++->General, add the following entries to your Additional Include Directories option:
..\cocos2dx; ..\cocos2dx\include; ..\cocos2dx\platform; ..\cocos2dx\platform\win32; ..\cocos2dx\platform\third_party\win32\OGLES
and ..\CocosDenshion\include if you're using the SimpleAudioEngine
in the Linker->Input->Additional Dependencies option, add libcocos2d.lib, and libCocosDenshion.lib if you use the audio engine; in the Linker->General->Additional Library Directories option, add $(OutDir)
go to the Configuration Properties->General->Output Directory option, set it to $(SolutionDir)\build\
open the project property for cocos2d library, go to the Configuration Properties->General->Output Directory, set it to $(SolutionDir)\build\, also do that to the rest of the libraries you included.
All set, you're ready to go.
Unfortunately that template is not that useful. I believe that in a previous version of cocos2d-x (the one that tutorial is based on) the paths were absolute, and referenced the cocos2dx, cocosdenshion projects directly.
Now, as they're relative (..\..\cocos2dx), and they are not copied to the solution directory when a project is created, it just doesn't work.
You could obviously fix the paths (as you suggested) but my suggestion is: copy the HelloWorld project and use it as a template. The solution structure is much better than the one in the template as it's already prepared for iOS, win32 and Android. Trust me, can't get any easier than that.
Now, here's the catch: if you copy the HelloWorld project to a sibling folder, you're done, as all the references are already setup. If you want to copy to other place you'll have to also copy cocos2dx, cocosdenshion along, leaving the target structure like:
target_path\cocos2dx
target_path\cocosdenshion
target_path\Copy_of_Hello_World
I solved opening the cocos2dx library solution and add to it a new project through VS template wizard.