ligershark / side-waffle

A collection of Item- and Project Templates for Visual Studio
Other
657 stars 205 forks source link

Custom Wizard #412

Closed softerj closed 6 years ago

softerj commented 6 years ago

Hi there. I have successfully been using SideWaffle to create a template for starting Xamarin projects that consist of a .NET Standard class library, platform projects for Android and iOS, and a UI Test project. I can select my template from the FIle->New Project dialogue and get a solution that contains the code I've added.

There are a few spots in the new solution that a user has to go in and configure values: api keys, urls, etc...so I wanted to implement a custom wizard that would pop up a form so the user could fill in the values and then they would get substituted in the appropriate spots in the code. Going by the guides located here https://github.com/ligershark/side-waffle/wiki/How-to-use-a-custom-wizard and https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-use-wizards-with-project-templates?view=vs-2017, I was able to successfully create the wizard and have it pop up a form when creating a new project from my template by:

  1. Adding a class library that houses my implementation if IWizard.
  2. Reference that class library from the SideWaffle template project.
  3. Add an tag to the .vsixmanifest file that references the .dll of my wizard class library
  4. Change the section in the .vstemplate so that it references the wizard class library assembly.

However, after I close the form, no projects are created and I end up with an empty solution. To be clear, if I take out the wizard and change it back to the built in Microsoft.VisualStudio.TemplateEngine.Wizard the projects in the template are created.

Any ideas on what I could be doing wrong?

Edit: I just noticed I may have posted this in the wrong area. If this needs to be in side-waffle creator, let me know and I will post there.

softerj commented 6 years ago

And of course after I post this after looking at this for a day, I figure out what the problem is. Step #4 above is incorrect. You don't change the existing section, you instead add another one that points to the assembly that contains your implementation and leave the one that points to Microsoft.VisualStudio.TemplateEngine.Wizard so that you there are two sections.

sayedihashimi commented 6 years ago

@softerj glad you got it working. If your template is open source please share a link so we can take a look.