Custom ArtifactsPath outside repo does not add SourceRoot, making build not reproducible
- 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.