First things you need to know
- You can see the list of detected and enabled addins in Outlook in:
Tools->Options->Other->Advanced Options->COM Add-Ins...
If there were some error and addin has not been loaded it will be there with unchecked box. This is where you enable disabled addins. When you check addin and click OK - addin will be enabled right away, you don't have to restart Outlook
- If addin prevented Outlook from functioning correctly it will be "hard disabled" and put there:
Help->About Microsoft Office Outlook->Disabled Items...
- When addin fails to load, by default, we don't see any info about it or the error details. But we can change it!
- Open command prompt:
cmd
- Type:
set VSTO_SUPPRESSDISPLAYALERTS=0
- Run Outlook from that command line, should be like this:
"c:program filesMicrosoft OfficeOffice11Outlook.exe"
Now if something fails with addin - you will see it.
This will give you good basic to debug why your addin doesn't work.
I recently had a lot of problems with it. I thought about sharing it with you so that you don't have to go through it again :-)
BTW: you won't find those information on any forums or other pages ;-)
Things to verify
- Install all required assemblies to GAC. This gives them full permissions so if it's something with permissions now it should work. If it does work - check your CAS settings.
- Check manifest file. If you played with solution reorganization, changed names of projects, classes - there will be a problem.
Take a look at the underlined fragments:
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" manifestVersion="1.0">
<assemblyIdentity name="Sample.Addin.dll" version="1.0.0.0" />
<asmv2:entryPoint name="Startup" dependencyName="dependency0">
<asmv2:clrClassInvocation class="Sample.Addin.OutlookAddin" />
</asmv2:entryPoint>
<asmv2:dependency asmv2:name="dependency0">
<asmv2:dependentAssembly>
<assemblyIdentity name="Sample.Addin" version="3.2.0.0" publicKeyToken="c45b3b012bedcf43" />
</asmv2:dependentAssembly>
<asmv2:installFrom codebase="Sample.Addin.dll" />
</asmv2:dependency>
</assembly>
- Then take a look at the registry setting in the setup project. Verify all paths.
Make sure that XXX in keys below are equal to ProgID:
HKCU/Software/Classes/XXX/CLSID
and
HKCU/Software/Microsoft/Office/Outlook/Addins/XXX
- Got this:
"Could not load file or assembly 'Microsoft.Office.Interop.Outlook, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies.
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Office.Interop.Outlook, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies...."
Yeah, had this too :) Make sure that you don't have any Office 2007 applications installed on the development machine. I had SharePoint Designer. Uninstall them and reopen solution. Dependency to office.dll 12.0.0.0 should be gone (verify it in the dependency list in setup project).
Rebuild setup project.
I think that's it :)
Good luck!