CheckForUpdateCompletedEventArgs.MinimumRequiredVersion プロパティ
アセンブリ: System.Deployment (system.deployment.dll 内)

Dim instance As CheckForUpdateCompletedEventArgs Dim value As Version value = instance.MinimumRequiredVersion
すべてのユーザーがインストールしておく必要のある最も古いバージョンを表す Version オブジェクト。

ユーザーが通常とは違う業務に従事していたり、数週間から数か月もの間コンピュータを使用しなかったりすると、アプリケーションにとって必須の更新がインストールされていないことがあります。
MinimumRequiredVersion を使用して、ユーザーがしばらくの間アプリケーションをアップグレードしていないかどうか、および 1 つ以上の必須の更新がインストールされていないかどうかを判断します。

CheckForUpdateAsync を呼び出して、MinimumRequiredVersion が CurrentVersion より大きい場合は、強制的にアプリケーションを更新するコード例を次に示します。
Dim WithEvents ADCheckForUpdateAsyncMin As ApplicationDeployment Private Sub CheckForUpdateAsyncMin() If (ApplicationDeployment.IsNetworkDeployed) Then ADCheckForUpdateAsyncMin = ApplicationDeployment.CurrentDeployment ADCheckForUpdateAsyncMin.CheckForUpdate() End If End Sub Sub ADCheckForUpdateAsyncMin_CheckForUpdateCompleted(ByVal sender As Object, ByVal e As CheckForUpdateCompletedEventArgs) Handles ADCheckForUpdateAsyncMin.CheckForUpdateCompleted If Not (e.Error Is Nothing) Then MessageBox.Show("Could not install application update. Please try again later, or contact a system administrator.", "Application Update Error") Return Else If (e.Cancelled) Then MessageBox.Show("The application update has been cancelled.", "Application Update Cancelled") Return End If End If ADCheckForUpdateAsyncMin = ApplicationDeployment.CurrentDeployment If (e.MinimumRequiredVersion > ADCheckForUpdateAsyncMin.CurrentVersion) Then ' Launch an install of the minimum required version. ADCheckForUpdateAsyncMin.UpdateAsync() End If End Sub Sub ADCheckForUpdateAsyncMin_UpdateCompleted(ByVal sender As Object, ByVal e As AsyncCompletedEventArgs) Handles ADCheckForUpdateAsyncMin.UpdateCompleted ' Alert user that update is complete. If Not (e.Error Is Nothing) Then MessageBox.Show("Could not install application update. We will try and upgrade the application later.", "Application Update Error") Return Else If (e.Cancelled) Then MessageBox.Show("The application update has been cancelled.", "Application Update Cancelled") Return End If End If MessageBox.Show("The update was successful. Your application will now be restarted.", "Restart Application") Application.Restart() End Sub
ApplicationDeployment adCheckForUpdateAsyncMin; private void CheckForUpdateAsyncMin() { if (ApplicationDeployment.IsNetworkDeployed) { adCheckForUpdateAsyncMin = ApplicationDeployment.CurrentDeployment; adCheckForUpdateAsyncMin.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(adCheckForUpdateAsyncMin_CheckForUpdateCompleted); adCheckForUpdateAsyncMin.CheckForUpdate(); } } void adCheckForUpdateAsyncMin_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e) { if (e.Error != null) { MessageBox.Show("Could not install application update. Please try again later, or contact a system administrator.", "Application Update Error"); return; } else if (e.Cancelled) { MessageBox.Show("The application update has been cancelled.", "Application Update Cancelled"); return; } adCheckForUpdateAsyncMin = ApplicationDeployment.CurrentDeployment; if (e.MinimumRequiredVersion > adCheckForUpdateAsyncMin.CurrentVersion) { // Launch an install of the minimum required version. adCheckForUpdateAsyncMin.UpdateCompleted += new AsyncCompletedEventHandler(adCheckForUpdateAsyncMin_UpdateCompleted); adCheckForUpdateAsyncMin.UpdateAsync(); } } void adCheckForUpdateAsyncMin_UpdateCompleted(object sender, AsyncCompletedEventArgs e) { // Alert user that update is complete. if (e.Error != null) { MessageBox.Show("Could not install application update. We will try and upgrade the application later.", "Application Update Error"); return; } else if (e.Cancelled) { MessageBox.Show("The application update has been cancelled.", "Application Update Cancelled"); return; } MessageBox.Show("The update was successful. Your application will now be restarted.", "Restart Application"); Application.Restart(); }

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
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からCheckForUpdateCompletedEventArgs.MinimumRequiredVersion プロパティを検索する場合は、下記のリンクをクリックしてください。

- CheckForUpdateCompletedEventArgs.MinimumRequiredVersion プロパティのページへのリンク