CurrentDeployment Property

ApplicationDeployment.CurrentDeployment Property

Note: This property is new in the .NET Framework version 2.0.

Returns the current ApplicationDeployment for this deployment.

Namespace: System.Deployment.Application
Assembly: System.Deployment (in system.deployment.dll)

'Declaration
Public Shared ReadOnly Property CurrentDeployment As ApplicationDeployment
'Usage
Dim value As ApplicationDeployment

value = ApplicationDeployment.CurrentDeployment

/** @property */
public static ApplicationDeployment get_CurrentDeployment ()

public static function get CurrentDeployment () : ApplicationDeployment

Property Value

The current deployment.

Exception typeCondition

InvalidDeploymentException

You attempted to call this static property from a non- ClickOnce application.

You cannot create instances of ApplicationDeployment directly in your application; you must retrieve a valid instance through this property.

The CurrentDeployment static property is only valid from within an application deployed using ClickOnce. Attempts to call this property from non- ClickOnce applications will throw an exception. If you are developing an application that may or may not be deployed using ClickOnce, use the IsNetworkDeployed property to test whether the current program is a ClickOnce application.

The following code example retrieves CurrentDeployment and checks to determine whether the application has been updated in the past three days.

Private Function CheckForUpdateDue() As Boolean
    Dim isUpdateDue As Boolean = False

    If (ApplicationDeployment.IsNetworkDeployed) Then
        Dim AD As ApplicationDeployment = ApplicationDeployment.CurrentDeployment
        Dim updateInterval As TimeSpan = DateTime.Now - AD.TimeOfLastUpdateCheck
        If (updateInterval.Days > 3) Then
            isUpdateDue = True
        End If
    End If

    CheckForUpdateDue = isUpdateDue
End Function

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2016 Microsoft