ConsoleApplicationBase.Deployment Property

Gets the current application's ClickOnce deployment object, which provides support for updating the current deployment programmatically and support for the on-demand download of files.

Namespace:  Microsoft.VisualBasic.ApplicationServices
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

public ApplicationDeployment Deployment { get; }

Property Value

Type: System.Deployment.Application.ApplicationDeployment
Returns the ApplicationDeployment object for the application's ClickOnce deployment.

ExceptionCondition
InvalidDeploymentException

The application is not deployed as a ClickOnce application.

The My.Application.Deployment property returns the application's ClickOnce ApplicationDeployment object. The ApplicationDeployment object provides support for updating the current deployment programmatically as well as support for the on-demand download of files. For more information on ClickOnce applications and how to deploy them, see ClickOnce Security and Deployment and Publishing ClickOnce Applications.

Confirm that the IsNetworkDeployed property is True before you access the My.Application.Deployment property. Otherwise, if the application is not deployed using ClickOnce, reading the My.Application.Deployment property results in an InvalidDeploymentException exception. For more information on deploying a ClickOnce application, see How to: Publish a ClickOnce Application using the Publish Wizard.

For more information on using the My.Application.Deployment property, see Overview of the Visual Basic Application Model.

Availability by Project Type

Project type

Available

Windows Forms Application

Yes

Class Library

No

Console Application

Yes

Windows Forms Control Library

No

Web Control Library

No

Windows Service

Yes

Web Site

No

This example downloads and installs the update after checking that the application is network-deployed. The Update method does not update the application unless it is out of date. The application has to restart to use the update.

Sub UpdateApplication()
    If My.Application.IsNetworkDeployed Then
        My.Application.Deployment.Update()
    End If 
End Sub

Only applications that are ClickOnce deployed can be updated using the My.Application.Deployment object. For more information on deploying a ClickOnce application, see How to: Publish a ClickOnce Application using the Publish Wizard.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft