Condividi tramite


VSProject.WorkOffline Property

Definition

Gets or sets whether a Web project is working online or offline. When it is working offline, development continues on an offline store of project files, so that the project files on the server are not changed.

public:
 property bool WorkOffline { bool get(); void set(bool value); };
public:
 property bool WorkOffline { bool get(); void set(bool value); };
[System.Runtime.InteropServices.DispId(10)]
public bool WorkOffline { [System.Runtime.InteropServices.DispId(10)] get; [System.Runtime.InteropServices.DispId(10)] set; }
[<System.Runtime.InteropServices.DispId(10)>]
[<get: System.Runtime.InteropServices.DispId(10)>]
[<set: System.Runtime.InteropServices.DispId(10)>]
member this.WorkOffline : bool with get, set
Public Property WorkOffline As Boolean

Property Value

For Web applications, this property returns true if working offline and false if working online. For local projects, this property returns false.

Attributes

Examples

[Visual Basic]

' Macro editor  
Imports VSLangProj  
Sub WorkOfflineExample()  
   ' This example assumes that the first project in the solution is   
   ' either a Visual Basic or C# project.  
   Dim aVSProject As VSProject = _  
      CType(DTE.Solution.Projects.Item(1).Object, VSProject)  

   msgbox("Work offline is: " & aVSProject.WorkOffline.ToString())  
   Try  
      MsgBox ("Setting WorkOffline to false.")  
      aVSProject.WorkOffline = False  
   Catch e As System.Exception  
      ' Setting the property fails for local projects.  
      MsgBox(e.Message)  
   End Try  

   Try  
      MsgBox ("Setting WorkOffline to true.")  
      aVSProject.WorkOffline = True  
   Catch e As System.Exception  
      ' Setting the property fails for local projects.  
      MsgBox(e.Message)  
   End Try  
End Sub  

Remarks

When the project is offline, no attempt is made to write to or access the project's files on the server.

To change the URL of the offline project files, use the OfflineURL property of the Project.Properties collection.

This property may be changed for Web projects only. While this is a read-write property, an error is generated if you attempt to set this property for a local project.

Applies to