Just an update -
I have looked at this problem again. The error message, with code
0x8013150A (COR_E_SECURITY) is due to the interaction between the
Excel-DNA runtime loader and how VSTO uses the .NET Code Access
Security.
The problem should only occur if both the VSTO add-in and the Excel-
DNA add-in targets the .NET 2.0 runtime (which is also used in .NET
3.0 and 3.5). In this configuration the VSTO add-in cannot load the
Excel-DNA add-in successfully, either at start-up or from a ribbon or
event handler.
If either or both of the VSTO add-in and the Excel-DNA add-in
target .NET 4, everything should work fine.
----------
I don't know enough about how the .NET Code Access Security works to
address this further.
This previous thread, and the Microsoft support discussions linked to,
represent the current unresolved status:
http://groups.google.com/group/exceldna/browse_frm/thread/16cf3907473161e0.
-Govert
> I have another suggestion you might try.
> I suspect theVSTOstartup is a context in which you can't load the
> add-in - it's too early and Excel is still in some start-up state.
>
> Perhaps you can defer loading to some later event, or schedule the
> loading with a call to Application.OnTime(Now, "loaderMacro")
> where loaderMacro is some code in yourVSTOthat defines a macro (not
> sure how this can be done).
>
> As a small experiment, you might try to add a button or something to
> yourVSToadd-in, and see whether the RegisterXLL succeeds on the
> button handler. This would help distinguish security-related issues
> from problems realtaed to _when_ the RegisterXLL is called.
>
> -Govert
>
> On Jan 16, 9:47 am, Govert van Drimmelen <
gov...@icon.co.za> wrote:
>
>
>
>
>
>
>
> > Hi Paul,
>
> > I have no experience withVSTOor ClickOnce. Reports from other Excel-
> > DNA users suggest they have been very happy to move away fromVSTO.
>
> >VSTOruns in a .NET policy environment that I don't really understand,
> > and I have not found anyone who really does. This which might be
> > causing some of the problems you see. But I'm happy to have a look at
> > why your RegisterXLL call is failing.
>
> > You can mail me your skeleton project directly.
>
> > Regards,
> > Govert
>
> > On Jan 16, 1:30 am, Paul Sullivan <
paulsku...@gmail.com> wrote:
>
> > > Hi Govert,
>
> > > I have tried this repeatedly with the same result "the exceldna.loader
> > > assembly could not be loaded from the resource". I have stripped the
> > > add-in down to the minimum in that all it does is attempt to
> > > RegisterXll the xll (from theVSTOadd-in Startup event). There are no
> > > referenced dlls other than those created by default and it makes no
> > > difference if I a) set all to copy local and b) include all of them as
> > > references in the .dna file.
>
> > > Do you have an example project you could send me where this has been
> > > successfully implemented?
>
> > > Thanks
>
> > > Paul
>
> > > On Jan 4, 7:58 am, Govert van Drimmelen <
gov...@icon.co.za> wrote:
>
> > > > Hi Paul,
>
> > > > If you usingVSTOonly for the clickonce, I suspect you life will be easier with a roll-your-own updater, possibly implemented as a 'master' add-in that controls downloading and updating your real add-ins.
>
> > > > Anyway, the Application.RegisterXLL should work - what .NET version (there are sometimes security issues, especially loading from network)? Do you see anything interesting when running under the debugger?
>
> > > > An alternative is to call Application.AddIns.Add(...).Installed = true. But security issues are likely to be similar.
>
> > > > Otherwise write back, and I can have a closer look next week.
>
> > > > Regards,
> > > > Govert
>
> > > > On 04 Jan 2012, at 2:44, "Paul Sullivan" <
paulsku...@gmail.com> wrote:
>
> > > > > Anyone know how I do the above. I have a ExcelDna add-in that I want
> > > > > to compile as part of aVSTOadd-in to get the benefits of ClickOnce