Deployment Property


Deployment Property

Location

My.Application.Deployment

Syntax

     Dim result As System.Deployment.Application. _        ApplicationDeployment = My.Application.Deployment 

Description

The Deployment property returns the application's ClickOnce deployment object. This object provides features that let you update the application's installation. It includes features to check for the presence of an update and features that let you download updates interactively or in the background.

Public Members

The returned ApplicationDeployment object includes the following notable public members.

Member

Description

CheckForDetailedUpdate

Method. Queries the network source for the deployment to see if an updated version exists. If so, the returned System.Deployment.Application.UpdateCheckInfo object includes information about the update, such as its version number and size. An asynchronous version of this method also exists.

CheckForUpdate

Method. Returns a Boolean that indicates whether an update is available (true) or not (False).

CurrentVersion

Property. Indicates the version number of the currently deployed instance.

DownloadFileGroup

Method. Downloads a specific subgroup of deployment files from the network source. An asynchronous version of this method also exists.

Update

Method. Immediately updates this deployment from its network source. An asynchronous version of this method also exists.


Usage at a Glance

  • This property is read-only.

  • An exception is thrown if the application is not deployed as a ClickOnce application. Always use the My.Application.IsNetworkDeployed property first to confirm that the application was installed using ClickOnce.

Example

This sample code checks for an update.

     Public Sub CheckSoftwareUpdate(  )        ' ----- Ask the user about updating the software.        If (My.Application.IsNetworkDeployed = False) Then Exit Sub        Dim updateInfo As System.Deployment.Application. _           ApplicationDeployment = My.Application.Deployment        Dim details As System.Deployment.Application.UpdateCheckInfo        details = updateInfo.CheckForDetailedUpdate(  )        If (details.UpdateAvailable = True) Then           If (MsgBox("Version " & details.AvailableVersion.ToString & _                 " is available for download. Update now?", _              MsgBoxStyle.Question Or MsgBoxStyle.YesNo, "Update") _                 = MsgBoxResult.Yes) Then              ' ----- Continue with the update.              updateInfo.Update(  )           End If        End If     End Sub 

Related Framework Entries

  • Microsoft.VisualBasic.ApplicationServices.ConsoleApplicationBase.Deployment Property

  • System.Deployment.Application.ApplicationDeployment

See Also

Application Object, IsNetworkDeployed Property




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net