You should not use Directory.GetCurrentDirectory()
in your case, as the current directory may differ from the execution folder, especially when you execute the program through a shortcut.
It's better to use Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
for your purpose. This returns the pathname where the currently executing assembly resides.
While my suggested approach allows you to differentiate between the executing assembly, the entry assembly or any other loaded assembly, as Soner G?nül said in his answer,
System.IO.Path.GetDirectoryName(Application.ExecutablePath);
may also be sufficient. This would be equal to
System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…