How to get folder path for ClickOnce application

Tony_Henrich picture Tony_Henrich · Mar 1, 2010 · Viewed 225.9k times · Source

I need to write a file in the same folder where a console ClickOnce .application (executable file) resides. The folder where it launches from.

I tried using Application.StartupPath & Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) but the path is pointing to a subfolder under c:\Documents & Settings. How do I get the path where the .application resides in?

Answer

Erik Vullings picture Erik Vullings · Feb 22, 2012

To find the folder location, you can just run the app, open the task manager (CTRL-SHIFT-ESC), select the app and right-click|Open file location.