0

Our WiX installer is configured to edit the registry by adding the following value to some existing key:

Name: "Shell"

Value: "{LocalAppData}\MyApplication\MyApplication.exe"

Right now I have hard-entered the value, but this is obviously very platform- and user- specific.

<Component Id="RegistryEntries">
  <RegistryKey 
     Root="HKCU"
     Key="Software\Microsoft\Windows NT\CurrentVersion\Winlogon"
     ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
    <RegistryValue 
        Type="string" 
        Name="Shell" 
        Value="C:\Users\Dave\AppData\Local\MyApplication\MyApplication.exe"/>
  </RegistryKey>
</Component>

How can I determine and use the local app data folder for the system?

I am using WiX 3.9 for Visual Studio 2013.

EDIT:

I did the following, and it cleaned all registry value from that key:

<Component Id="RegistryEntries">
  <RegistryKey 
     Root="HKCU"
     Key="Software\Microsoft\Windows NT\CurrentVersion\Winlogon"
     ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
    <RegistryValue 
        Type="string" 
        Name="Shell" 
        Value="[LocalAppData]\MyApplication\MyApplication.exe"/>
  </RegistryKey>
</Component>

Why would this happen?

EDIT 2:

Nevermind, I see that these properties will forcefully recreate the whole key:

ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes"
Dave New
  • 38,496
  • 59
  • 215
  • 394

2 Answers2

2

You're create the registry value as [AppDataFolder] to resolve it to the full path.

However, it looks like you want the path to an executable that you might be installing, so what works better is [#filekey] for that file.

PhilDW
  • 20,260
  • 1
  • 18
  • 28
0

To access a standard directory during a Microsoft Windows Installer WIX project, declare the correct Windows INstaller directory, then Define every SubFolder - https://msdn.microsoft.com/en-us/library/aa369768(v=vs.85).aspx

  <Directory Id="LocalAppDataFolder">    <!--  C:\Users\[LogonUser]\AppData\Local\  -->
    <Directory Id="Microsoft_FOLDER" Name="Microsoft" ShortName="MICROSOF">                       <!--  C:\Users\[LogonUser]\AppData\Local\Microsoft\  -->
      <Directory Id="InternetExplorer_FOLDER" Name="Internet Explorer" ShortName="INTERNET">     <!--  C:\Users\[LogonUser]\AppData\Local\Microsoft\Internet Explorer\  -->
        <Directory Id="QuickLaunchFolder" Name="Quick Launch"  ShortName="QUICKLAU" />           <!--  C:\Users\[LogonUser]\AppData\Local\Microsoft\Internet Explorer\Quick Launch\    End of QuickLaunchFolder  -->
      </Directory>          <!-- End of InternetExplorer_FOLDER -->
    </Directory>        <!-- End of Microsoft_FOLDER  -->
  </Directory>      <!-- End of LocalAppDataFolder  -->