开发者

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(Ass开发者_高级运维embly.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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