Automatically force the ClickOnce app to update itself without prompting the user; less obtrusive, and enhanced security by ensuring the latest version is used.
This project is
available on Nuget
, which will handle all of the setup for you. It adds a post-build event to the project to run a powershell script that updates the ClickOnce application's minimum required version in the .csproj file to the latest published version.
This will eliminate the prompt that asks the user if they want to download and install the latest version; instead the update will automatically be downloaded and installed.
Because the .csproj file is modified outside of Visual Studio by the powershell script, the first successful build after publishing a new ClickOnce version of the app will ask you to reload the project. I recommend installing the
Workspace Reloader Visual Studio extension
to prevent the reloading of the project from closing any tabs that you have open.
Requires Visual Studio and PowerShell (and thus, the Windows operating system).
As you can see in the last screenshot, it adds a new “PostBuildScripts” folder to your project that contains the powershell script that is ran from the project’s post-build event.