Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Outlook 2007 Addin C# - Startup Path

I am using some Win32 dlls in an Outlook 2007 add-in.

So I added the dlls, with build action "Content" and copy to local directory.

To get the path to them, I would normally use:

Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "MyDll.dll");

When published by ClickOnce, Assembly.GetExecutingAssembly not giving me the standard path to all my ClickOnce files. My files are in %appdata%..\Local\Apps\2.0, but the assembly is in %appdata%..\Local\assembly.

Is there a better way to get the path to these dlls from within an Outlook add-in deployed by ClickOnce?

like image 465
jonathanpeppers Avatar asked Jan 10 '11 15:01

jonathanpeppers


1 Answers

This code is giving me the correct path now:

string path = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "MyDll.dll");

I've had to use SetupInformation when parsing command-line arguments, and some debugging led me to this property.

I will post back if it gives me any trouble, as we will need to install on several machines and see what happens.

like image 180
jonathanpeppers Avatar answered Oct 08 '22 08:10

jonathanpeppers