Reputation: 7435
I'm creating a Windows app that automatically updates itself. I'm not using ClickOnce for a variety of reasons. When I try to File.Move() my updated files to C:\Program Files on Windows 7, I get the following error:
Access to the path 'C:\Program Files\<company>\<app>\<app.exe>' is denied.
I am not given a UAC prompt. The exe that I am trying to update is not currently running.
Upvotes: 1
Views: 171
Reputation: 941357
You can't make changes in the program's install folder, you don't have the required admin privileges. Adding a manifest to your updater isn't practical, the user is quickly going to tire seeing the elevation prompt.
The only practical way is to run your updater as a scheduled task. Those tasks are permitted to run with admin privileges because it requires admin privileges to schedule one. Which you'll need to do with your installer.
Upvotes: 1
Reputation: 887375
Your problem is UAC, even though you aren't getting a UAC prompt.
You need to change your program's manifest to automatically elevate. (This will give you a UAC prompt)
Upvotes: 1