I have a folder in my project. And inside that folder are files that my program is going to read from at run-time (i.e. most important one of them). So if the folder name is "xyxyxy" and if I am looking for the file "zzz.xml" in that folder I can access that file by
if (File.Exists(Environment.CurrentDirectory + "/xyxyxy/zzz.xml"))
MessageBox.Show("File found!");
else
MessageBox.Show("Not found!");
How can add this entire folder to the bin folder (both in debug and release)?
In Visual Studio, for the file you want to be copied to folders under bin, mark the Copy to Output Directory
property of the file as Copy always
. That should output the file, along with the folder structure to wherever the binaries are emitted.
You can simply add a post-build step for that in the project that contains the executable you are running. You can use the macro's to determine the exact directory that your dll's/exe are copied to to create your directory and files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With