Debugging An Add-In

Add-in Express™ Support Service
That's what is more important than anything else

Debugging An Add-In
What's the trick to getting a breakpoint to be recognized? 
Brian Leach




Posts: 11
Joined: 2005-10-27
I'm trying to debug a simple add-in I wrote for Microsoft Project. My code is VB.NET, I'm using Add-In Express 2.4 and Visual Studio 2003.

My app creates a toolbar button and runds a little VB code when it is clicked. I set a breakpoint on an executable statement in the click event handler.

In the project properties, I go to the Configuration Debugging page. I set the Start External Program to the executable for Microsoft Project. I do this for the Debug configuration, which is active.

If I start MS Project standalone, my plugin loads, although I have to manually check the box for it in the COM Add-ins dialog. The code generally works, but there a few minor things I want to look at in the debugger.

When I Debug->Start, Microsoft Project launches and promptly exits.

If I check the "Unmanaged code debugging" box on the debugging config page, then Microsoft Project will start, but my breakpoint symbol gets a question mark icon over it. The tooltip reads "This breakpoint will not currently be hit. No executable code is loaded at this location." Then VS2003 crashes.

What am I doing wrong? Is anyone out there successfully hitting breakpoints? Is there a trick?

After I build each time, do I need to unregister and register my add-in?

What happens if I skip the unregister step?
Posted 05 Apr, 2006 15:23:26 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Brian.

Do you have both v1.1 and v2.0 .NET Frameworks installed on the PC?
If so, you need to use Host Configuration dialog of the addinmodule (right click on the designer) to force MS Project to load .NET v.1.1 only.
Also you can use the C++ shim for the add-in. In this case you will not need to configure MS Project.
Posted 06 Apr, 2006 07:15:10 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
After I build each time, do I need to unregister and register my add-in?

There is no need to register/unregister the add-in whenever you build it.
You can register it once and then you just need to build/rebuild it.

What happens if I skip the unregister step?

ADX unregisters add-in itself when you click 'Register ADX Project' option.
Posted 06 Apr, 2006 07:20:05 Top
Brian Leach




Posts: 11
Joined: 2005-10-27
Yes, Sergey, I have both versions of .NET installed, and your suggestion fixed the problem. I am confused about the C++ shim. Did I need to create one when I generated the new project, or can I do it after the fact. Once I have the C++ shim, how do I use it?
Posted 06 Apr, 2006 17:04:04 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Brian.

I would advise you to create C++ shims for COM add-ins (by default in the ADX Wizard). In the next ADX build we will add a possibility of creating the C++ shim after the add-in has been created. Now you need to create a new project with the name of your add-in. Then you should copy the shim project and .snk file into the folder with the current add-in. Aslo set the ShimProgID property of the addinmodule to '<The add-in name>Shim.Proxy' value (see the newly created project).

Once I have the C++ shim, how do I use it?

The shim will be used by MS Project. You just need to rebuild the add-in and correct the setup project a little bit (see the VSSetup.doc file from the ADX installation package). You can learn more about shim here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dno2k3ta/html/ODC_Office_COM_Shim_Wizards.asp
Posted 07 Apr, 2006 12:42:04 Top