Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dotnet pack - how to pack without repository information?

Tags:

.net

nuget

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?

like image 854
Rand Random Avatar asked Dec 07 '25 03:12

Rand Random


1 Answers

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.

like image 85
Michael Liu Avatar answered Dec 11 '25 19:12

Michael Liu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!