dotnet / dotnet/sourcelink

Sourcelink not working if snupkg is present, but works if it is not there

Open
#745 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.4k
Forks
148
PR merge metrics
No merged PRs in 30d

Description

Okay - So i have tried to set up my project with SourceLink and noticed that some versions did support stepping in while others did not.

I ended up noticing that the versions which DID work for me were those where CI failed to upload snupkg files because of empty symbols so i compared a couple commits and noticed that one configuration that did work for me was the following:

- Create compilation WITH snupkg generation
- DELETE snupkg
- Upload nupkg

A library where the snupkg file was missing worked successfully, but if the same configuration also uploaded its snupkg, source link did not allow me to step into code anymore.

My setup is this:

SourceLink.props
```



true


true


embedded

true
snupkg
true

$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb

```

Directory.Build.props
```


true


true




```

``` ProjectFIle

net5.0;netstandard2.0
1.0.0
beta
true

Copyright © AUTHOR CURRENTYEAR
MyPackageId
MyPackageId
AUTHOR
MyProductName
MIT
false

git
https://github.com/GITOWNER/GITPROJECT.git
https://github.com/GITOWNER/GITPROJECT
true

```

workflow.yml
```
- name: Restore dependencies
run: dotnet restore src/All.sln
- name: Build
run: dotnet build src/All.sln --verbosity $verbosity -c $configuration --no-restore
- name: Test
run: dotnet test src/All.sln --verbosity $verbosity -c $configuration --no-build

- name: Pack
if: ${{ needs.environment.outputs.publishRelease == 'True' }}
run: dotnet pack src/MyLibrary/MyLibrary.csproj --verbosity $verbosity -c $configuration -o artifacts/nupkg --no-build /p:VersionSuffix=$versionSuffix

- name: Remove snupkg
if: ${{ needs.environment.outputs.publishRelease == 'True' }}
run: find artifacts/nupkg/ -name "*.snupkg" -type f -delete

- name: Release
if: ${{ needs.environment.outputs.publishRelease == 'True' }}
run: dotnet nuget push "artifacts/nupkg/*.nupkg" -k $NUGETKEY -s https://api.nuget.org/v3/index.json
env:
NUGETKEY: ${{ secrets.NUGET }}
```

I tried other property / build script permutations, but with embedded+deleted snupkg was a combination that worked

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.