MSI Installer file/folder permissions
I'm trying to install a set of files within the programdata folder using basic MSI installer. As the content of the files are dynamic and generated during the installation process, I'm creating the files in C# code during installation.
The files are created in the appropriate folders, and everything is good, except the files permissions. As I understand, files are supposed to inherit their permissions from the parent folder (if enabled), but in this case, this does not happen. The files I create should be writable for regular users, and i do not wan't to set permissions e开发者_Go百科xplicitly for each file created. Could the problem be that the installer runs with different permissions, and therefore the files does not inherit the permissions from their parent folders?
Thanks in advance for any help.
the installer runs with administrator access, which would allow it to change anything in program files. A normal user would have read only access to the program files folder and the ProgramData/Common Application Data folder.
MSI's lock permission table allows a setup program to change a folder's permission after creating in ProgramData/Common Application Data. 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 or modify the MSI database as a post build step. You can also find a MSI authoring software that can deal with MSI's lock permission table.
I had the very similar problem and I was able to solve it using the example here.
If you set the folder permissions manually with a Custom Action and generate and install the files with another Custom Action then the issue could be caused by the order of execution.
I've had a similar problem here. The problem here is that msi was creating the files with user SYSTEM. And the application during runtime was using the logged user (that didn't have write permission to this file). What I did is create a new file (if not exists) during application initialization with the one created by the installer. Then this file will have the write permission. It's not a good practice but solved my problem.
精彩评论