Click here to Skip to main content
15,891,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Using VB.NET, Visual Studio 2010...

I'd like to put a file in Common Files during installation. The problem is that once this is done the user running my program needs to be an admin to access it or I need to manually change the permissions on the file so regular user's can access it.. I want regular user's to be able to access this file without having to elevate their rights. If I try to install to the user's application folder Visual Studio gives me a warning that I shouldn't install into the user's profile directory because not everyone which be able to use the file which makes sense so...

Where would I install a file on a user's computer which would give regular user's full access to it? Thanks!

---
Specifically, this is a SQL Server CE database file. The user can navigate to the file to connect and then query the data source. The issue is that once installed only an admin can open the file unless I manually change the permissions and I would not like my user to have to do this. Thanks again!
Posted
Updated 8-May-12 8:02am
v3
Comments
Ganesan Senthilvel 8-May-12 13:28pm    
Usually c:\temp folder is accessible by every one. Have you tried it?
toadrw 8-May-12 13:57pm    
Hello Ganesan: I'd like this file to persist so I don't think that C:\temp is an option. Thank you.
Sergey Alexandrovich Kryukov 8-May-12 17:49pm    
No it is not an option. This folder is not legitimate. The correct answer is the one by Dave.
--SA
Maciej Los 8-May-12 17:47pm    
What kind of file you want to install on client computer?
If it is a file which is used by your application, i suggest you to install it into your application folder, for example: C:\Program Files\YouApplication\

1 solution

The normal place to put this is in a subfolder of the CommonApplicationData folder. You then change the permissions on that subfolder to give the Users group appropriate permissions depending on your requirements.
 
Share this answer
 
Comments
Maciej Los 8-May-12 17:55pm    
I can't agree with you. It depend on many things. For example: if it is a template, it could be installed into application directory, subfolder: Templates.
Let me explain. If in my network is over 1K computers and i need manually to change permission to CommonApplicationData folder... Thank you! I like job, but i'm constructively lazy.
My vote of 1.
Dave Kreskowiak 8-May-12 19:11pm    
You don't change the permissions manually. You set them inside the MSI.

In the past, people put files like that under Program Files, as you're pointed out. That bad practice is finally falling out of favor because of the undated security model of Vista and 7.

Templates are not executable code and users will normally have the ability to create their own templates. These kinds of files are normally found under CommonAppData or under an ApplicationData under the users profile.

All you have to do is look under C:\ProgramData (Win7) to see this and under C:\Documents and Settings\All Users\ApplicationData (?) (WinXP) to find proof.

Maciej Los 9-May-12 5:44am    
Thanks for reply and clarification of practice of installing files on Win Vista/7. Re-vote: 5
toadrw 9-May-12 12:19pm    
I think one of my issues is that we're using a Visual Studio deployment project to do this.

http://stackoverflow.com/questions/1623843/msi-installer-file-folder-permissions

"Visual Studio's setup projects does not support MSI's lock permission table, so if you need the folder you created to be writable to normal users in a setup project you need to grant the right in a custom action using SetNamedSecurityInfo."
Dave Kreskowiak 9-May-12 21:27pm    
Don't use that thing. It's a bare bones installer that doesn't support very much. Use a 3rd party produc like InstallShield or InnoSetup or Advanced Installer or WiX or ...

They all have support for setting permissions built in. No custom written code by your required.

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