Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Deployment Issue - Modifying Config File dynamically by application users without Admin access
 

Deployment Issue - Modifying Config File dynamically by application users without Admin access

Hi All,
My application stores a couple of settings in config file(user credentials,display preferences) andcertain file pathsin an xml file.
I want the config file to be available per user basis becauseit has certain settings as per user's choice for e.g. login credentials.
Application users are not admins on their machines and so an admin installs them.

1. Is there a way during setup to specify the installation for a specific user (say user A) while installing as an admin (say user B)



2. At run time the application users need to have write permissions toan xmlfile in order to change certain file paths.
My users are not administrators on their machines but need to modify this xml file while running the application thru the GUI.

One solution I was thinking is not to install the application in Program Files folder but just create a new folder on the target file system and dump the exe, config and xml file (content files)in it. I was able to do this as well with a setup project. But I am not sure whether this is the best approach.


3. Is it possible to store the config file and xml file in user's documents folder and the main executable in program files folder so that each logged in user can have their own preferences and credentials?


Can someone please let me know a better/clean solution.

Thanks,
Nick
  • Moved byYiChun ChenMSFTWednesday, September 16, 2009 5:51 AMDeployment issue (From:.NET Framework Setup)
  •  
nick_tej  Monday, September 14, 2009 7:56 AM
The only likely folders hereare the User's Application Data Folder, based on the MSI AppDataFolder property, or the User's Personal Data Folder, based on the PersonalFolder MSI property. Note that if User B installs the setup then there is no broadcast of the file to all the possible users of the system. What happens is that when some other user logs on and uses the app via a shortcut the Xml file is missing, and a repair asks for the CD image to install that file to that user's file location.

A possible solution is to install the default file in somelocation like the Program Files folder, and then when a user first uses the app (remember this with a HKCU registry item) the app copies the file to a user-specific folder. The user needs only read access to copy the file to a personal location where it can be updated. You never update the copy in the Program Files folder.

Alternatively if there isn't much data just use HKCU registry entries instead of Xml.
Phil Wilson
  • Marked As Answer bynick_tej Thursday, September 17, 2009 6:54 AM
  •  
PhilWilson  Monday, September 14, 2009 9:17 PM
The only likely folders hereare the User's Application Data Folder, based on the MSI AppDataFolder property, or the User's Personal Data Folder, based on the PersonalFolder MSI property. Note that if User B installs the setup then there is no broadcast of the file to all the possible users of the system. What happens is that when some other user logs on and uses the app via a shortcut the Xml file is missing, and a repair asks for the CD image to install that file to that user's file location.

A possible solution is to install the default file in somelocation like the Program Files folder, and then when a user first uses the app (remember this with a HKCU registry item) the app copies the file to a user-specific folder. The user needs only read access to copy the file to a personal location where it can be updated. You never update the copy in the Program Files folder.

Alternatively if there isn't much data just use HKCU registry entries instead of Xml.
Phil Wilson
  • Marked As Answer bynick_tej Thursday, September 17, 2009 6:54 AM
  •  
PhilWilson  Monday, September 14, 2009 9:17 PM
Thanks Phil.

How about the config file?I do have some user-specific data in it.
Can I copy the config as well to a user specific folder and get the exe to refer to it?

Update

1. Admin (say user B) installs the application on the machine for all users at ProgramFiles/ProductName ..
2. The executable,config file and the xml file are all copied in the above location
3. When a user logs in, I need to copy the config and the xml file to his AppData Folder and then the exe (at programFiles)should refer to these files at runtime

Is this a feasible solution/ recommended approach?
nick_tej  Tuesday, September 15, 2009 12:58 AM
Hi Nick,

I am moving this thread from Base ".NET Framework Setup" forum to the "ClickOnce and Setup & Deployment Projects" forum, since the issue is related to deployment. There are more deployment experts in the "ClickOnce and Setup & Deployment Projects" forum.

Thanks
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
YiChun Chen  Wednesday, September 16, 2009 5:51 AM

You can use google to search for other answers

Custom Search

More Threads

• problem with the installed program
• Launch Conditions - Registry Search problem
• Windows MSI metadata analyzing
• SETUP WIZARD USING MSCMS.LIB ONLY WORKS FOR XP AND NOT FOR VISTA
• Custom Actions - sourcepath not saved when vdproj is opned from new location
• Still waiting on GenerateBootstrapper
• Best way to maintain two setup projects for same app?
• application not running on computers without vb .net installed
• How to include custom prerequisites in to my setup project
• ClickOnce Deployment + Task Scheduler