Click here to Skip to main content
11,708,892 members (73,834 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# Visual-Studio VB.NET
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 11-May-13 17:25pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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.

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 319
1 Maciej Los 235
2 Mika Wendelius 170
3 OriginalGriff 163
4 Peter Leow 139
0 OriginalGriff 9,253
1 Sergey Alexandrovich Kryukov 8,562
2 CPallini 5,189
3 Maciej Los 4,966
4 Mika Wendelius 3,856

Advertise | Privacy | Mobile
Web02 | 2.8.150819.1 | Last Updated 14 May 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100