1

I am creating a application where I need to access images from a image folder in application files which I will add later after publishing the application. But the thing is when I access my application data path it is .../AppData/Temp...

Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

So what is the way to access the data in Application Files in .exe directory. My base directory is in Temp. But I want to access the one from where I executed the .exe

Omkar Frozen
  • 572
  • 6
  • 16
  • You need to explain what kind of “application files” you are talking about; app data? User data? config data? Consult [Where to store windows program data files](http://stackoverflow.com/questions/13483837/)? – Dour High Arch Aug 01 '16 at 17:05
  • Thank you for the quick response, I have created a application that needs to access images from a folder present in Application Files, which the client will add manually and then send the application to different users, So what I want is to access the folder present in Application Files, the later part is done, But when I try to access the Application Files, the exe is copied to AppData in temp folder and it uses Application Files which is copied to Roaming in Temp folder, But I have to access Application Files from Directory from where I started the application. – Omkar Frozen Aug 02 '16 at 04:06
  • When I run the exe it is copied to Temp folder for execution So when I want to get directory using 'AppDomain.CurrentDomain.BaseDirectory' it gives me the Temp folder path, but I want to access the directory from where I called the application. Which command will return me the original directory from where I called the exe ? – Omkar Frozen Aug 02 '16 at 04:13
  • I am little confused. Why the exe needs to be copied to the "temp" folder for execution. your problem will be solved if it runs from the location where it has been copied. – Bimal Aug 03 '16 at 11:18
  • It is done by the OS – Omkar Frozen Aug 04 '16 at 09:04

1 Answers1

3

See more How can I get the application's path in a .NET console application?

Sulotion:

 Path.Combine(System.Reflection.Assembly.GetExecutingAssembly().Location,@"/Images/logo.png");

I hope this helps you.

Community
  • 1
  • 1
Mr Biii
  • 31
  • 4
  • When I run the exe it is copied to Temp folder for execution So when I want to get directory using 'AppDomain.CurrentDomain.BaseDirectory' it gives me the Temp folder path, but I want to access the directory from where I called the application. Will this command return me the original directory from where I called the exe or the Temp directory? – Omkar Frozen Aug 02 '16 at 04:11