Cancel the creation of the VS2010 project from the wizard

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

But since the wizard contains the form necessary to complete the creation of the project, I feel that the user should be able to cancel the creation of the project.

So my question is ...

Can I cancel the creation of a project / template process inside a wizard that implements IWizard?

These are the events that I received 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) 

Thanks!

+4
source share
1 answer

Yes. To indicate that the user has canceled the wizard, simply run the new WizardCancelledException in your IWizard implementation.

A very interesting article that explains all of this: VSIX project template cancellation traps in IWizard

+8
source

All Articles