Http://www.codeproject.com/Tips/869588/Auto-Updating-the-exe-from-a-network-location-when?msg=4992189#xx4992189xx
Using the Code
I wrote a simple console application in C # to accomplish this task
In the Program.cs itself I wrote the code to check updates and then executed the updated application
Collapse | Copy Code
Using System.Collections.Generic;Using System.Diagnostics;Using System.IO;Using System.Linq;Using System.Text;Using System.Threading.Tasks;Namespace shipitintro{Class Program {Staticvoid Main (String[] (args) {//Updatepath is the location where I upload updated exeString Updatepath =@"\\testserver\Art\ship It\shipit.exe ";//Applocation is the location from the where this console app runs. It'll also be the location where the new file would be savedString applocation = Directory.GetCurrentDirectory () +@"\shipit.exe ";try {FileInfo info1 =Null FileInfo Info2 =Nullif (file.exists (Updatepath)) {//If there is a file with the update location INFO1 would get the fileinfo of that file Info1 =New FileInfo (Updatepath); }if (file.exists (applocation)) {//If the EXE is already present in the aplocation get its information also Info2 =new FileInfo (applocation);} else {file.copy (Updatepath, applocation, true); Executeapp (applocation); return;} if (info1. LastWriteTime > Info2. LastWriteTime) {file.copy (Updatepath, applocation, true);}} catch (Exception ex) {Debug.WriteLine (ex. Message); } executeapp (Applocation); } static void Executeapp (string Location) {if (location) {file.exists catch (Exception ex) {Debug.WriteLine (ex. Message); return;} } else {}}}}
The function Executeapp () would help in starting the EXE from the location. Thus it makes sure, the user always use th E Latest EXE
Auto Updating the EXE from a network location when application starts Z