VSProject::WorkOffline Property
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.
Assembly: VSLangProj (in VSLangProj.dll)
Property Value
Type: System::BooleanFor Web applications, this property returns true if working offline and false if working online. For local projects, this property returns false.
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.
[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