Find Install directory and working directory of VSTO Outlook Addin; or any Office Addin

前端 未结 5 1255
攒了一身酷
攒了一身酷 2020-12-06 02:40

I created a VSTO Outlook Addin that uses a library Html2Xhtml.dll (.NET) which calls another Html2xhtml.exe by executing System.Diagnostic.Process.Start().

However,

5条回答
  •  萌比男神i
    2020-12-06 03:15

    For COM plugins System.Reflection.Assembly.Location doesnt stable deliver what we need.

    But even if it's possible to save the installation directory anyhow in the registry, it's not neccessary. Because: A COM plugin has usualy a ID. You can define it with the GuidAttribute. During installation/registration of your plugin, informations about this assembly are stored under:

    Computer\HKEY_CLASSES_ROOT\CLSID\{...myPlugin id ....}\InprocServer32
    

    in attribute "Codebase" you find the path to your file.

    e.g.: file:///C:/Program Files/myPlugin.dll
    

提交回复
热议问题