We deploy a helper-executable along with our VSTO / Outlook AddIn via ClickOnce.
In the AddIn, we have a button which starts this helper-executable in a new process (it's needed because the AddIn runs as 32-bit / coupled with Outlook-bitness).
Until now I managed it by using Assembly.CodeBase
to get the path of the installed VSTO dll, where I also can find the helper-executable.
I can not use Assembly.Location
since this points to another cryptic cache-path where I can only find the current dll, not my installed bunch of dlls with helper-executable.
Now the problem: in .NET core / .NET 6, Assembly.CodeBase
is obsolete, so how can I find my helper-executable in my outlook add-in?
Any other ideas, how to achieve that? Thanks in advance.
You can use the System.AppDomain.CurrentDomain.BaseDirectory property which returns the base directory that the assembly resolver uses to probe for assemblies. See How to get folder path for ClickOnce application for other alternatives.