The last (I think) scenerio that we have to accomplish before we can know that wy will work is updating a service, using the wyUpdate.exe to check for and run the update.
The service has to self update, but it's not. The way I have it set up is basically to silent check and update with /fromservice. The check comes back with 2 indicating an update is available but it seems like the update exe never runs. When using the wyBuilder, I added 2 actions to stop and then start the service that needs updating.
It is written in C# but we have other services written in other languages that would have to use wyUpdate.exe to check and update.
Here is my code to check and run the update, which works on every other scenerio I've tested, except a service.
public int CheckForNewUpdate(string updaterPath) { var proc = new Process { StartInfo = new ProcessStartInfo { FileName = updaterPath, Arguments = "/quickcheck /justcheck /noerr", UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = false } };
proc.Start();
while (!proc.HasExited) { System.Threading.Thread.Sleep(50); }
var exitCode = proc.ExitCode;
return exitCode; }
public void SilentUpdate(int exitCode, string updaterPath) { if (exitCode == 0) { //no new update found return; } else if (exitCode == 1) { //error happened while checking for the update // can I get the error to log it? return; }
var proc = new Process { StartInfo = new ProcessStartInfo { FileName = updaterPath, Arguments = "/fromservice",//"/skipinfo", UseShellExecute = true, RedirectStandardOutput = true, CreateNoWindow = false, Verb = "runas" } };
proc.Start(); }
A little help would be greatly appreaciated!