I am using dotnet pack to create NuGet packages, and noticed that with the move SVN to Git the packages now contain the commit id in the *.nuspec file e.g.
<repository type="git" commit="{id}" />
How can I tell dotnet pack to not generate this information?
You’re seeing Source Link in action. This feature embeds source control metadata inside NuGet packages so that debuggers like Visual Studio can locate and step directly into the original source code.
Starting with .NET 8, Source Link is enabled by default if you’re using supported Git providers like GitHub or GitLab. You can disable Source Link, thereby suppressing the commit="id" attribute, by setting the EnableSourceControlManagerQueries build property to false in your project file:
<PropertyGroup>
<EnableSourceControlManagerQueries>false</EnableSourceControlManagerQueries>
</PropertyGroup>
Or you can pass the /p:EnableSourceControlManagerQueries=false switch to dotnet pack.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With