What's the best way to modify my installer application to install my exe and several data files into a location that all users can access? I want any XP/Vista/Win7 user to have the option on their start menu and desktop. Once they run this app, they need to be able to make write changes to a few of the data files that go along with the application. I currently am using the User Profile Roaming data folder or something like that.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
If users should be able to modify their own copy of the data, I would indeed user the Roaming data folder, unless the files are big, which is not good for roaming: Whenever the app is started, check if the files exist in user's roaming folder. If not, create the initial copy for that user from a common read-only copy in the program's directory.
OTOH, if users need to modify a common copy, then create a data subdirectory in the program's directory and modify its security descriptors to give Write access to the Users group. Here's some native code to do so. This code should of course be executed from the installer since it requires admin privileges.
EDIT: Oops! I just realize that I got code from this former SO question.
First you need to change your installation type to per-machine:
True
After that, you can configure the default installation folder:
in its Properties pane set DefaultLocation to:
[CommonAppDataFolder][Manufacturer]\[ProductName]
add your files in Application Folder
You can read more about CommonAppDataFolder here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa367992(v=vs.85).aspx
Finally, in the File System Editor you can add your shortcuts in
User's Desktop
folder. It uses DesktopFolder property which is automatically resolved to the All Users desktop for a per-machine installation.