I have an application created in wpf which requires an updation when updation is available. Update is being compared from an xml file resides on server which contains software version. I have found a reference of video series of SharpUpdater on youtube link Sharp Updater in C#. It works fine for windows form application as I have downloaded and tried that in my application but when it comes to implement the same logic on wpf application it fails somewhere because the api used in this application have the references which work only of winform application. I have used another reference for auto updation Simple Auto Update, auto patch, for WPF Apps, without the Updater Block which also doesn't seem to work for my need. I am just curious to know how to place our downloaded .exe in program files when so many restriction are there. For Updation the previous .exe I have used following snippet
private void UpdateApplication(string tempFilePath, string currentPath, string newPath, string launchArgs)
{
string argument = "/C choice /C Y /N /D Y /T 4 & Del /F /Q \"{0}\" & choice /C Y /N /D Y /T 2 & Move /Y \"{1}\" \"{2}\" & Start \"\" /D \"{3}\" \"{4}\" {5}";
ProcessStartInfo Info = new ProcessStartInfo();
Info.Arguments = String.Format(argument, currentPath, tempFilePath, newPath, Path.GetDirectoryName(newPath), Path.GetFileName(newPath), launchArgs);
Info.WindowStyle = ProcessWindowStyle.Hidden;
Info.CreateNoWindow = true;
Info.FileName = "cmd.exe";
Process.Start(Info);
}
But it restricts me to place my downloaded file to the folder which is in program files. Thank you for your grace.
I would encourage you not to reinvent the wheel, and go with an existing, proven solution. While an auto-updating client seems simple at first, it can easily get difficult and into a mess if you're not covering various scenarios from the start.
ClickOnce has good built-in support in Visual Studio, .NET and Windows, but you can also run into security and deployment issues with it, especially if you're using a self-signed certificate. While I haven't had any huge issues with it, a lot of people feel badly about ClickOnce (but I'm not aware of a list anyway, as what I've read isn't normally backed up with specific technical details).
I'd be of the opinion that ClickOnce would be acceptable for internal or small projects, but not manageable for a wider release, especially across more than one customer.
Squirrel is a free, open source install and update solution.
If you've tried Visual Studio Code, then you've already experienced what a Squirrel install and update is like.
It is a one-click install that deploys to the user's local app data folder, so no administrative permissions / UAC is required. You can let it work using its defaults, or use their API to have more control over the update process. And if you don't like certain parts of it, you can always fork it and alter it for your own needs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With