ApplicationDeployment.TimeOfLastUpdateCheck Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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 {
	[PermissionSetAttribute(SecurityAction.Assert, Name = "FullTrust")]
	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);
}

PermissionSet

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

.NET Framework
Available since 2.0
Return to top
Show: