I want to use a data file and read it from a WinForms app. If I use methods like Application.ExecutablePath or Application.StartupPath they reference the folder ..\bin\debug, which is different in non VS hosted app. I want to use a folder off the root folder and get a reference to it regardless if I am in debug mode or not, ie, it always works right.
What’s a good way to do it? I prefer not to use an embedded resource file and not use hard coded full paths. It needs to be a relative path off the app’s root folder.
Something like ~/App_Data in ASP.NET
Addition:
I want to use a relative path off “some path”. “Some path” is what I am seeking, regardless if I am in VS in debug mode, non debug mode or if the app is deployed. Just like ASP.NET’s “~”. It doesn’t care where the site is or if you’re in VS. I don’t want to create a folder under ‘debug’ folder. It’s the same folder no matter what. “Some folder” is also off the VS’s app folder because the app will be zipped to be used without deployment or publishing.
My solution. Go up two folder levels and then to data folder: