dotnet / dotnet/sdk

Custom ArtifactsPath outside repo does not add SourceRoot, making build not reproducible

Open
#51,551 0 comments 1 reaction 2 assignees Claimed by @marcpopMSFT View on GitHub
untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Describe the bug
When setting `ArtifactsPath` to a location outside a repo root, generated files in the `obj` dir (e.g. `Project.Version.cs`) are not escaped properly and have the full path in the pdb instead of `_1/`, `_2`, etc.

### To Reproduce

In an AzDo pipeline, create a package with `dotnet pack -p:ArtifactsPath=$(Build.ArtifactStagingDirectory)` and examine the result in NuGet Package Explorer. In AzDo, the `Build.ArtifactStagingDirectory` location lives outside of the source location.

### Exceptions (if any)

### Further technical details

Tested with .NET SDK 10 RC2

### Workaround

Adding this into the `Directory.Build.targets` solves it:

```xml

```

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.