locked
Step by step instruction how to debug a custom Wizard template needed RRS feed

  • Question

  • Hi all

    I have successfully create a custom project item with wizard. as x link http://msdn.microsoft.com/en-us/library/ee710183.aspx

    However Even though there are some instructions to debug I have not managed to debug my wizard.

    Do I need to attach process? If I run as x instruction it says "A project with an output type of class cannot be started directly."Which makes sense.

    What Am I missing?How do I debug my custom Wizard?

    Thanks for your time


    Thanks for your help
    Wednesday, June 16, 2010 8:03 PM

Answers

  • Give this is an IWizard based wizard (and not a .VSZ/.VSDIR based). You just need to configure the debugger to launch devenv.exe. I usually just build the assembly to the ....common7\ide\privateassemblies directory. If you're on Vista or WIn7, youll need to launch devenv.exe with elevated admin priviledges to build it there. Vista/Win7 don't like it when you start adding files under ....Program Files... directories.

    To configure your debug settings, right click project node in sln explorer, select Properties. Then click on Debug Tab, and set Start Action to "Start external program:" and then browse and select devenv.exe.

    When you hit F5, the debugger will launch a new instance of the VS IDE, and when you use that instance to create a new project, you should see your breakpoints hit.

     


    Ed Dore
    Thursday, June 17, 2010 1:13 AM
  •  

    Hello, Dev

    Ed Dore’s advice could work perfectly. If you still could not get it work, please following the following steps.

    1.    Sign your custom wizard assembly with a key.

    2.    Change the project output to Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies.(Right click the project node, click “Properties” to open the property page, then select “Build” Tab, Change the output textbox to \Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies).

    3.    In the Project property page, click “Debug”, then select “start external program”, in the text box, write C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe.

    4.    In you *.mytemplate, use <WizardExtension> to add the cutsom template wizard dll, for example the <WizardExtension> on my side is

      <WizardExtension>

        <Assembly>MyWizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cd13ee1c21f4f0dc</Assembly>

        <FullClassName>MyWizard.CustomWizard</FullClassName>

      </WizardExtension>

    5.    Set the break point in your class which implement IWizard, then click F5 to debug, create a new project with the template, you will see the break point was get hitted.

    Thanks

    Chao

    • Marked as answer by Chao Kuo Wednesday, June 23, 2010 2:51 AM
    Sunday, June 20, 2010 12:26 PM
  • In all likelihood, you're probably either debugging the wrong assembly, or the debugger isnt' finding the right .PDB. You can check this by pulling up the Debuggers Modules toolwindow and verify the path your wizard assembly is being loaded from.

    P.S. Feel free to post a "new" post. It will typically get more attention faster, than adding a "me too" reply to an already answered post.

    Sincerely,


    Ed Dore
    Saturday, October 1, 2011 1:14 AM

