Sometimes, installing updates without elevation can be challenging, thus adding here a samples project to implement this could be of great help.
Useful resources:
- To get started with the updater, check the Configuring auto-updates for a Windows application article.
- To configure the Updater to install updates without elevation, follow the steps from the How to handle updates without elevation article.
- To configure the scheduled to run under the System account, check the How to run the Updater silently as a service at login article. The scheduled task will trigger the check for updates process, silently. In case an update is available, it will be automatically installed.
The updates are installed silently, the check for updates is happening at user logon, the check being triggered by a scheduled task configured to run under the System account. This way, the application can be updated under any user account from the machine, it doesn't matter if the user has admin privileges or not.
Also, there is another task that is being triggered hourly, indefinitely. So, multiple scenario can be implemented just by adding multiple tasks with different startup type.
Here's what the .zip archive contains:
where:
- SampleWinFormApp - is tthe VS project for the demo WinForm app
- Updates-SetupFiles - the output location of the updates file. This file is used by the updater to determine if an update is available or not
- v1 - where the project file and V1.0.0 of the installer is located.
- v2 - where the project file and V2.0.0 of the installer is located.
- activate logging.reg - Add these registry in case debugging is needed e.g. in case the installation fails to be installed.
- Updates.aip - project file that builds the updates file
How to test the sample app
To test the sample app, just install the Demo App.exe from the v1 folder: .\v1\Demo App-SetupFiles.
After the installation, there should be 2 shortcuts created on the desktop:
- 1.0.0 - Check for updates Demo App shortcut, this is a shortcut to the Updater so that you can even manually check for updates. Also, it contains version in its name to be easier to track installation of the updates
- Sample WinForm App which is a shortcut to the sample app
How to test updates installation?
To test the updates installation, just open the Task Scheduler and find any of the below tasks that can trigger the Updater to check for updates and automatically install them in case any update is found.
Basically, just need to pass the command line for the updater:
Code: Select all
/silentall -nogui -nofreqcheck
The updates should be installed automatically, no UI of the Updater or from the installer should be displayed during upgrade process. Also, the updates should be installed without any UAC prompt.
Some scenarios that should be covered
A common case that could happen is to have the application running. To be able to install updates, the application should not be running. The V2.0.0 will automatically close the application through a detect and stop running process approach. For details, check the How to detect or stop a process article.
How to debug falling installation
Double click the activate logging.reg file and answer "Yes" to the confirmation prompt.
Code: Select all
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Installer]
"Logging"="voicewarmup"
"Debug"=dword:00000007
The sample project is attached to this thread, so if you are interested to take a look directly at my project, you are more than welcome to download the project file.
Download sample project
Best regards,
Dan