Question: i have some files located in 

c:\MyApp\file.txt

and current executing assenbly in in debud filder

c:\MyApp\bin\Debug\

i want to get address of above "file.txt" at run time..

i tried this

Assembly.GetExecutingAssembly().Location

it gives me 
c:\MyApp\bin\Debug\MyApp.exe

how can i get address of "file.txt"

Answer: 
You can't, since the file and the compiled application have no relation. What if you moved the MyApp.exe somewhere else?

You have 2 options: 

1. Include file.txt in your project as a content file (it will be included in the output and in the same folder as MyApp.exe)
2. Use configuration - allow a user option to define where to find the file. You can use AppSettings for this, for example.

Well, technically you can, since you can always navigate to the parent of the current directory ("MyAppPath\.."), but that's really just a bad idea...
Your executable folder path can be retrieved with :

```
AppDomain.CurrentDomain.BaseDirectory

```

In order to get what you want you could do the following

```
string fileTxtPath = AppDomain.CurrentDomain.BaseDirectory + "..\\file.txt";

```

Of course if you have a file that is related to your project then you should include it in the same folder as your executable. Right click it from visual studio and go to properties, then select in the option Copy to Output Directory the Copy Always option.