Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically install updates with ClickOnce deployment

I wanted to deploy my project with ClickOnce deployment. But when I did it like that, it was asking in a dialog box at the end user machine:

A new version of XXXX is available. Do you want to download it now?

But my end users don't have a mouse or keyboard. So my intention is: It must take the updates automatically, but it must NOT ask that dialog box at the client side. How do I achieve this by using ClickOnce deployment?

like image 971
user1054625 Avatar asked Oct 11 '12 15:10

user1054625


People also ask

How do I manage updates for a ClickOnce application?

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 check box The application should check for updates is selected. In the Choose when the application should check for updates section, select After the application starts.

Is ClickOnce still supported?

ClickOnce and DirectInvoke in Microsoft Edge | Microsoft Learn. This browser is no longer supported. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

What is ClickOnce deployment?

ClickOnce is a deployment technology that enables you to create self-updating Windows-based applications that can be installed and run with minimal user interaction.


1 Answers

Looks like you can do this by changing some properties in the build.

http://blog.jnericks.com/configuring-msbuild-to-auto-update-clickonce

  1. MinimumRequiredVersion - Tells ClickOnce that when it updates this application it should update to this version (however this does not force ClickOnce to perform the update). As you can see we set this to the same version number that the ApplicationVersion is set to so that the MinimumRequiredVersion is always the latest version.
  2. UpdateMode=Foreground - Tells ClickOnce to update the application before it is opened.
  3. UpdateRequired=True - Tells ClickOnce to automatically perform the update.

No MSBuild scenario:

  1. Right Click your project and select Properties
  2. Go to the "Publish" tab on the bottom left
  3. Click the "Updates..." button to open the Application Updates dialog
  4. Check "The application should check for updates"
  5. Select "Before the application starts"
  6. Check "Specify a minimum required version for this application"
  7. Enter the Publish Version that you can see in the underlying Publish window as the minimum version. Unfortunately, you have to change this every publish. There might be a way for this to be auto, though.

Then publish the application and test it. This was worked fine for me on a local test application.

Edit: looks like some people have been getting the minimum required version to update, might want to look into their solutions.

Edit 2: Image showing where versioning is important:

Minimum Version

Also, note I have "Automatically increment revision with each publish" checked. Every time you go into the Properties for the project, that version will be up to date. You'll generally just have to change the "Revision" part of the Version in the "Application Updates" window to match the "Revision" in the Publish tab.

like image 88
Gromer Avatar answered Nov 11 '22 16:11

Gromer