Question: Some resources I have in my project are fine and working Ok using string paths but what if I move the project to another directory or to another computer, it will stop working.

Please I need to get the path of the resources folder of my project in a string variable,

Something like this

```
C:\Users\User1\Documents\<projects folder>\<project name>\Resources\

```

Thanks in advance.

Answer: 
If the files are stored in your project folder, you can retrieve the files using 
`System.AppDomain.CurrentDomain.BaseDirectory`. 
This statement retrieves the path as to where your application is installed. 
Click [Here](http://msdn.microsoft.com/en-us/library/system.appdomain.basedirectory%28v=vs.110%29.aspx) to get a detailed explanation on this.
This might not be the cleanest way, but it has been useful to me. 

If you had a structure like:

```
C:\...\MyApp\app.exe
C:\...\MyApp\ConfigFiles\MyConfig.xml

```

The code will return a path relative to the running assembly. 

```
GetPath("ConfigFiles/MyConfig.xml") // returns the full path to MyConfig.xml

private string GetPath(string relativePath)
{
    var appPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
    string pattern = @"^(.+\\)(.+exe)$";
    Regex regex = new Regex(pattern, RegexOptions.None);
    var match = regex.Match(appPath);
    return System.IO.Path.GetFullPath(match.Groups[1].Value + relativePath);
}

```