ApplicationDeployment.TimeOfLastUpdateCheck Property

Gets the date and the time ClickOnce last checked for an application update.

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

public DateTime TimeOfLastUpdateCheck { get; }

Property Value

Type: System.DateTime
The DateTime of the last update check.

A ClickOnce application can be configured for subscription updates. In this scenario, ClickOnce polls an application's deployment location automatically at intervals defined in the deployment manifest, and determines whether there is an update available. TimeOfLastUpdateCheck returns the time of the last update check regardless of whether it was initiated by a subscription or by an explicit check using the CheckForUpdate, CheckForUpdateAsync, CheckForDetailedUpdate, Update, or UpdateAsync method.

If no update check has been performed since the application was installed, TimeOfLastUpdateCheck returns the installation time.

The following code example checks whether a ClickOnce application has been checked for available updates in the past three days.

private Boolean CheckForUpdateDue()
{
    Boolean isUpdateDue = false;

    if (ApplicationDeployment.IsNetworkDeployed)
    {
        ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
        TimeSpan updateInterval = DateTime.Now - ad.TimeOfLastUpdateCheck;
        if (updateInterval.Days > 3)
        {
            isUpdateDue = true;
        }
    }

    return (isUpdateDue);
}

.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