All replies

  • Give this is an IWizard based wizard (and not a .VSZ/.VSDIR based). You just need to configure the debugger to launch devenv.exe. I usually just build the assembly to the ....common7\ide\privateassemblies directory. If you're on Vista or WIn7, youll need to launch devenv.exe with elevated admin priviledges to build it there. Vista/Win7 don't like it when you start adding files under ....Program Files... directories.

    To configure your debug settings, right click project node in sln explorer, select Properties. Then click on Debug Tab, and set Start Action to "Start external program:" and then browse and select devenv.exe.

    When you hit F5, the debugger will launch a new instance of the VS IDE, and when you use that instance to create a new project, you should see your breakpoints hit.

     


    Ed Dore
    Thursday, June 17, 2010 1:13 AM
  • Hi

    Thanks is an IWizard . I am using xp and VS2010 professional. I have set to devenv.exe.

    I put a breapoint on started on my IWizard class. HIt F5

    Run a new VS project. Select my item template in the hope that I would break on my breakpoint but no luck.Missing any steps?

    Thanks for your time


    Thanks for your help
    Thursday, June 17, 2010 6:08 AM
  •  

    Hello, Dev

    Ed Dore’s advice could work perfectly. If you still could not get it work, please following the following steps.

    1.    Sign your custom wizard assembly with a key.

    2.    Change the project output to Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies.(Right click the project node, click “Properties” to open the property page, then select “Build” Tab, Change the output textbox to \Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies).

    3.    In the Project property page, click “Debug”, then select “start external program”, in the text box, write C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe.

    4.    In you *.mytemplate, use <WizardExtension> to add the cutsom template wizard dll, for example the <WizardExtension> on my side is

      <WizardExtension>

        <Assembly>MyWizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cd13ee1c21f4f0dc</Assembly>

        <FullClassName>MyWizard.CustomWizard</FullClassName>

      </WizardExtension>

    5.    Set the break point in your class which implement IWizard, then click F5 to debug, create a new project with the template, you will see the break point was get hitted.

    Thanks

    Chao

    • Marked as answer by Chao Kuo Wednesday, June 23, 2010 2:51 AM
    Sunday, June 20, 2010 12:26 PM
  • hi

    it did work .Thanks!!!!


    Thanks for your help
    Wednesday, June 23, 2010 5:30 AM
  • Please note that the requirement to sign your wizard assembly and add the <WizardExtension> entry to the .vstemplate file is documented in the walkthrough under the "Associating the Wizard with the Item Template" section. If you follow the instructions in the walkthrough, you should not have to make any changes in Visual Studio to make the wizard debuggable. The VSIX Project type (which is the startup project in the solution you create in the walkthrough) automatically installs the extension in the experimental instance of Visual Studio and starts the experimental instance when you debug the solution.

    If you have any further feedback on this walkthrough, please let me know.


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, June 23, 2010 7:57 PM
  • Hi there

    thanks for your reply .

    There are few things that I would like to ask

    Why did MS create a walkthrough using Sharepoint? I moved away as I Know nothing about sharepoint. I think they should have created an example that is very generic and that portraits the point.I am sure that does that but sharepoint not sure.

    What about editing a template once deployed what is the best way to do it?

    Are you saying that placing the dll in "PrivateAssemblies" is not necessary to debug?

    what about adding the unregistration and registration of gac util in the postbuild section I get error 9009.

    Also once dll is placed within private assembly my gac command dont seem to work.

    Suggestion:

    They should have created something using a IWizard that everybody can relate to EG Create a  project group template with 3 projects and in the wizard you specify the name of the project" or something like that...

    When you talk about "experimental instance of Visual Studio" what do you exactly mean?

    APOLOGIES ABOUT THESE QUESTIONS very GRATEFUL for any answers.

     


    Thanks for your help
    Sunday, June 27, 2010 6:43 AM
  • The walkthrough you're referring to (part 2 of 2) is in the documentation for the SharePoint tools in Visual Studio 2010, under the Extending the SharePoint Tools in Visual Studio node - see the placement of this topic in the table of contents. The SharePoint tools have their own extensibility model that can be used with features from the underlying Visual Studio extensibility model (such as project/item templates and template wizards). In this case, the goal of this 2-part walkthrough is to define a custom type of SharePoint project item, and then to associate this project item with an item template and a custom wizard to provide a complete experience for other developers who you want to use your custom SharePoint project item. I hope this explains why this particular walkthrough is specific to the SharePoint tools.

    For general information about implementing your own custom wizard (not specific to SharePoint tools extensions), see How to: Use Wizards with Project Templates in the core Visual Studio documentation.

    The experimental instance of Visual Studio is included with the Visual Studio SDK to provide a "safe" instance you can use to install and test extensions, to help ensure that you do not corrupt your "real" intance of Visual Studio on your development computer. You develop new extensions by using the regular instance of Visual Studio, but you debug and run them in the experimental instance. When you develop a Visual Studio extension and use a VSIX project to package/deploy the extension, when you debug/run the VSIX project Visual Studio will automatically install the extension and run it in the experimental instance.

    I do not know the answers to your other questions. Perhaps someone else can chime in on this thread, or you might want to open a new thread specifically for those questions.


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, June 28, 2010 7:45 PM
  • hi

    thanks a lot for your time in answering this is very helpful and I will look more into it


    Thanks for your help
    Monday, June 28, 2010 9:16 PM
  • I currently am trying to debug my Custom wizards for ItemTemplates that I have designed.  I have the .vstemplate files with the appropriate <WizardExtension> group that point the appropriate Assembly and FullClassName.  I have then se the project to "Debug" configuration, the output path is:

    C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies

    And after compile my dll and pdb files show up in that folder. 

    I then have the Start External Program to:

    C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe

    I then hit F5, which compiles the dll to the ouput folder, and runs a new process of VS.  I then open a test project, and click "Add New Item".  The New item dialog appears, from which I select the appropriate Template that I created and then click Add.

    My wizard pops up and after I click OK on the wizard's form, it adds the file, but it NEVER stops at the break point I have set in the RunStarted Method.  What am I missing here?

    thanks

    Jaeden "Sifo Dyas" al'Raec Ruiner


    "Never Trust a computer. Your brain is smarter than any micro-chip."
    PS - Don't mark answers on other people's questions. There are such things as Vacations and Holidays which may reduce timely activity, and until the person asking the question can test your answer, it is not correct just because you think it is. Marking it correct for them often stops other people from even reading the question and possibly providing the real "correct" answer.
    Friday, September 30, 2011 9:32 PM
  • In all likelihood, you're probably either debugging the wrong assembly, or the debugger isnt' finding the right .PDB. You can check this by pulling up the Debuggers Modules toolwindow and verify the path your wizard assembly is being loaded from.

    P.S. Feel free to post a "new" post. It will typically get more attention faster, than adding a "me too" reply to an already answered post.

    Sincerely,


    Ed Dore
    Saturday, October 1, 2011 1:14 AM