Link to home
Start Free TrialLog in
Avatar of jayrod
jayrodFlag for United States of America

asked on

Finding the install directory of an application

I need to get the installation of my installed application on the fly. HOw do I do this?

I tried this already..

appPath = System.Reflection.Assembly.GetExecutingAssembly.Location


but when I debug my executing dll seems to be the one in my development area not my release area.
SOLUTION
Avatar of SThorogood
SThorogood

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
Avatar of jayrod

ASKER

yep.. vs.net.. I've cretaed an add-in solution so it uses the same setup as that project.

Avatar of SThorogood
SThorogood

I'm not too familar with using/debugging installed apps but have you tried using:

AppDomain.CurrentDomain.BaseDirectory

as a way of resolving the base path?
Avatar of jayrod

ASKER

Nope.. that doesn't work either. I can't believe a thing like this is this friggin hard to do :(
Application.ExecutablePath;
Application.StartupPath;
ASKER CERTIFIED SOLUTION
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
Avatar of jayrod

ASKER

nope... still no go there.. The application is a .NET Add-in so it doesn't have a form :(
If you are checking the path while debugging, then it would give the path of your debug version and not the release version. To check the path in your release version , try to write the path into a file at runtime and check whether it is giving the correct result.
Again if you debug and try to see the value by adding watch it will not give the correct path, it would give the "debug" executables path in the developement folder.
System.Environment.CurrentDirectory property