3

I have an app and I am working on the installer for it. Assuming that I want the installation to not require elevation and I want the application itself to never require elevation and I want the updater for the application (which is build in) to never require elevation where should I install the application to?

Caveats:

  1. This application is not signed.
  2. I am okay if each user has to install it separately under their profile.
  3. Can I use the registry in the install and accomplish the same goal?
  4. The only writes it makes are to setttings/configuration files.
  5. .NET 4 app.
ChrisWue
  • 18,612
  • 4
  • 58
  • 83
Seth Spearman
  • 6,710
  • 16
  • 60
  • 105

2 Answers2

3

A common choice is the local appdata folder returned by SHGetFolderPath(CSIDL_LOCAL_APPDATA) (Win2K and later) or SHGetKnownFolderPath(FOLDERID_LocalAppData) (Vista and later).

This returned path is something like:

  • "C:\Users\arx\AppData\Local" (Vista and later)
  • "C:\Documents and Settings\arx\Local Settings\Application Data" (pre-Vista)

It's normal to create company name and application folders under here, so you'll finish up with a path like:

"C:\Users\arx\AppData\Local\BlahSoft\BlahApplication"

Update

If you want this path from .Net you need Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)

arx
  • 16,686
  • 2
  • 44
  • 61
  • `SHGetKnownFolderPath` is a Win32 API, not .NET nor WIX. Also, `FOLDERID_LocalAppData` is to the application *data* folder, not the installed programs folder. – Dour High Arch Jan 03 '12 at 17:06
2

Your question is tagged both WIX and .NET; the two have different syntaxes for known-folder paths. The .NET command to get the current user application folder is Environment.GetFolderPath(Environment.SpecialFolder.Programs).

If you want to install to a WIX path, it has predefined properties for each known folder; [ProgramFilesFolder] is to the 32-bit application folder and [ProgramFiles64Folder] is to the 64-bit folder.

Dour High Arch
  • 21,513
  • 29
  • 75
  • 90
  • There isn't a per-user installed programs directory, so per-user programs tend to use the local app data directory. The SpecialFolder.Programs directory is for start-menu shortcuts, not for program files. [ProgramFilesFolder] and [ProgramFiles64Folder] require elevation. – arx Jan 03 '12 at 20:49