Edit

Share via


MSB4220 diagnostic code

This article describes the MSB4220 error code.

Message text

MSB4220: Waiting for the currently executing task 'value' to cancel.

Description

This error occurs when you try to stop a build, but a long-running task that is not designed to be cancelable can't be stopped by MSBuild. In such cases, MSBuild's policy is not to cancel the task, because that would leave a project in an undefined state, perhaps with partially written files, that could corrupt subsequent builds.

Resolution

In current versions, MSBuild built-in tasks generally support clean cancellation. However, this is up to the task author, or the author of the target or the SDK that packages the targets and tasks. If the issue persists, you could try upgrading to the most recent versions of SDKs you're using to see if the task was updated to support cancelability.

If you're the author of the task, consider implementing the ICancelableTask interface, so that your task supports cancellation. If you're consuming a task from an SDK or a third-party provider of a target, then you can contact the owner and ask them to implement ICancellableTask in a future version of the task.

Applies to

All versions of MSBuild