[RESOLVED] Publishing A Mandatory Update With ClickOnce
I'm trying to add an automatic update feature if there is a mandatory update for my application using something like this:
vb.net Code:
'Check for mandatory updates
Private Sub MyApplication_CheckForUpdateCompleted(ByVal sender As Object, ByVal e As Deployment.Application.CheckForUpdateCompletedEventArgs)
If e.UpdateAvailable AndAlso e.IsUpdateRequired Then
AddHandler My.Application.Deployment.UpdateCompleted, AddressOf Me.MyApplication_UpdateCompleted
My.Application.Deployment.UpdateAsync()
End If
End Sub
Private Sub MyApplication_UpdateCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs)
If e.Error Is Nothing Then
MessageBox.Show("The application has installed a mandatory update and needs to be restarted.", "Update installed", MessageBoxButtons.OK, MessageBoxIcon.Information)
RemoveHandler My.Application.Deployment.UpdateCompleted, AddressOf Me.MyApplication_UpdateCompleted
Application.Restart()
End If
End Sub
My question is: how do I publish a mandatory version? I see no way of specifying when you publish that it is a required update.
Re: Publishing A Mandatory Update With ClickOnce
On the Publish tab of the Project Properties dialog click on the Updates button and specify the minimum required version, make sure the Publish Version is the same.
Re: Publishing A Mandatory Update With ClickOnce
I figured it would be something easy, thanks!