I am trying to write an installer (by creating a .vdproj) that will work on both Windows Vista and XP. The only thing I am finding is that when I try to run it on Vista, the files that I include in the installer are installed with Read-only permissions for the Users groups. This is a problem because the application needs to read/write from these files. The only way I have been able to get it to work is to either "Run as Administrator" or actually change the permissions. Does anyone know how to make these files be open to anyone to write? Thanks.
The Program Files folder and it's contents are read only for standard users. This is by design, and you'll find that this is the case on Windows XP as well. It's just that on windows xp, so many people run with administrator rights all the time that you might get away with it. If you ever want to distribute your app into a business environment, you'll soon find that it won't work on XP there, either.
The solution is to NOT place files in the program's executable folder if standard users will need write access. Put them in the Application Data folder instead. For most xp machines, that will be here:
C:\Documents And Settings\All Users\Application Data\Your App
However, that won't always be the case and it's a little different on Vista anyway, so make sure you get that path via the mechanism provided by your programming environment. In .Net, you can use the Environment.GetFolderPath()
function.
To add some detail to Joel's answer:
In Win2K and XP, CSIDL_APPDATA should be used for per-user, roaming. In Vista, this is the FOLDERID_RoamingAppData.
In Win2K and XP, CSIDL_LOCAL_APPDATA should be used for per-user, non-roaming. In Vista, this is FOLDERID_LocalAppData.
In Win2K and XP, CSIDL_COMMON_APPDATA should be used for per-machine, i.e. all users of an application. In Vista, this is FOLDERID_ProgramData.
NB This last folder is normally read-only to non-admin non-power users. The recommended solution to this is to create a read/write sub-folder during app installation.
EDIT: To get the actual locations of these constants on a specific machine using managed code, try System.Environment.GetFolderPath with the constants defined here. Another useful link is here.