0

I am using Properties to set the values of Registry entries. This is so that on install the first time I have a default value and then on upgrade the current registry value is used.

I need to have a property that sets the path to the user's local folder and to the programs folder. I know the below code is wrong but how do I do it. I think at least I want to do a Type 51 custom action but don't understand the documentation.

I believe there are three relevant parts

<InstallExecuteSequence>
    <Custom Action="SetUserFolder" Before="InstallInitialize"/>
    <Custom Action="SetInstallFolder" Before="InstallInitialize"/>
</InstallExecuteSequence>

Custom Action

<CustomAction Id="SetUserFolder" Property="UserFolder" Value="[%USERPROFILE]" />
<CustomAction Id="SetInstallFolder" Property="P_InstallFolder" Value="[%PROGRAMFILES]" />

The property.

<Property Id="P_MyAPPPATH" Value="[P_InstallFolder]MyApp\">
    <RegistrySearch Id="S_MyAppPath" Type="raw" Root="HKCU" Key="Software\MyApp\Settings" Name="MyAppPath"/>
</Property>
<Property Id="P_MyAPPDB" Value="[UserFolder]\MyApp\MyAppData\">
    <RegistrySearch Id="S_MyAPPDB" Type="raw" Root="HKCU" Key="Software\MyApp\Settings" Name="MyAppdb"/>
</Property>
darbid
  • 2,545
  • 23
  • 55

1 Answers1

1

As an alternative to using the properties you're defining, you might be able to use some built-in properties to better effect.

Instead of %USERPROFILE, consider LocalAppDataFolder. This will avoid your data from being copied between machines as a user roams between machines on a network domain. I'm guessing you don't need that but, if you do, use AppDataFolder and beware of the latencies involved.

Instead of %PROGRAMFILES, consider ProgramFilesFolder. This seems to be what you intend.

Tom Blodget
  • 20,260
  • 3
  • 39
  • 72
  • Yes Yes i would love to use them. The problem is how do I get them as the default property of the Property attribute? – darbid Jul 06 '13 at 19:30