ligershark / template-builder

This project will output a NuGet package which can be used to help create Visual Studio Item Templates and Project templates
Other
42 stars 28 forks source link

_Definitions folder gets added when creating a new project #68

Open codewithtyler opened 9 years ago

codewithtyler commented 9 years ago

After creating and install a JavaScript project using SideWaffle, there is a _Definitions folder that is created during the project creation. This was originally found in ligershark/side-waffle#271.

While investigating this problem I found that there are 3 places that reference the _Definitions folder in TemplateBuilder. These are:

GetItemTemplateNameFromVSTemplatePath01.proj simply points the VSTemplatefile path to the vstemplate file in the _Definitions folder.

The ModifyProjectTask.proj has an ItemGroup element containing another nested element called ItemsToRemove. This points to the vstemplate.xml file in the _Definitions folder.

The _modifyproj.csproj contains a Content element nested inside one of the ItemGroup elements. This content element adds the _Definitions_project.vstemplate.xml file. However, it's not very clear what this is used for.

From what I can tell the _modifyproj.csproj file is probably what is preventing the _Definitions folder from being removed on build. However, I'd like to receive some additional information regarding these files to make sure I'm understanding this correctly.

@sayedihashimi can you confirm what I have found so far?

sayedihashimi commented 9 years ago

@RandomlyKnighted

These files are all just sample files.

When a template build is happening ligershark.templates.targets is imported and a step of that calls the ModifyProject task is called. That is the guy who removes the items from the project file.

I think what we should do is add the SideWaffle Project Template Files to a JS project and then see if adds an additional item for the folder itself. Then add that to the list of items to remove which is then passed to ModifyProject.

codewithtyler commented 9 years ago

@sayedihashimi thanks for the clarification.

Something I'm still a bit confused about. The OP said that the issue occurred when attempting to create a JavaScript project; however, in the preprocess.xml and vstemplate files they provided it shows that they had created a C# WPF application. So do I create a WPF application and test that or do I need to actually test with something like a Node.js Web Application project?

kentcooper commented 9 years ago

I think the OP didn't have the right project name in his preprocess and vstemplate files. After @sayedihashimi asked him if the name of his project was really WpfApplication.csproj he posted that he got it working so I'm guessing he got the correct project name after that. Based off the original question I think the OP was trying to use one the actual JavaScript Projects (used in the Windows Store) not a Web Project.

sayedihashimi commented 9 years ago

I agree with Kent.

codewithtyler commented 9 years ago

Ok, so I haven't even been able to get as far as the OP did with creating a JavaScript template. So far I've ran into two issues that I've only been able to replicate when creating a JavaScript project template. (I've tested this on two different machines using the latest version of SideWaffle.) Anytime I do a C# project it works fine.

The first problem I run into is when I try to add a template reference I get the following error message:

attempted_to_add_template_reference

I'm not sure where it gets _project1.vstemplate because it adds the _project.vstemplate file like it should in the _Definitions folder.

The second one happens immediately after I've added the template reference (somewhat unsuccessfully due to the error above). Once I've updated the vstemplate and _preprocess.xml files I go to build the project and I get the following error message.

Error 1 The project file could not be loaded. Could not find file 'C:\Users\tbhughes\Documents\Visual Studio 2013\Projects\JS_VSIXProjectTest\App1\.jsproj'.

I've went through the VSIX .csproj file and the file path looks good. I'm not sure why it's missing the App1 before the .jsproj.

Am I missing something here?