The Ribbon/COM Add-in helper required by add-in ExcelDnaExample Add-In could not be registered

已查看 4,345 次
跳至第一个未读帖子

Scott Golightly

未读,
2014年7月25日 10:35:282014/7/25
收件人 exce...@googlegroups.com、sgoli...@neovest.com
I have an add-in that has been working fine for about 2 months and then suddenly started throwing an error registering the add-in yesterday.
I created a sample with a single UDF and a minimalistic ribbon. When I don't have the ribbon the add-in registers and the UDF works so I think the problem is in registering the ribbon with Excel. I have attached the sample project so you can see what I am doing.

Here is the error text that I get in a pop up as Excel loads. I haven't found anything in the Windows Event logs and I am not aware of any logging by Excel.

The Ribbon/COM Add-in helper required by add-in ExcelDnaExample Add-In could not be registered.
This is an unexpected error.
Error message: Exception has been thrown by the target of an invocation.

I found this thread (http://exceldna.codeplex.com/discussions/551676) where someone else was getting the same error and the suggested fix was to add the correct namespace for the ribbon but I believe I have the correct namespace already added.

<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
 
<ribbon>
   
<tabs>
     
<tab id="TabAddIns" label="Excel-DNA Example">
       
<group id="group1" label="Group 1">
         
<button id="btnSettings" label="Settings" size="large" />
       
</group>
     
</tab>
   
</tabs>
 
</ribbon>
</customUI>


I am running Windows 8.1 with Excel 2013 64 bit. The only changes that I am aware of between when the add-in was working and when it stopped was an installation of pidgin (since uninstalled) and the windows updates pushed down by our IT group.

Any help would be appreciated.

ExcelDnaExample.zip

Govert van Drimmelen

未读,
2014年7月25日 18:26:232014/7/25
收件人 exce...@googlegroups.com、sgoli...@neovest.com
Hi Scott,

I'm not sure it explains your error, but here are some thoughts:

* If the ribbon load code (GetCustomUI) any of the ribbon callbacks throws an unhandled exception, Excel sometimes picks this up and will mark the ribbon helper as suspect. On the next run, Excel may then prompt you to disable that add-in, causing the ribbon not to load in future. You can check for this by going into File -> Options -> Add-Ins, and at the bottom pick "Manage: Disabled Items". This shows the list of disabled items, and you can remove items from the list. Check whether you have anything there.
I can't tell exactly when Excel does this.

* In your example code, there are a few problems:
- The ExcelRibbon-derived class should be public.
- The ExcelRibbon-derived class should be marked [ComVisible(true)]
- You have to take some care with the resource naming. I needed to change the resource name string, so that the relevant line becomes:
    doc.Load(Assembly.GetExecutingAssembly().GetManifestResourceStream("ExcelDnaExample.ExampleRibbon.xml"));

With these changes it loads the ribbon on my machine.

-Govert

Govert van Drimmelen

未读,
2014年7月25日 18:28:342014/7/25
收件人 exce...@googlegroups.com、sgoli...@neovest.com
Here's another discussion on the same topic, that seems to have ended well:

-Govert

Scott Golightly

未读,
2014年7月25日 18:44:352014/7/25
收件人 exce...@googlegroups.com、sgoli...@neovest.com
Govert,

Thank you for the reply. Indeed I checked the main add-in and it was set to public and ComVisible(true). I am not sure what the problem was but shortly before your reply I gave up trying to figure out what the issue is and rolled my machine back to before the Windows Update ran. I am working for now but I suspect that there will be more troubleshooting in my future when the Windows Updates get pushed down to my machine again.

Scott

Govert van Drimmelen

未读,
2014年7月25日 19:38:072014/7/25
收件人 exce...@googlegroups.com、sgoli...@neovest.com
Hi Scott,

Are your Windows Updates only the Microsoft ones, or internal group policy updates too?

If there is a Windows Update that is breaking it, it would obviously help if a lot we could identify the specific change or patch that breaks it.

-Govert

Scott Golightly

未读,
2014年7月28日 18:08:522014/7/28
收件人 exce...@googlegroups.com、sgoli...@neovest.com

Govert,

 

All of the updates are from Microsoft but it appears we have a WSUS server because the update dialog shows that some settings are controlled by group policy. I also notice there is some filtering of the available updates from our IT department. (i.e. I see more updates at home than at work).


I reapplied the windows updates one by one this morning and tested between each update and I did not have a recurrence of the problem so at this point I am happy that everything is working for me but I can't seem to reproduce the problem to help with troubleshooting.

 

Scott

Paul Harrington

未读,
2014年8月6日 23:20:222014/8/6
收件人 exce...@googlegroups.com、sgoli...@neovest.com
I can reproduce this problem on any of my machines (windows 7, Excel 2010 32-bit, Microsoft ExceID 2010 (14.0.7109.5000) SP2 MSO (14.0.7116.5000) ) with the CustomTaskPane.dna demo that ships with ExcelDna-0.32 and it appears to be something to do with the Trust Center settings. I have a codesigned .xll file signed with a cert that is a trusted publisher. I normally have the Trust Center settings for signed stuff only. The addin loads and the Ribbon appears. However, when I hit the Show CTP button, I get an error dialog which is similar (or perhaps identical) to the one Scott describes. I only get the dialog the first time I hit the button. For button clicks after that, I don't see any reaction at all. When I unclick the Trust Center Add-Ins setting "Require Application Add-ins to be signed by Trusted Publisher" restart Excel, the addin loads up, the Ribbon appears and the CTP appears when I click the Show CTP button. It also drags/docks updates the status bar etc. I note that the RTD registration stuff in 0.32 is working fine for me without UAC. Govert, what are you registering for the InProcServer32 for the CLSID? It looks like (based on looking at the code in ComRegistration.cs) that something called DnaLibrary.XllPath. I presume that this is the same as the XLL for the (ExcelDNA) addin itself, right? I'm afraid that I don't know much at all about code-signing but if at all possible, I would greatly prefer if the CTPs could be run without having to drop the Trust Center levels.


pjjH

 C:\packages\ExcelDna-0.32\Distribution\Samples>md5sum CustomTaskPane.dna
0ea9649384bd2d9a167e5bd051d09d3e *CustomTaskPane.dna



Microsoft ExceID 2010 (14.0.7109.5000) SP2 MSO (14.0.7116.5000)
Part of Microsoft Office Professonal PIus 2010

Paul Harrington

未读,
2014年8月6日 23:34:312014/8/6
收件人 exce...@googlegroups.com、sgoli...@neovest.com





I am not sure if the screen-grabs went through but I took a look at the trust center stuff to confirm my assumption that the COM add and Excel Addin were the same file and it looks like Excel thinks they are different (e.g. there is no publisher). I would be curious to see if other people could recreate this. The fact that the COM addin is consed up dyanmically seems to categorically rule out using a Trust Center level of requiring application addins to be signed (unless, of course, the users have access to a cert which is a trusted publisher but that kind of defeats the purpose!)

Govert van Drimmelen

未读,
2014年8月7日 15:06:112014/8/7
收件人 exce...@googlegroups.com、sgoli...@neovest.com
Hi Paul,

I'm not sure you have the same problem that Scott reports. He seems to have problems with the ribbon (which is also a dynamically loaded and registered COM add-in), which seems to work fine for you.

I think your issue is the same as reported here: https://exceldna.codeplex.com/workitem/9366

Indeed the DnaLibrary.XllPath should be the .xll file, which as you say is signed. Already when the ribbon is loaded, I load a COM add-in and you should get problems if Excel is unhappy with the dynamic registration.
The Custom Task Panes have a COM add-in registered dynamically like the ribbon, so I'm not sure how Excel deals with it differently.

I'd love to sort this out too, but am not sure where to even start looking. My only clue is that the ribbon seems to work, and the CustomTaskPane host is failing.
Is Excel perhaps reading the registry differently?

-Govert

Paul Harrington

未读,
2014年8月7日 15:28:182014/8/7
收件人 exce...@googlegroups.com、sgoli...@neovest.com
Yes, my problem is exactly the same as the one on  https://exceldna.codeplex.com/workitem/9366 (I am going to put in a backlink there to this thread). I will follow up on that thread.

thanks,
pjjH

James

未读,
2015年7月15日 19:51:272015/7/15
收件人 exce...@googlegroups.com、sgoli...@neovest.com
I've just seen this issue..

And it turned out to be my App was in the Disabled Application Add-ins..

Enabling it fixed the issue.

James
回复全部
回复作者
转发
0 个新帖子