ApplicationDeployment.CurrentVersion Property


Gets the version of the deployment for the current running instance of the application.

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

Public ReadOnly Property CurrentVersion As Version

Property Value

Type: System.Version

The current deployment version.

CurrentVersion will differ from UpdatedVersion if a new update has been installed but you have not yet called Restart. If the deployment manifest is configured to perform automatic updates, you can compare these two values to determine if you should restart the application.

The following code example defines a method that determines whether ClickOnce has updated the application.

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


For full access to the local computer. Associated enumeration: PermissionState.

.NET Framework
Available since 2.0
Return to top