Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable sourcelink and deterministic builds #2

Closed
304NotModified opened this issue Apr 12, 2021 · 7 comments
Closed

Enable sourcelink and deterministic builds #2

304NotModified opened this issue Apr 12, 2021 · 7 comments

Comments

@304NotModified
Copy link
Contributor

I would recommend this. See small examples here:

Drizin added a commit that referenced this issue Feb 13, 2022
Version bump and equalizing minor/patch versions:
InterpolatedLogging.Microsoft.Extensions.Logging 5.0.4
InterpolatedLogging.NLog 4.0.4
InterpolatedLogging.Serilog 2.0.4
@Drizin
Copy link
Owner

Drizin commented Feb 13, 2022

@304NotModified thanks for the suggestion.
I've never used Sourcelink before, so I'd appreciate it if you can please review the associated commit?
As far as I checked it's working - because in the generated nuspec I can see <repository type="git" url="etc" commit="etc" />. but just want to double check.

@304NotModified
Copy link
Contributor Author

304NotModified commented Feb 13, 2022

I dont see anything strange, but I recommended to check the nuget package with nuget package explorer:
https://github.com/NuGetPackageExplorer/NuGetPackageExplorer

See NLog/NLog.Extensions.Logging#479 (comment)

@Drizin
Copy link
Owner

Drizin commented Feb 14, 2022

Thanks for the tool suggestion. Turns out that both Source Link and Deterministic Builds were not working :-(

I could fix Source Link by adding the PDBs into the nupkg (yeah, I know that the current recommendation is to leave pdbs in a snupkg and upload it into a symbol server, but making it all together seems to be easier).

Took me lots of attempts to make the deterministic build work. Looks like using dotnet pack will randomly work (fails most of the time), while with MSBuild it works most of the time (or always). So basically I started using MSBuild to pack (like you do in NLog), which works better.

Thanks again for the advice and for the links!

@304NotModified
Copy link
Contributor Author

Took me lots of attempts to make the deterministic build work. Looks like using dotnet pack will randomly work (fails most of the time),

That's because the parameter belongs to the build phase and not the pack, I guess

@304NotModified
Copy link
Contributor Author

I could fix Source Link by adding the PDBs into the nupkg (yeah, I know that the current recommendation is to leave pdbs in a snupkg and upload it into a symbol server, but making it all together seems to be easier).

Creating a snupkg is pretty easy:

  1. /p:SymbolPackageFormat=snupkg (msbuild)
  2. Upload also the snupkg to nuget.org

@Drizin
Copy link
Owner

Drizin commented Feb 14, 2022

That's because the parameter belongs to the build phase and not the pack, I guess

As far as I understood the dotnet pack also rebuilds (unless we specify --no-build which would get the existing build), and therefore the flag should work in both dotnet build and dotnet pack.
So my wild guess is that dotnet tool is not correctly passing the flags or something (I've seen some other threads reporting issues with dotnet but none having issues with msbuild).

@Drizin Drizin closed this as completed Feb 22, 2022
@304NotModified
Copy link
Contributor Author

looks great!

image

(checked also the other 2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants