Find install folder

Add-in Express™ Support Service
That's what is more important than anything else

Find install folder
Word AddIn 
Andreas Waning


Guest


Hello,
in my installer I add a database file. This file is in the same folder, where all files are located. (dlls,etc)

How can I find this folder ? Application.Startup shows me the folder from Word.

Is there an easy way to find the folder with all my files.
(in my case C:\Users\AWaning\AppData\Local\Waning Software\GutachtenManagerWordAddIn)

Thanks Andreas
Posted 26 Apr, 2016 10:42:22 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Andreas,

You can use the following code to get the directory where the main assembly of your add-in is located:

Uri u = new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
string filePath = u.LocalPath;
string folder = System.IO.Path.GetDirectoryName(filePath);
//MessageBox.Show(folder);
Posted 27 Apr, 2016 04:13:31 Top
Andreas Waning


Guest


Thank you works fine !
Posted 27 Apr, 2016 06:33:09 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Andreas,

You are welcome!
Posted 27 Apr, 2016 07:18:01 Top