Communication between a shimmed Excel automation add-in and a shimmed Excel COM add-in

E

edmundo.uno

My situation is that I have two C#/.Net Excel add-ins, an automation
add in to expose functions for the cells and a shared add in that
creates a menu. At the current time, both add ins use a static class to
store state information and to store data. Seeing a need to shim the
add ins, I went ahead and shimmed the add ins so each add in runs in
its own application domain. The problem is that the add ins now can't
share the same static data due to the fact that they're in separate
application domains. If would still like to have the add ins share
state information, what's the best way to accomplish this? It seems
that I have to use .Net remoting for the two to talk to each other. Is
that correct? Is it possible to have the add ins load into the same
application domain so they can share a static class?

Ed
 
M

Mike Walker [MVP]

Hi Ed

Remoting is the only way :(, we have a similar scenario, the other way is
you add the coding for the second managed addin into the same project and
share it that way :( not good for managability but this is a design benefit
according to Microsoft which there are arguments for this type of behaviour
but ppl working in Office on local machines do appreciate singletons for
this type of thing. If you hear anything on this but will be surprised let
me know

Regards

Mike Walker MVP
Visual Developer VSTO
Reply via NG
 
E

edmundo.uno

Mike,

I was looking at some documentation for the unmanaged API. It seems
like it's possible to modify the CRLLoader.cpp file generated by the
wizard to enumerate the existing appdomains and load the assembly into
the appdomain you want. If the two add-ins are in the same appdomain
that'll solve the problem. Is this possible? Would it work?

Ed
 
M

Mike Walker [MVP]

The appdomain is in process of the host, so word will have an appdomain
named x which is totally different from excel having an appdomain x, this is
unfortunate but there are currently no singletons in .NET V1.1 I heard a
rumor that the VB Compiler may offer some support for this in .NET 2 but not
heard anymore and or looked into this as would be a great help for us :)

Regards

Mike Walker MVP
Visual Developer VSTO
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top