C# Get Application Path
2014-11-28
I tried to use the traditional way to get an Windows form application path:
string applicationPath = “”;
…
applicationPath = Application.ExecutablePath;
This is correct for most of cases, but one day I downloaded a Microsoft sample application which came with .zip file, after upzip, all files located under a sub folder which ‘C#’, however, above code could not give me a correct path:
So what I could do is replace old code using the following:
applicationPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
Now the path is correct.