I'm trying to add an automatic update feature if there is a mandatory update for my application using something like this:
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.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




Reply With Quote