Custom Toolbar Installation Path

530
1
05-03-2012 01:38 PM
MartinLewis
New Contributor III
I've created a custom toolbar and a setup program (in .net) to install the toolbar.  This all works fine.

The toolbar has a custom bookmark function that saves data in a text file for storage/retrieval.  The problem I have is that I've stored this file in a folder under the toolbar installation folder and I need to recall this location programatically.

I'd like to avoid doing something like making an environment variable to hold the custom dll installation path.

Is there anyway to recall the installation path of a custom dll?
0 Kudos
1 Reply
AndryJoos
Occasional Contributor
Is there anyway to recall the installation path of a custom dll?


The location, where your assembly is installed/resides can be retrieved like this:

string path = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);


If you let the user install to a "protected" location (like c:\program files\something) you might need Administrator privileges to write to a file at the same path from your application.

Greetings,
Andry
0 Kudos