To put stuff in a sub-directory of the Common Application Data folder or Local Application Data from a VS Setup project, here's what you do:
Right-click your setup project in the Solution Explorer and pick "View -> File System".
Right-click "File system on target machine" and pick "Add Special Folder -> Custom Folder".
Rename the custom folder to "Common Application Data Folder." (This isn't the name that will be used for the resulting folder, it's just to help you keep it straight.)
Change the folder's DefaultLocation property to "[CommonAppDataFolder][Manufacturer]\[ProductName]" or "[LocalAppDataFolder][Manufacturer]\[ProductName]". Note the similarity with the DefaultLocation property of the Application Folder, including the odd use of a single backslash.
Marvel for a moment at the ridiculous (yet undeniable) fact that there is a folder property named "Property." Babies full of rabies, who comes up with this shit?
Change the folder's Property property to "COMMONAPPDATAFOLDER" or "LOCALAPPDATAFOLDER".
Data files placed in the "Common Application Data" folder will be copied to "\ProgramData\Manufacturer\ProductName" (on Vista) or "\Documents and Settings\All Users\Application Data\Manufacturer\ProductName" (on XP) when the installer is run.
Data files placed in the "Local Application Data" folder will be copied to "\Users\[username]\AppData\Local\Manufacturer\ProductName" (on Vista) or "\Documents and Settings\[username]\Application Data\Manufacturer\ProductName" (on XP) when the installer is run.
man, been looking for help like this forever.
ReplyDeletethank-you!
I'm glad I found this. It's exactly what I was looking for.
ReplyDeleteThanks!