Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Application path in vs2005 c#

Posted on 2010-11-22
11
Medium Priority
?
681 Views
Last Modified: 2013-12-17
Hi,
how to retreive appication path in vs2005 c#?
thanks
0
Comment
Question by:bobdylan75
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 5

Assisted Solution

by:buraksarica
buraksarica earned 264 total points
ID: 34188108
You can use :

string a = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;

Open in new window

0
 
LVL 64

Assisted Solution

by:Fernando Soto
Fernando Soto earned 132 total points
ID: 34188138

String appPath = Application.StartupPath;
0
 

Author Comment

by:bobdylan75
ID: 34188145
sorry, perhaps I explain wrong..
Is this the path of my c# application opened?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 64

Expert Comment

by:Fernando Soto
ID: 34188174
It is the path to where the executable is located in the system.
0
 

Author Comment

by:bobdylan75
ID: 34188176
FernandoSoto have I to add some "using" statement to call Application oblect?
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 34188210
It is in System.Windows.Forms namespace and should be there by default on a Windows Form application.
0
 
LVL 6

Expert Comment

by:ajb2222
ID: 34188247
if you want the path to the actual executable file with the executable name you use  Application.ExecutablePath

if you only want the path to the executable you would use Application.StartupPath.  
0
 
LVL 5

Assisted Solution

by:buraksarica
buraksarica earned 264 total points
ID: 34188289
AppDomain.CurrentDomain.SetupInformation.ApplicationBase is the best solution, also for the debugging purposes.
0
 

Accepted Solution

by:
roberto12cr earned 1604 total points
ID: 34188298
Try this:  Environment.CurrentDirectory
0
 

Author Comment

by:bobdylan75
ID: 34192374
sorry but the only solutuion that works is the roberto12cr's one.
parhaps due to my app isn't a windows app but only a console app??
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 34193633
Be careful not to change the current working directory in your program because if you do it will no longer point to where the executable is running from.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question