How to install to the current user's ApplicationData folder

Article:HOWTO4840  |  Created: 2005-09-27  |  Updated: 2007-07-19  |  Article URL http://www.symantec.com/docs/HOWTO4840
Article Type
How To



Question

How do I install to the current user's ApplicationData folder? For example, I would like to install some files to <user profile>\Application Data\PhotoWorks\SomeApp.

Answer

In order to install files to each user's profile, a self-repair of the application must occur. The component containing the file must also contain an HKCU registry key as the key path.

Perform the following to install a file to a folder in the user's profile and allow a self-repair to occur for other users of the application:

If you are placing the file directly in the user's profile (and not in the Application Data directory) complete steps 1–3. If you are putting the file in the Application Data directory or a sub-folder skip to step 4

  1. On the files page, add your file to a "placeholder" directory, such as MyProfile directly under the Destination Computer.
  2. Go to the MSI Script > Execute Immediate tab.
  3. After CostFinalize add a Set Directory custom action with the following values:
    • Custom Action Name: Unique name for this custom action
    • Directory: Click Browse and select the MyProfile directory
    • Directory Value: [%USERPROFILE]\FolderName
  4. Go to Setup Editor > Components tab, and find the component that contains your file. Usually this will be the name of the file
  5. Right-click the component and select New > Registry Key. A Registry item with empty registry hives appears
  6. Right-click HKEY_CURRENT_USER and select New > Registry Key.
  7. Enter the information for the key you wish to create. For example:
    • Operation: Create/update key and value
    • Root: HKEY_CURRENT_USER
    • Key: Software\MyApplication
    • Value Name: Repair UserProfile files 
    • Data Value: 1
    • Data Type: String
  8. Right-click the component and select details. The Component Details dialog appears.
  9. In the Key Path Type field, select Registry Key Path. This should update the Reg. Key Path field to contain the registry key you just created.

After installing the application, when you log on as a new user, a repair should occur because the HKCU key does not exist. When this repair occurs the file should also be installed to the specified directory in the user's profile.


Legacy ID



2648


Article URL http://www.symantec.com/docs/HOWTO4840


Terms of use for this information are found in Legal Notices