My.Application.IsNetworkDeployed Property
Gets a Boolean that represents whether the application was deployed from a network using ClickOnce.
' Usage
Dim value As Boolean = My.Application.IsNetworkDeployed
' Declaration
Public ReadOnly Property IsNetworkDeployed As Boolean
Return Value
A Boolean that represents whether the application was deployed from a network. The value is True if the current application was deployed from a network; otherwise the value is False.
Remarks
The My.Application.IsNetworkDeployed property indicates whether the application was deployed from a network using ClickOnce. For more information on ClickOnce applications, see ClickOnce Deployment.
You should check that this property is True before accessing the My.Application.Deployment Property. Otherwise, if the application is not deployed from a network using ClickOnce, reading the My.Application.Deployment property results in an InvalidDeploymentException exception.
For more information on configuring ClickOnce, see Publishing ClickOnce Applications. For more information on deploying a ClickOnce application, see How to: Publish a ClickOnce Application.
For more information on using the My.Application.IsNetworkDeployed property, see Overview of the Visual Basic Application Model.
Tasks
The following table lists examples of tasks involving the My.Application.IsNetworkDeployed property.
To | See |
---|---|
Check for an application update. |
|
Download an application update. |
Example
This example downloads and installs the update after checking that the application is deployed from a network. The Update method does not update the application unless it is out of date. The application has to restart to use the update. For more information, see How to: Download ClickOnce Application Updates.
Sub UpdateApplication()
If My.Application.IsNetworkDeployed Then
My.Application.Deployment.Update()
End If
End Sub
Only applications that are ClickOnce-deployed can be updated using the My.Application.Deployment object. For more information on deploying a ClickOnce application, see How to: Publish a ClickOnce Application.
Requirements
Namespace: Microsoft.VisualBasic.ApplicationServices
Class: ConsoleApplicationBase
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)
Availability by Project Type
Project type | Available |
---|---|
Windows Application |
Yes |
Class Library |
No |
Console Application |
Yes |
Windows Control Library |
No |
Web Control Library |
No |
Windows Service |
Yes |
Web Site |
No |
Permissions
The following permission may be necessary:
Permission | Description |
---|---|
Controls the ability to access files and folders. Associated enumeration: Unrestricted. |
For more information, see Code Access Security and Requesting Permissions.
See Also
Tasks
How to: Check for ClickOnce Application Updates
How to: Download ClickOnce Application Updates
How to: Publish a ClickOnce Application
Reference
My.Application Object
My.Application.Deployment Property
IsNetworkDeployed