Solved

Application path in vs2005 c#

Posted on 2010-11-22
11
677 Views
Last Modified: 2013-12-17
Hi,
how to retreive appication path in vs2005 c#?
thanks
0
Comment
Question by:bobdylan75
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 5

Assisted Solution

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

string a = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;

Open in new window

0
 
LVL 63

Assisted Solution

by:Fernando Soto
Fernando Soto earned 33 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 63

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 63

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 66 total points
ID: 34188289
AppDomain.CurrentDomain.SetupInformation.ApplicationBase is the best solution, also for the debugging purposes.
0
 

Accepted Solution

by:
roberto12cr earned 401 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 63

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

630 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