Create Folder and File on Current User Profile, from Admin Profile

c# Delete file in all user in profile

From here you can get the windows users list, and then add it to your address to delete it

foreach(string userName in userList)
File.Delete(userName+@"\MyApplicationName\Directory\FileIWantToAccess\YouFileName");

AppDataFolder maps to wrong folder when installed by a standard user

Installing files to the user-profile is a problematic endeavor. Consider other approaches as explained here: Create folder and file on Current user profile, from Admin Profile.

That linked answer is somewhat over the top (it tries to summarize all the problems that can result from user-profile deployment), but basically you can have your application copy the file in question to the right user-profile folder on application launch for every user from a read-only template copy installed somewhere in the main application installation directory (under %ProgramFiles%).

Using the application to copy such files to the user-profile will eliminate a lot of deployment problems that can otherwise result. Please read the linked answer above for details.


As to what happens technically in your case, I am guessing that you have set a disk key-path for a per-user component. You need to set a HKCU registry path for such components if you want to avoid that erroneous link to the administrator folder.

UPDATE: Check if this explanation is better: http://forum.installsite.net/index.php?showtopic=21586#entry60600. By setting a HKCU path for the hosting component you won't get that hard coded name (erroneous) that is showing in red letters. Check the other answer below in the linked thread if the problem is still not clear.

If you chose to go down the HKCU key path approach, please read section 3: MSI Self-Repair in the linked answer at the top above.



Related Topics



Leave a reply



Submit