Share via


IDeploymentStep.CanExecute Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Determines whether the deployment step can be executed in the current context.

Namespace:  Microsoft.VisualStudio.SharePoint.Deployment
Assembly:  Microsoft.VisualStudio.SharePoint (in Microsoft.VisualStudio.SharePoint.dll)

Syntax

'Declaration
Function CanExecute ( _
    context As IDeploymentContext _
) As Boolean
bool CanExecute(
    IDeploymentContext context
)

Parameters

Return Value

Type: System.Boolean
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.

.NET Framework Security

See Also

Reference

IDeploymentStep Interface

Microsoft.VisualStudio.SharePoint.Deployment Namespace

Other Resources

Walkthrough: Creating a Custom Deployment Step for SharePoint Projects