Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cancel VS2010 project creation from wizard

I created a wizard for a custom template in VS2010 And it works like a charm.

But since the wizard contains a form required to finish the creation of the project, i feel that the user should be able to cancel the creation of the project.

So my question being..

Is it possible to cancel the creation of a project/template process from inside a wizard implementing IWizard?

These are the events i got at my disposal.

public void BeforeOpeningFile(ProjectItem projectItem)

public void ProjectFinishedGenerating(Project project)

public void ProjectItemFinishedGenerating(ProjectItem projectItem)

public void RunFinished()

public void RunStarted(object automationObject,
        Dictionary<string, string> replacementsDictionary,
        WizardRunKind runKind, object[] customParams)

public bool ShouldAddProjectItem(string filePath)

Thank you!

like image 203
Moulde Avatar asked Aug 27 '10 17:08

Moulde


1 Answers

Yes. To indicate that the user has cancelled the wizard, just throw a new WizardCancelledException in your IWizard implementation.

A very interesting article which explains all this: Pitfalls of cancelling a VSIX project template in an IWizard

like image 142
Aaron Marten Avatar answered Sep 30 '22 05:09

Aaron Marten