Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy files to CommonAppDataFolder?

In WiX I have

<Directory Id="CommonAppDataFolder">
    <Directory Id="CommonAppDataManufacturerFolder" Name="$(var.MANUFACTURER)">
        <Directory Id="AppDataFolder" Name="$(var.PRODUCTNAME)">
            <Directory Id="DatasFolder" Name="Datas"/>
        </Directory>
    </Directory>
</Directory>

and

<ComponentGroup Id="DatasComponents" Directory="DatasFolder">
    <Component Id="Database.sdf" Guid="4c33c78e-7113-4a8c-b9fd-6ba4f6490935">
        <File Id="Database.sdf" Source="Database.sdf" />
        <RemoveFolder Id='DatasFolder' On='uninstall' />
        <RegistryValue Root='HKCU'
                        Key='Software\[Manufacturer]\[ProductName]'
                        Type='string'
                        Value=''
                        KeyPath='yes' />
    </Component>
</ComponentGroup>

But the file is being copied to C:\Users\username\AppData\Roaming\Datas\ instead of %ProgramData%\Manufacturer\ProductName\Datas\

like image 947
Jader Dias Avatar asked Oct 20 '22 14:10

Jader Dias


1 Answers

The problem is that AppDataFolder is a reserved keyword that takes you to the Roaming data folder, I simply changed this id to a non-reserved keyword and my code worked

<Directory Id="CommonAppDataFolder">
    <Directory Id="CommonAppDataManufacturerFolder" Name="$(var.MANUFACTURER)">
        <Directory Id="MyAppDataFolder" Name="$(var.PRODUCTNAME)">
            <Directory Id="DatasFolder" Name="Datas"/>
        </Directory>
    </Directory>
</Directory>
like image 191
Jader Dias Avatar answered Dec 15 '22 06:12

Jader Dias