For the project I am working on, I am not allowed to use ClickOnce. My boss wants the program to look "real" (with an installer, etc).
I have installed Visual Studio 2012 Professional, and have been playing around with the InstallShield installer, and it definitely makes nice installers, but I can't figure out how to enable the application to "auto-update" (that is, when it starts up, checks to make sure that it is using the latest version).
I have been asked to make a tiny change to the code - switching an addition to a subtraction, and I don't really want people to have to uninstall the old version, and then have to reinstall the new version every time I make a small change like this.
How can I make the application check for updates, and install them? Or is this not possible (or not easy)?
In the program that you want to be auto updateable, you just need to call the AutoUpdate function in the Main procedure. The AutoUpdate function will check the version with the one read from a file located in a Web Site/FTP.
With a project selected in Solution Explorer, on the Project menu, click Properties. Click the Publish tab. Click the Updates button to open the Application Updates dialog box. In the Application Updates dialog box, make sure that the The application should check for updates check box is cleared.
There are a lot of questions already about this, so I will refer you to those.
One thing you want to make sure to prevent the need for uninstallation, is that you use the same upgrade code on every release, but change the product code. These values are located in the Installshield project properties.
Some references:
I think you should check the following project at codeplex.com http://autoupdater.codeplex.com/
This sample application is developed in C# as a library with the project name “AutoUpdater”. The DLL “AutoUpdater” can be used in a C# Windows application(WinForm and WPF).
There are certain features about the AutoUpdater:
How to use?
In the program that you want to be auto updateable, you just need to call the AutoUpdate function in the Main procedure. The AutoUpdate function will check the version with the one read from a file located in a Web Site/FTP. If the program version is lower than the one read the program downloads the auto update program and launches it and the function returns True, which means that an auto update will run and the current program should be closed. The auto update program receives several parameters from the program to be updated and performs the auto update necessary and after that launches the updated system.
#region check and download new version program bool bSuccess = false; IAutoUpdater autoUpdater = new AutoUpdater(); try { autoUpdater.Update(); bSuccess = true; } catch (WebException exp) { MessageBox.Show("Can not find the specified resource"); } catch (XmlException exp) { MessageBox.Show("Download the upgrade file error"); } catch (NotSupportedException exp) { MessageBox.Show("Upgrade address configuration error"); } catch (ArgumentException exp) { MessageBox.Show("Download the upgrade file error"); } catch (Exception exp) { MessageBox.Show("An error occurred during the upgrade process"); } finally { if (bSuccess == false) { try { autoUpdater.RollBack(); } catch (Exception) { //Log the message to your file or database } } } #endregion
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