multithreaded-task-migration

Migrate MSBuild tasks to thread-safe execution using IMultiThreadableTask and TaskEnvironment.

1.2k|334|Updated Oct 13, 2022
One-click install
npx skills add https://github.com/dotnet/dotnet --skill multithreaded-task-migration-dotnet
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: multithreaded-task-migration
Source: https://github.com/dotnet/dotnet/tree/main/src/msbuild/.github/skills/multithreaded-task-migration
Command: npx skills add https://github.com/dotnet/dotnet --skill multithreaded-task-migration-dotnet

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

MSBuild tasks often rely on shared process state, which can cause race conditions and flaky builds when run in parallel. This skill provides a migration path to thread-safe task implementations by using IMultiThreadableTask and TaskEnvironment.

Core Features & Use Cases

  • Annotate tasks with MSBuildMultiThreadableTask to declare thread-safety.
  • Integrate TaskEnvironment to access absolute paths, isolated variables, and safe process starts.
  • Use cases include large solution builds, parallelized custom tasks, and CI pipelines that exercise multithreading.

Quick Start

Annotate your task with MSBuildMultiThreadableTask and implement IMultiThreadableTask, then use TaskEnvironment for safe I/O.

Frequently Asked Questions about multithreaded-task-migration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I make MSBuild tasks thread-safe for parallel execution?

Migrate MSBuild tasks to thread-safe execution by annotating them with MSBuildMultiThreadableTask, implementing IMultiThreadableTask, and using TaskEnvironment for isolated variables and safe I/O operations.

Why do my MSBuild builds fail with race conditions during parallel task execution?

Race conditions during parallel MSBuild builds occur when custom tasks rely on shared process state. Migrating to IMultiThreadableTask and TaskEnvironment isolates variables and ensures safe path handling to prevent flaky builds.

What is TaskEnvironment used for in MSBuild multithreading?

TaskEnvironment in MSBuild multithreading provides access to absolute paths, isolated variables, and safe process starts. It replaces shared process state to ensure tasks execute safely across multi-threaded builds without conflicts.

Can I use custom MSBuild tasks in large parallelized CI pipelines?

Yes, custom MSBuild tasks can run safely in parallelized CI pipelines by implementing IMultiThreadableTask and integrating TaskEnvironment. This satisfies multithreading spec requirements for annotation and safe path handling in large solution builds.

What's the best way to migrate existing MSBuild tasks to support multithreaded builds?

The best way to migrate MSBuild tasks to multithreaded builds is to annotate task declarations with MSBuildMultiThreadableTask, implement IMultiThreadableTask, and update I/O operations to use TaskEnvironment for safe parallel execution.