Reputation: 26505
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?
Upvotes: 6
Views: 2161
Reputation: 26505
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.
Upvotes: 2
Reputation: 1256
Have you tried adding them in as a reference? I believe that the add-in should know the location if you put them in that way. Just look at how it handles the Office Interops (and other references) when you add them in - no need to specify, just reference them in your code.
Upvotes: 0