Outlook 2007 Addin C # - Startup Path

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

So, I added a dll, with the action line "Content" and copy to the local directory.

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

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

When publishing ClickOnce Assembly.GetExecutingAssembly does not give me the standard path to all of 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 the Outlook add-in deployed by ClickOnce?

+6
c # outlook clickonce outlook-addin
source share
3 answers

This code gives me the correct way:

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

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

I will send a message if this gives me any problems, since we will need to install on several machines and see what happens.

+2
source share

I think this is exactly what you are looking for - how to find the DLL that you deployed in your VSTO application.

http://robindotnet.wordpress.com/2010/07/11/how-do-i-programmatically-find-the-deployed-files-for-a-vsto-add-in/

+1
source share

Have you tried adding them as a link? I believe the add-in should know the location if you put them that way. Just look at how it handles Interops Office (and other links) when you add them - no need to specify, just link to them in your code.

0
source share

All Articles