Vinoth
Vinoth

Reputation: 1995

File not shipped in Appdata folder for Non Admin user in WIX

I have shipped some files in APPDATA location in my wix installer. I am using below code. It is installing the txt file in that location when run the setup in admin mode. But the file is not shipped for non admin user. Please help me to solve this issue.      

<CustomAction Id="PropertySource" Property="APPPATH" Value="[LocalAppDataFolder]APP1\APP2" /><Directory Id="APPPATH">
<Directory Id="Application">
    <Component Id="comp_txt" Guid="{10E0A568-3E37-49BD-A70B-8D7F63A17011}">
        <File Id="file_234487642387111122391332" Source="..\..\..\App.txt" />
    </Component>
</Directory></Directory>

Under InstallExecuteSequence and InstallUISequence

<Custom Action="PropertySource" Sequence="1278" />

Upvotes: 0

Views: 799

Answers (1)

Wim Coenen
Wim Coenen

Reputation: 66753

LocalAppDataFolder is already a valid directory ID. You don't need a custom action or APPDATA property. Just define app1 and app2 as subdirectories of LocalAppDataFolder the regular way, i.e. by nesting Directory elements.

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="LocalAppDataFolder">
        <Directory Id="app1folder" Name="App1">
            <Directory Id="app2folder" Name="App2" />
        </Directory>
    </Directory>
</Directory>

And then install your component in the desired folder:

<DirectoryRef="app2folder">
    <Component Id="App.txt">
        <File Source="..\..\..\App.txt" />
    </Component>
</DirectoryRef>

Also note that instead of using awkward paths like ..\..\..\App.txt, you could pass a base path to light.exe with the -b option like this:

light.exe -o mysetup.msi -b path\to\my\files *.wixobj

and then you can use paths relative to the base path in Source.

Upvotes: 1

Related Questions