ApplicationDeployment.CurrentVersion ApplicationDeployment.CurrentVersion ApplicationDeployment.CurrentVersion ApplicationDeployment.CurrentVersion Property

定義

アプリケーションの現在実行中のインスタンスの配置のバージョンを取得します。Gets the version of the deployment for the current running instance of the application.

public:
 property Version ^ CurrentVersion { Version ^ get(); };
public Version CurrentVersion { get; }
member this.CurrentVersion : Version
Public ReadOnly Property CurrentVersion As Version

プロパティ値

現在の配置のバージョン。The current deployment version.

次のコード例では、がアプリケーションをClickOnceClickOnce更新したかどうかを判断するメソッドを定義します。The following code example defines a method that determines whether ClickOnceClickOnce has updated the application.

public:
    bool CheckForUpdateDue()
    {
        bool isUpdateDue = false;

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

        return (isUpdateDue);
    }
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);
}
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

注釈

CurrentVersionは、新しいUpdatedVersion更新プログラムがインストールされているが、まだを呼び出しRestartていない場合とは異なります。CurrentVersion will differ from UpdatedVersion if a new update has been installed but you have not yet called Restart. 自動更新を実行するように配置マニフェストが構成されている場合は、これら2つの値を比較して、アプリケーションを再起動する必要があるかどうかを判断できます。If the deployment manifest is configured to perform automatic updates, you can compare these two values to determine if you should restart the application.

セキュリティ

PermissionSet
ローカルコンピューターへのフルアクセス。For full access to the local computer. PermissionState (関連する列挙体)Associated enumeration: PermissionState.

適用対象

こちらもご覧ください