ligershark / side-waffle

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

IWizard RunFinished runs at wrong time #413

Closed Pietervdw closed 5 years ago

Pietervdw commented 5 years ago

Hi Guys,

I've created a multi-project template using the SideWaffle Creator. Everything works perfectly, so I add a custom wizard that implements IWizard and I add it to the template.vstemplate file:

  <WizardExtension>
    <Assembly>MyTemplate.Wizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</Assembly>
    <FullClassName>MyTemplate.Wizard.ProjectWizard</FullClassName>
  </WizardExtension>

When I run the template (File > New Project) the RunStarted event on the IWizard class runs fine:

private DTE dte = null;
public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary,
    WizardRunKind runKind, object[] customParams)
{
    if (automationObject is DTE)
        dte = (DTE)automationObject;
}

But it looks like the RunFinished method runs immediately after RunStarted:

public void RunFinished()
{
    var solution = dte.Solution;
    var projects = solution.Projects; // solution.Projects.Count = 0
}

The project is also only generated after the RunFinished method is called. This means that I can't run any project specific code after the wizard finishes, since any project in the solution is essentially null. Using the "old" TemplateBuilder way this approach used to work fine. Not sure if I'm missing anything

Any advice would be highly appreciated. Many Thanks!

Pietervdw commented 5 years ago

Closing this. Created issue on SideWaffle2 project https://github.com/ligershark/sidewafflev2/issues/39