R – How to create a folder under %allusersprofile% during Setup with VS 2003 Setup Project

installationprogramdatasetup-projectvisual-studio-2003

I need to create a folder under "%allusersprofile%/Program Data" during the install process.

The Setup file is created with VS 2003 setup project, and in it you can use several Known Folders… but as I see none maps to %allusersprofile% or "%allusersprofile%/Program Data".

I thought that creating a "Custom Folder" (within VS Setup Project) and setting the TargetLocation as %allusersprofile% it would work, but during install it says that I don't have permission to that folder (and I do have).

Do you know how to target that folder in VS Setup Project?

Also…
I'm working in Windows XP, so %allusersprofile% maps to "C:\Documents and Settings\All Users", but there I suppose I should create my folder inside the "Program Data" folder.

In Vista, %allusersprofile% maps to "C:\ProgramData" and it look correct if I create my folder directly there.

Any idea how to target both OSs?

Additional info:
I'm trying this to avoid the new security features in Vista, where the app can't write files under the Program Files folder when running as a common user at least. So I need to place the writable files on "common" folder that is not in a "per user" basis.

Best Answer

Problem solved... In VS Setup Project you can create a folder saying that the DefaultLocation is: [CommonAppDataFolder]\[ProductName]

That works fine in MS Vista and in XP

Related Topic