This documentation is archived and is not being maintained.

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)

public static ApplicationDeployment CurrentDeployment { get; }
/** @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 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);
}

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
Show: