共用方式為


ICancelableTask.Cancel Method

Instructs the task to exit as soon as possible, or to immediately exit if Execute is invoked after this method.

MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.

Namespace:  Microsoft.Build.Framework
Assembly:  Microsoft.Build.Framework (in Microsoft.Build.Framework.dll)

Syntax

'Declaration
Sub Cancel
void Cancel()
void Cancel()
abstract Cancel : unit -> unit
function Cancel()

Remarks

Cancel() may be called at any time after the task has been instantiated, even before Execute is called.

Cancel calls may come in from any thread. The implementation of this method should not block indefinitely.

To cancel the build, both Cancel and Execute must return in any order.

.NET Framework Security

See Also

Reference

ICancelableTask Interface

Microsoft.Build.Framework Namespace