Wednesday, July 30, 2008

How to Debug a Guidance Package

When I started working on the Repository Factory project, one of the hardest things was how to debug it. Repository Factory is an GAT Guidance Package, which extends Visual Studio by providing additional functionality. Since it is executed by Visual Studio, how could I possibly debug it?

It turned out that it is not that difficult. You will basically need two instances of Visual Studio, one with the Guidance Package to be debugged, and the other one with a solution that uses the Guidance Package.

I used the following steps to debug the Repository Factory, but they can be applied to any Guidance Package:

1. Open an instance of Visual Studio and open the solution file of your Guidance Package.

2. Locate your Guidance Package Project on the Solution Explorer, right click on it, set it as a Start Up Project, and open the Properties window.

3. On the Properties window, click on the Debug tab, select Start external program and enter the location of Visual Studio, e.g. devenv.exe. Optionally, you can also specify on the Command line arguments the solution file that you want to automatically load.





4. Before you start debugging, it is important that you have previously registered your Guidance Package. To do that, rebuild your solution, right-click on the Guidance Package, and select Register Guidance Package. This registration takes a while, so be patient.



5. Start debugging your Guidance Package by pressing F5. Another instance of Visual Studio will open and you will be able open or create a test solution to use your Guidance Package. Now, you can use all the standard debugging features such as adding breaking points, watch window, etc.

If you have problems with step #4, e.g., you cannot see the Register Guidance Package option on the context menu, then you need to enable the Guidance Package Development on your Guidance Package solution.
  • On your Guidance Package Solution, goto the main menu, click on Tools, and then on Guidance Package Manager.
  • Select Enable / Disable Packages...
  • Select Guidance Package Development, and then click on OK, and then on Close on the next window.



After the steps above, you should be able to see the Register Guidance Package option on the context menu.

I hope this article was useful for you in helping you how to debug your Guidance Packages.

Happy Debugging!!

3 comments:

Anonymous said...

When I click on Tools|Guidance Package Manager then click Enable/Disable Packages I do not see the Guidance Package Development item in the list. I only have Web Client Development February 2008. I am running VSTS2008 on XP SP2. Any ideas?

Luis Rocha said...

This is probably because you have only the GAX installed. In order to see the Guidance Package Development item in the list, you also need to install the GAT, the toolkit. I hope this helps.

Anonymous said...

I have installed GAT/GAX 2010 and I am not able to see the Register/ unregister menu options with my guidance package. Could you please let me know how to enable these menu options in VS 2010. I have tried the options from Tools/Guidance Package Manager and then click the Enable/disable package options.

Thanks in advance.