Click here to Skip to main content
15,895,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an application in visual studio. In that application i have an .txt/.xml file which stores some data(we can say i have used file instead of database to store data) which is needed for application while running. File is stored/created in debug folder. In my application it is working parfactly alright. now i want to create setup for that project but when i create setup it is not inducing the file and giving me error 'file not found/access is denied' because of file is not there. Now my question is how to include that file and how to give permission to that file to access(read/write) it.
Posted

 
Share this answer
 
I think you are saying that the file is in the same directory as the .exe file (ie. Debug directory) when you are developing (which works fine) but does not work when deployed. This is not a good practice. The file should be set up to be used in a writable directory relevant to the application. A simplistic example would be "C:\Program Files\myapp\appfile.exe" for the app and "C:\Users\me\Documents\myapp\appfile.xml". These are simplistic examples and you should generalize the details by asking the operating system for the correct parent directory names (these differ by OS language and 32/64 bit OS for example). If the data is static it should be installed by the .msi; if it is dynamic it should be conditionally written and maintained by your app when it runs (eg. do you want to overwrite it when you update to a newer version of the software?).

I am not explaining myself very well. Here[^] is an excellent article that gives more robust details.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900