dotnet / dotnet/msbuild

Design a clean way to work with AbsolutePath and ITaskItem

Open
#13,820 5 comments 0 reactions 0 assignees View on GitHub
Area: Tasks
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

The multithreaded-task migration introduces `AbsolutePath` and `TaskEnvironment.GetAbsolutePath(string)` as the safe way to resolve paths inside tasks. In practice, the vast majority of path-typed task inputs arrive as `ITaskItem` rather than string, so the current migration pattern is:
```
AbsolutePath p = TaskEnvironment.GetAbsolutePath(item.ItemSpec);
```

This has two problems:

1. Ergonomics. Every task migration repeats the conversion to `AbsolutePath`. Path-typed outputs going back into `ITaskItem` are also awkward.
2. Cross-project correctness. When an item with a relative `ItemSpec` flows from project A to project B, GetAbsolutePath(item.ItemSpec) re-anchors it to B's directory. The engine-stamped `FullPath` metadata (anchored to A) might be what the task actually means. See discussion in https://github.com/dotnet/msbuild/pull/13771#discussion_r3269163222.

Goal:
Design a first-class, ergonomic way for tasks to move between ITaskItem and AbsolutePath that is correct in cross-project scenarios, plays well with the analyzer/codefix, and reads naturally at the call site.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.