Where can i put files so they will be in the same folder as the exe?
I've tried /bin, but this doesn't work.
61 Replies
(i am trying to store my custom settings file there, but it doesent update anymore...)
u put the file in the project folder
and then set them to copy if newer
the result is when u run or build or publish those files with be with the exe
alternatively u can make them resources which will embed the files in the assembly
and u can read / use them as reources
for a settings file
my recommendation is to use a common app folder
and when ur app first runs it creates the default settings there
ok. so is there i way i can tell it to copy the files back to the project folder when its done? My app has its own method for manipulating its settings, and i want to be able to watch that happen
what does this do exactly?
this is the filepath of the .exe?
It's AppData\Roaming\MyApp
no, its a common OS folder for apps to save data to
which is the indicated way to store those
like cotton said
C:\Users\username\AppData\Roaming\MyApp that is.
that is usually where u should be storing things like that
if for development purposes u want that file to be in your project list so u can easily modify it u can but I strongly advise u to use the above for the user.
U would need to do something like
as the path, the amount of fallback "../" will depend on the type of project
for example
that would be
../../../
to reach the project folder.
usually you shouldn't need to manually modify the settings file, u would do it via code and serialize it. Meaning the modifications should be done in code
not manually
and by serializing an instance of that u would get a well formatted json file with your settings in the appropriated directoryokk. let me explane a little more
Ive got an app i am developing. Its got some files, this settings file and a few others including my .db file, which it expects to find in its folder.
during development i need a to be able to see these files, manipulate them with other tools and see them update when my program runs. This used to be
/bin
i don't know how this changed, but the old versions of the default states of these files made it into this folder somehow.
when i deploy this app i am expecting these files to already be in the same place as the exe and they wont change when i update my application.
is ther any solution other than storeing these files in this mess of a folder? idealy in /bin?what I said initially
u put the files inside your solution explorer's project
then set it to copy if newer
it will be right next to the executable when u run, build or deploy
and u modify the files in the project not in the bin
but if my program makes changes to the file i wont see those changes.
u said it wont make changes
they update when my program runs
...see them update when my program runs. ...
and they wont change when i update my application.