Make WIX installer place files in AppData

后端 未结 1 1896
眼角桃花
眼角桃花 2020-12-21 12:45

I\'m writing a dapp for ethereum client for windows. In order to make dapp available for user I have to place specific files in the folder in appdata. So I just should place

相关标签:
1条回答
  • 2020-12-21 13:42

    I am unfamiliar with this type of application (dapp for ethereum client for windows) - so the advice has to be generic I am afraid.

    Per-User Files & Registry Settings: In general deploying files to the user profile and HKCU settings is difficult with MSI. As Chris points out it basically just works for the user installing the MSI, unless you actively add constructs to get files copied to all user profiles, and even then it is sort of clunky.

    Approaches: I wrote a long answer a long time ago on the subject: Create folder and file on Current user profile, from Admin Profile (long and elaborate, but without any automagic solutions).

    Preferred Approach: Before getting involved in too much complexity, the easiest approach is generally to use your application to copy the userprofile files in place for every user on first launch - instead of using the setup to install user-specific files.

    This requires that there is a separate application executable to launch, generally via its own shortcut - which it might not be? It generally does not work for addins for example.

    • Approach 1: Install template files per-machine and then copy them to each user's userprofile on application launch.

    • Approach 2: Alternatively I like to download files directly from a server or database and put in the userprofile - also on first launch.

    Apply Updates?: There are ways to ensure that you can re-copy files if there are changes to your templates as described here: http://forum.installsite.net/index.php?showtopic=21552 (Feb 2019 converted to WayBack Machine link).


    Errors: The specific problem you report has to do with the need for a per-user registry key path and a RemoveFolder entry for all folders targeting userprofile locations:

      <Directory Id="AppDataFolder">
        <Directory Id="Parity">
          <Directory Id="dapps">
            <Directory Id="INSTALLFOLDER" Name="F2">
              <Component Guid="{77777777-7777-7777-7777-7777777777DD}" Feature="MainApplication">
    
                <RegistryKey Root="HKCU" Key="Software\TestManufacturer\TestApp">
                  <RegistryValue Name="Flag" Value="1" Type="string" KeyPath="yes" />
                </RegistryKey>
    
                <RemoveFolder Id="RemoveINSTALLFOLDER" Directory="INSTALLFOLDER" On="uninstall" />
                <RemoveFolder Id="RemoveParity" Directory="Parity" On="uninstall" />
                <RemoveFolder Id="Removedapps" Directory="dapps" On="uninstall" />
    
                <File Source="Test.exe" />
              </Component>
            </Directory>
          </Directory>
    

    This is just one of MSI's conventions and quirks. As already stated, install all files per-machine and copy them to the userprofile with the application instead. It will dis-entangle them from any setup interference in the future. Then you do not need to deal with these RemoveFolder issues.


    • WiX Installer - Children of LocalAppDataFolder installed to wrong location after UAC prompt
    0 讨论(0)
提交回复
热议问题