IMultiThreadableTask Interface
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.
Interface for tasks that can execute in a thread-safe manner within MSBuild's multithreaded execution model. Tasks that implement this interface declare their capability to run in multiple threads within one process.
public interface class IMultiThreadableTask : Microsoft::Build::Framework::ITask
public interface IMultiThreadableTask : Microsoft.Build.Framework.ITask
type IMultiThreadableTask = interface
interface ITask
Public Interface IMultiThreadableTask
Implements ITask
- Implements
Remarks
The task must:
- Use the provided TaskEnvironment for all modifications to process state such as environment variables, working directory, or process spawning instead of directly modifying global process state
- Not depend on global process state for correct operation, including avoiding relative path resolution that relies on the current working directory
- Use GetAbsolutePath(String) instead of GetFullPath(String) for path resolution
- Handle any internal synchronization if the task spawns multiple threads internally
See the Thread-Safe Tasks specification for detailed guidelines on thread-safe task development.
Properties
| Name | Description |
|---|---|
| BuildEngine |
This property is set by the build engine to allow a task to call back into it. (Inherited from ITask) |
| HostObject |
The build engine sets this property if the host IDE has associated a host object with this particular task. (Inherited from ITask) |
| TaskEnvironment |
Gets or sets the task execution environment, which provides access to project current directory and environment variables in a thread-safe manner. |
Methods
| Name | Description |
|---|---|
| Execute() |
This method is called by the build engine to begin task execution. A task uses the return value to indicate whether it was successful. If a task throws an exception out of this method, the engine will automatically assume that the task has failed. (Inherited from ITask) |