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


アプリケーションを ClickOnce の配置の内部と外部の両方で実行する場合は、CurrentDeployment プロパティにアクセスする前に IsNetworkDeployed を調べます。たとえば、アプリケーションを配置する前に、ローカル コンピュータでそのアプリケーションをデバッグする必要がある場合などです。
アプリケーションがインストールされているのか、オンラインでホストされているのか、また、インストール元が Web サイト、ファイル共有、CD-ROM のいずれであるかに関係なく、IsNetworkDeployed は true を返します。

まず IsNetworkDeployed を使用してから CurrentDeployment を取得し、参照が null 参照 (Visual Basic では Nothing) でないことを確認するコード例を次に示します。
private void UpdateApplication() { if (ApplicationDeployment.IsNetworkDeployed) { ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment; ad.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(ad_CheckForUpdateCompleted); ad.CheckForUpdateProgressChanged += new DeploymentProgressChangedEventHandler(ad_CheckForUpdateProgressChanged); ad.CheckForUpdateAsync(); } } void ad_CheckForUpdateProgressChanged(object sender, DeploymentProgressChangedEventArgs e) { downloadStatus.Text = String.Format("Downloading: {0}. {1:D}K of {2:D}K downloaded.", GetProgressString(e.State), e.BytesCompleted/1024, e.BytesTotal/1024); } string GetProgressString(DeploymentProgressState state) { if (state == DeploymentProgressState.DownloadingApplicationFiles) { return "application files"; } else if (state == DeploymentProgressState.DownloadingApplicationInformation) { return "application manifest"; } else { return "deployment manifest"; } } void ad_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e) { if (e.Error != null) { MessageBox.Show("ERROR: Could not retrieve new version of the application. Reason: \n" + e.Error.Message + "\nPlease report this error to the system administrator."); return; } else if (e.Cancelled == true) { MessageBox.Show("The update was cancelled."); } // Ask the user if they would like to update the application now. if (e.UpdateAvailable) { sizeOfUpdate = e.UpdateSizeBytes; if (!e.IsUpdateRequired) { DialogResult dr = MessageBox.Show("An update is available. Would you like to update the application now?\n\nEstimated Download Time: ", "Update Available", MessageBoxButtons.OKCancel); if (DialogResult.OK == dr) { BeginUpdate(); } } else { MessageBox.Show("A mandatory update is available for your application. We will install the update now, after which we will save all of your in-progress data and restart your application."); BeginUpdate(); } } }
public: void LaunchUpdate() { if (ApplicationDeployment::IsNetworkDeployed) { ApplicationDeployment^ launchAppDeployment = ApplicationDeployment::CurrentDeployment; // Launch synchronous or asynchronous update. } }


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に収録されているすべての辞書からApplicationDeployment.IsNetworkDeployed プロパティを検索する場合は、下記のリンクをクリックしてください。

- ApplicationDeployment.IsNetworkDeployed プロパティのページへのリンク