Debugging an Addin

Aug 21, 2012 at 7:05 PM

I would like to know, how i must proceed to debug an Addin.

I´m using the addIn examples of 1.5 version.

I did build the solution, used the regasm "regasm COMAddinTaskPaneExampleCS4.dll".

I did set the solution to open a external program "outlook.exe".

I´m using Visual Studio 2010, framework 4.

I didn´t even capable of running the addin at Outlook program.

Thanks,

 

Ricardo 

Coordinator
Aug 21, 2012 at 8:32 PM

hello ricardo,

you dont regasm on your development system. set the option "register for COM Interop" in the project settings and visual studio register the assembly while compiling. the option is set in the NetOffice Addin examples.

go the project properties(right click on your project in the solution explorer) and to the tab 'Debugging' and to the section 'start action' now set the option 'start external program' and set the path to OUTLOOK.EXE. start the debugger now and your breakpoints works fine.

Sebastian

BTW: not important but did you use C# or VB ?

Aug 21, 2012 at 8:36 PM

I did try what you are proposing, and the addin didn´t even appeared on suplemments list, active or inative.

Im using C#, outlook 2010.

Aug 21, 2012 at 8:39 PM

Windows 7 64 bits, Office 2010

Coordinator
Aug 21, 2012 at 9:05 PM

ah okay, this means your addin was never loaded right?

if you have an Office 64 Bit then please read this part from the NetOffice documentation

If your assembly is a COMAddin that  is being loaded by a 32Bit Office application, you can still compile it as AnyCPU. If you develop a COMAddin that is being used by a 64Bit Office application, you have to compile your assembly as x64. If you wart to support 32Bit and 64Bit Office applications, you may need to provide a second x64-compiled COMAddin. This behaviour is the same in all scenarios(interop,vsto or netoffice). A 64Bit application can only load 64Bit Dll's.If you use a 64Bit Office for testing on your development system and you want to register your COMAddin while compiling (Register for COM Interop), you need to keep in mind that some older versions of Visual Studio call the 32Bit registration in that case. In this case, you get the following error:

"File <path to assembly> is not a valid assembly".

You can read a workarround by Microsoft here:
http://support.microsoft.com/kb/956933


this discussion may also helpful for you: http://netoffice.codeplex.com/discussions/346527

Sebastian

Aug 21, 2012 at 9:58 PM

This is really annoying, i have tried the solution above, and the addin still not be loaded.

Aug 21, 2012 at 11:05 PM

i did cleaner the solution, and build again, and ai got this issue now "regasm.exe is not a valid win32 application". ( i have configured a post build using the regams from framework64/v4.0.3...)

Do you have some clue about it?

Aug 21, 2012 at 11:12 PM

forget about the is not a valid win32, for some reason the exe corrupted in the process of tring register.

Coordinator
Aug 21, 2012 at 11:23 PM

did you have any canges made in the NetOffice sample project?
in other words, no netoffice sample addin was loaded from outlook.
i still need answer for the office 32 or 64 bit question. i can't reproduce your scenario in a virtual machine without.

Sebastian

Aug 24, 2012 at 8:02 PM

I have reinstall all over my machines, now im getting the error "is not a valid assembly". But im setting the build for x64 target. Any ideas?

Aug 24, 2012 at 8:19 PM

I put the post build regasm on Framework64/v4..., the output windows says it registered, but nothing loads on Outllok.

Coordinator
Aug 25, 2012 at 7:51 PM

hello ricardo

once again :P i still need answer for the office 32 or 64 bit question. i can't reproduce your scenario in a virtual machine without these information.
is your outlook application 32 bit or 64 bit ? if you have an 32 bit outlook in a 64 windows(possible) then forget all the 64 bit issues and do all things in the same way as 32bit.

Sebastian

Aug 27, 2012 at 6:17 PM

Sebastian,

 

I'am using Outlook 64Bits, under Windows 7 64Bits.

I tried to use the new Visual Studio 2012, but the addin seems no to be loaded anyway.

 

Att,

 

Ricardo

Aug 27, 2012 at 7:11 PM

Using Microsoft Visual Studio 2012 i gotta the samples working! Really thanks for all support!

Coordinator
Aug 28, 2012 at 6:03 AM

okay, now please gimme a day to reproduce the scenario in a virtual machine.

Sebastian