Click here to Skip to main content
15,910,661 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Dear all,
I use visual stdio 2010 to build an application. my application have a xml file (named info.xml). But when i package it to an install package, i have a problem.

When user install my application, all file copied to c:\\programfile\\Myapp\ (Myapp is folder that my application create when it was installed). But my application can not acess file (info.xml) in this folder to read.
How can i solve this problem. I think that my application need alway to run as administrator ( win 7), but i don't know how to build an app alway run as administrator.
Thank for any help
Posted

1 solution

You have two choices (at least I can suggest two):

1) Add custom action to your installation package that will change file permissions to allow everyone (or some specific users) to access your file

Take a look at FileInfo.GetAccessControl and FileSecurity.AddAccessRule classes/methods

2) to always ask for administrator rights you just have to update app.manifest file with appropriate tags, see http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/da5a8665-70da-43b0-b67d-5cfc9ff0c972[^] for more details
 
Share this answer
 
Comments
nguyenvanven 15-Jul-11 20:33pm    
Dear skv_lviv
Thank you very much. That solution work fine!
skv_lviv 16-Jul-11 2:25am    
You're welcome

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900