wyUpdater

Hi, is there a c# example of using wyUpdate to check for updates and then install them if they exist?

This is the code for starting my application and I imagine that the check for updates will be performed before the Application.Run command. I just can't find out how I can do this and the documentation is a bit thin to be honest.

static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false);

using (Mutex mutex = new Mutex(false, "LM")) { if (!mutex.WaitOne(0, false)) { return; } else { Application.Run(new FORMS.FrmDashBoard()); } } }

Start here: Walkthrough for your first time using wyBuild.

When you get to the integrating into your app part of the tutorial you'll have 2 choices:

  1. AutomaticUpdater control
  2. Or How to Silently Check for Updates

Does that make sense? So, if you just want to use wyUpdate, then launch wyUpdate with the appropriate commandline switches and then read the ExitCode of the process to determine if there are updates or not.

Yes, it does make sense. wyUpdate starts, finds the new update and then tells me that the process running my application must be closed in order to do the update. For some reason I can get past this. The code below shows what I'm doing.

static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false);

SilentUpdateCheck(); }

static void SilentUpdateCheck() { Process wuProcess = new Process { StartInfo = { FileName = string.Concat(Application.StartupPath, "\\", "wyUpdate.exe"), Arguments = " /quickcheck /noerr /justcheck" }, EnableRaisingEvents = true }; wuProcess.Exited += wuProcess_Exited; wuProcess.Start(); wuProcess.WaitForExit(); }

static void wuProcess_Exited(object sender, EventArgs e) { Process wuProcess = (Process)sender; wuProcess.Exited -= wuProcess_Exited;

if (wuProcess.ExitCode == 2) { wuProcess.Close(); Process update = new Process { StartInfo = { FileName = string.Concat(Application.StartupPath, "\\", "wyUpdate.exe") } }; update.Start(); } }

Sorry, can't get past. Not can get past

Here's an example of how to start a process, wait for it to exit, and then get the exit code: http://stackoverflow.com/questions/14070051/checking-if-process-returned-an-error-c-sharp.

If you're still having problems then you need to give me a lot more information. For example: What error are you getting? Do you get an exit code? What happens when you run wyUpdate by double clicking it?

Thanks

I don't double click wyUpdate.exe, I just run it from a process in the second event static void wuProcess_Exited(object sender, EventArgs e)

ExitCode = 2

The update window pops up, the update starts and then a messagebox informs me that the process for the application I'm calling wyUpdate.exe from must close in order for the update to finish.

The update window pops up, the update starts and then a messagebox informs me that the process for the application I'm calling wyUpdate.exe from must close in order for the update to finish.

Ok, then close your application immediately after launching wyUpdate. It will update your app, and then you can re-start your app after the update.