I'm working on a small window form application. The application is working fine in visual studio but when I install that application with the installer. It created in my C:\Programfiles(x86){myprojectdirectory}, but the permission is read-only by default for this directory, so I'm not able to write(insert or update) data in my database(included in my project bin folder). I can only read(select data and show in grid view). I need to change the permissions of the directory manually. I there a way so to set the directory permissions when it is being installed.
Asked
Active
Viewed 1,257 times
0
-
1There are several predefined folders in windows with diferent intention what to keep there. Read the docs about those folders and pick the one that will fit best. Start @ [Environment.SpecialFiolders](https://msdn.microsoft.com/library/system.environment.specialfolder(v=vs.110).aspx) – Sir Rufo Jun 13 '18 at 09:22
-
See https://stackoverflow.com/questions/1556082/as-a-developer-how-should-i-use-the-special-folders-in-windows-vista-and-windo – Matthew Watson Jun 13 '18 at 09:23
-
Also https://stackoverflow.com/questions/50550404/unable-to-access-mdf-file-after-installing-application-using-visual-studio-setu – PhilDW Jun 20 '18 at 19:53
1 Answers
0
Finally, I got the reason. This is because when we install the application using the installer, it installed in the C:\ Drive as read-only when I change the permissions of my installed to read/write, it works fine. Also, you can run the application as the administrator to open it in read/write mode.
But the right solution is:
Write application data to C:\ProgramData or C:\Users{current_user}\AppData...

Mubsher Mughal
- 442
- 8
- 19
-
You got it wrong. See the links in the comments for your question. The bottom line: you should not write to your installation folder. You should write application data to `C:\ProgramData` or `C:\Users\
\AppData\...`, depending on your needs. – Tsahi Asher Jun 21 '18 at 07:56 -