IDeploymentStep.CanExecute(IDeploymentContext) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Determines whether the deployment step can be executed in the current context.
public:
bool CanExecute(Microsoft::VisualStudio::SharePoint::Deployment::IDeploymentContext ^ context);
public bool CanExecute (Microsoft.VisualStudio.SharePoint.Deployment.IDeploymentContext context);
abstract member CanExecute : Microsoft.VisualStudio.SharePoint.Deployment.IDeploymentContext -> bool
Public Function CanExecute (context As IDeploymentContext) As Boolean
Parameters
- context
- IDeploymentContext
An object that provides information you can use to determine the context in which the deployment step is executing.
Returns
true
if the deployment step can be executed; otherwise, false
.
Remarks
This method is executed from the UI thread when a SharePoint project is retracted by using the Retract option on the Build menu in Visual Studio. This method is executed from a background thread in the following cases:
When a project is automatically retracted after debugging. This occurs when the Auto-retract after debugging property on the SharePoint tab of the project properties is selected.
When a project is deployed.
Some APIs in the Visual Studio object model might not work as expected from a background thread. If you need to call one of these APIs from the CanExecute method, you can marshal the call to the UI thread by using a SynchronizationContext object. In your implementation of the Initialize method, use the Current property to get the SynchronizationContext of the UI thread. Then, in your implementation of the CanExecute method, use the Post or Send methods of the SynchronizationContext object to marshal the call to the UI thread.