Click here to Skip to main content
Rate this: bad
good
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 18:25pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Rate this: bad
good
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.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 381
1 Sergey Alexandrovich Kryukov 265
2 Praneet Nadkar 237
3 Marcin Kozub 225
4 /\jmot 189
0 OriginalGriff 8,284
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,614
3 Maciej Los 4,989
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 14 May 2013
Copyright © CodeProject, 1999-2014
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