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.
LVL 3
jayrodAsked:
Who is Participating?
 
jatinderalaghCommented:
Class is in System.Windows.Forms namespace
0
 
SThorogoodCommented:
Can you describe the paths to the various files - develepment, release, installation etc. Are you using VS.NET?
0
 
jayrodAuthor Commented:
yep.. vs.net.. I've cretaed an add-in solution so it uses the same setup as that project.

0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
SThorogoodCommented:
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?
0
 
jayrodAuthor Commented:
Nope.. that doesn't work either. I can't believe a thing like this is this friggin hard to do :(
0
 
jatinderalaghCommented:
Application.ExecutablePath;
Application.StartupPath;
0
 
jayrodAuthor Commented:
nope... still no go there.. The application is a .NET Add-in so it doesn't have a form :(
0
 
soumya_paridaCommented:
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.
0
 
jatinderalaghCommented:
System.Environment.CurrentDirectory property
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.