Archive

Archive for November, 2011

Not loaded. A runtime error occurred during loading of COM add-in

November 22, 2011 Leave a comment

I’ve spent quite a while trying to sort out why my Word 2007 Add-in won’t work on XP for some time and finally found the problem here …

The add-in is built on .NET 4.0 using VSTO 4.0 and I created a Windows MSI installer but it failed to run on the new XP virtual machine I had created all I got was the following error displayed in the Word Add-Ins dialog:

“Not loaded. A runtime error occurred during loading of COM add-in”

I tried a number of methods to try and identify the problem that are listed here for information before I hit on the actual solution …

1. Ensure all pre-requisites are installed …

  • .NET 4 Client Profile
  • VSTO 4.0
  • 2007 primary interop libraries

I also had one assembly built in VC++ so required the VC++ 2010 x86 redistributable and also a third party component that required VC+ 2008 redistributable too. But even then it wouldn’t work.

2. Next I rebuilt a new add-in that did nothing other than display a messagebox with its own install

Still no joy.

3. I then tried enabling VSTO logging by adding the following system environment variables ..

  • VSTO_SUPPRESSDISPLAYALERTS  = 1
  • VSTO_LOGALLERTS=1

But no amount of searching for *.vsto.logs yielded anything.

4. Next up I enabling Fusion (.NET Framework sub-system for locating and loading assemblies) …

  • Under HKLM\Software\Microsoft\Fusion
  • Create a DWORD value called ForceLog and set 1.
  • Create a String value named LogPath, set the value as c:\fusion
  • Create the C:\fusion folder.

But even then when I ran up Word nothing was displayed!

It just wasnt getting across the com boundary.

5. I went to an old XP virtual machine that’s had all sorts on it …

I installed the add-in and the pre-requisits … and guess what … it WORKED!

Although the old vm had lots installed, the only significant thing was that .NET 3.5 was on there …

Willing to try anything at this stage I returned to the new VM and installed 3.5 …

And … you guessed it … after re-installing the app and the pre-requisits … the add-in sprang into life!!!

Amazed, I did a final search only to find the following link to a “known issue” that Office 2007 tries to load .Net Framework 2.0 before doing anything else …

And what’s more, there is a hotfix available that fixes the issue

http://support.microsoft.com/kb/976477/

Advertisement