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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With