[ACCEPTED]-File Exists in WPF-c#

Accepted answer
Score: 10

Try this to get the file in the executables 1 directory.

string directory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
string filePath = Path.Combine(directory, "SomeFile.exe");

if (!File.Exists(filePath))
    // 1337 code here plx.
Score: 2

If your testing it from VS then the current 2 directory is the Project dir not the release/debug 1 folder (where your exe is)

More Related questions