I am building a DLL that is used by Office. When Office runs with it, I would like to identify where it is located. Is that possible?
ex. of code within the DLL when it is run within Office:
// should return C:\tmp\officeaddin.dll,
// currently C:\Program Files\Microsoft Office\Office 12
MessageBox.Show(Application.StartupPath)
The following should work even if running inside of Office:
Getting the path of the current assembly
(It basically boils down to Assembly.GetExecutingAssembly().Location
, but see the link above for more detailed information.)