I'm working on a custom updater application to work along side my main application in VB.NET that will download an update.zip file from a server that contains the freshly updated program files of my main application. It will extract the contents of the zip archive into the C:\Program Files\
directory of my application and replace any old app files.
My reason for doing this and not relying on a setup.exe/msi for updating is because it gets tedious for the user to have to go through a setup wizard every time my application wants to update. This means the user may not go through the setup wizard at all and miss out on an important update, be it a security patch or otherwise. So the idea of a background updater application seems like a more wise solution. The user can decide when he/she wants to check for updates, if they want to get beta releases, or if they want automatic updates at all.
To get the ProgramFiles directory I've been using Environment.CurrentDirectory
instead of a fixed string to identify the directory. The problem I have is that when my application tries to extract the zip archive into Program Files it fails. I need to know how to go about modifying, replacing and deleting files in the Program Files directory in VB.NET or C#.
This is not a duplicate of Can not create, modify text file into Program Files Folder of windows 7 as I'm not creating text(or other) files as a form of user data, I'm updating program files for my application. If it's not possible to alter program files without authorization I'd be happy to invoke UAC when the user clicks the update button.