views:

1211

answers:

2

How do you get the current directory where your app is running?

+5  A: 

You could try this:

using System.IO;
using System.Reflection;

namespace Utilities
{
    static public class DirectoryHelper
    {
        static public string GetCurrentDirectory ()
        {
            return Path.GetDirectoryName (Assembly.GetExecutingAssembly ().GetName ().CodeBase);
        }
    }
}
Kieron
+3  A: 

Try this:

Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
Todd