开发者

vsto add-in uses excel applicationdomain

开发者 https://www.devze.com 2023-02-19 01:02 出处:网络
I am working on the VSTO 2010 excel addin. On one of the dev machine i install the开发者_运维知识库 addin (which already has some addin installed).

I am working on the VSTO 2010 excel addin. On one of the dev machine i install the开发者_运维知识库 addin (which already has some addin installed).

I observed that it was not able to read the configuration file(). This happens because addin was trying to search the configuration file in the directory where Excel.exe is located.

On placing the configuration file (renamed it to Excel.exe.config) in same directory as Excel.exe, it worked fine.

May be it is loading in the same application domain as excel. But how to resolve this issue?

Please reply,

Thanks & regards, Diptesh.


This is a standard issue with addin programming. the default .net config stuff expects addin's to load their config from the hosting application's CONFIG file, which is, generally speaking a VERY BAD idea, since the hosting app might already have config in there, and you don't want to stomp it.

You can merge your config in with the host apps config file (Excel.exe.config in this case), or you can use ConfigurationManager.OpenExeConfig() to load a different config file specific for your DLL.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号