Link to home
Start Free TrialLog in
Avatar of bhomass
bhomass

asked on

find the installation directory set by user

I am creating a c# app installation program using the VS .Net setup wizzard. The installation program allows the user to customize the installation directory as is usually done. is there a way I can capture the installation directory chosen during the installation process to store in the registry for later retrieval?

Thanks

Bruce
Avatar of Mohammed Nasman
Mohammed Nasman
Flag of Palestine, State of image

Hello

   Why you don't return the directory of your application when it's run?, this will work even if the user copy your exe to another place

use
      MessageBox.Show(Application.StartupPath.ToString());
      MessageBox.Show(System.AppDomain.CurrentDomain.BaseDirectory.ToString());

to return the path of your running application, you can get it then store it wherever
HTH


Regards,

                  
Avatar of bhomass
bhomass

ASKER

Hi mnasman

same answer as in my other thread. it is because I need this for an Excel add-in dll. the two calles you suggested will return path for Excel.exe, not my add-in.

Bruce
then use
     MessageBox.Show(Application.ExecutablePath.ToString());
Avatar of bhomass

ASKER

I have already determined that System.Reflection.Assembly.GetExecutingAssembly().Location.ToString() is the one that can give me the right path at run time.

I am leaving this question open to see if anyone can tell me how to find the user designated installation directory from the setup wizzard. I believe this can be done because there are many apps on my system which records the installation directory as a registry entry under HKEY_currentuser/software.

Bruce
ASKER CERTIFIED SOLUTION
Avatar of weareu
weareu
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
For more detailed instructions, please specify where help is needed...
Avatar of bhomass

ASKER

wonderful. Thanks