0

How is it possible to access user's special folders from the Installer class (during installation)

pangular
  • 699
  • 7
  • 27

2 Answers2

0

I used this approach:

var username = Environment.GetEnvironmentVariable("USERNAME");

This allows me to access all user related special folder from the Installer class.

pangular
  • 699
  • 7
  • 27
0

It's usually best inside an install to use the standard folder properties - pass them into the installer class if necessary. The full list is here, and they are case-sensitive:

http://msdn.microsoft.com/en-us/library/aa370905(v=vs.85).aspx#system_folder_properties

The issue with using other methods is that deferred custom actions run with the local system account in a per-machine install, so when you ask for something for the "user" you'll get the equivalent for the system account which will not be what you want.

Look at the favorites folder here:

http://msdn.microsoft.com/en-us/library/aa368578(v=vs.85).aspx

PhilDW
  • 20,260
  • 1
  • 18
  • 28