Wix Toolset can't grant permission to user in install directory

560 views Asked by At

My app writes log using log4net in the appinstalldirectory\log directory but the app is not able to create log directory and create file. It was because on security tab current login user which is local admin in windows 10 was not added as list of user who has full access to that folder.

Thus in wix installer I have created a component as below

<CreateFolder>
    <util:PermissionEx
        GenericAll="yes"
        CreateFile="yes"
        User="[UserSID]"
        Domain="[%USERDOMAIN]"/>
    
    <!--<Permission 
        GenericAll="yes"
        CreateFile="yes"
        User="[UserSID]" 
        Domain="[%USERDOMAIN]"/>-->
</CreateFolder>

With PermissionEx the installer doesn't complete and show message as below https://i.stack.imgur.com/SiCbk.png Image when PermissionEx is used

But when is used I get error as below https://i.stack.imgur.com/AXNpO.png Image when Permission is used

When I check the usersid in command I can see that usersid https://i.stack.imgur.com/KDVpC.png Image of available user accounts

Could some one please point me what is wrong or what should I do? I don't want to keep modifying every system and grant current user full access so that my app can write log.

1

There are 1 answers

0
Nehluxhes On

Use the username, not the SID

<CreateFolder>
    <util:PermissionEx
        GenericAll="yes"
        CreateFile="yes"
        User="[LogonUser]"
        Domain="[%USERDOMAIN]"/>
</CreateFolder>