1

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.

Lumo
  • 627
  • 6
  • 21
  • Try compiling in Net and then target Core/Net 6. Then you may need to download the runtime library for Core 6.0 : https://dotnet.microsoft.com/en-us/download/dotnet/6.0?force_isolation=true – jdweng Jan 24 '22 at 17:02
  • By the way, since I found out that Outlook AddIns are no longer supported for .net core /.net 6, this question is more ore less useless ;) – Lumo Oct 27 '22 at 12:23

1 Answers1

1

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.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45