dotnet / dotnet/msbuild

[Feature Request]: Terminal Logger output display should use relative paths for directories in the same 'repo root'

Open
#9,800 3 comments 1 reaction 1 assignee Claimed by @baronfel View on GitHub
Area: Terminal Logger Feature Request triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Summary

I have a repo where I'm using the SDK Artifacts layout, which puts outputs in a layout like

```

- artifacts
- publish
-
-
- src
-
```

When I publish one of these projects from its src directory, the output path link is fully-qualified:

![image](https://github.com/dotnet/msbuild/assets/573979/b53cd751-bb83-4404-8ccb-161d782ceb2c)

Since this location is in the same 'repo' I'd prefer to see this path using relative pathing: `../../artifacts/publish/msbuild-versioning-sample/release_osx-x64`

### Background and Motivation

We already use relative pathing for directories _under_ the current working directory, and it seems natural to me to use relative paths for all repo-local locations. The hard part might be deciding what is repo-local, since MSBuild doesn't really have a core concept of a repo root. Maybe Sourcebuild can be of use here, since it's properties can tell us a repo root?

### Proposed Feature

If the `SourceRoot` Item is present (which it should be after the `InitializeSourceControlInformation` Target has finished) then use it as a basis for computing relative paths _if_ the project isn't a direct ancestor of the path being made relative to display the outputs.

### Alternative Designs

_No response_

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.