Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include tags in NuGet package using CLI only

I want to add Tags for a nuget package. I do NOT want to use a separate .nuspec file (maintenance), I'm only using the csproj for packing.

I've tried setting it using nuget pack -Properties Tags=demo but that doesn't seem to work..?

I'm trying to solve a bigger problem to create some traceability using the commit id from the build in the tags? (on VSTS using Build.SourceVersion)

References:

  • NuGet CLI ref.
  • Adding nuget pack as a msbuild target
  • VSTS Variables
like image 540
grmbl Avatar asked Sep 08 '25 14:09

grmbl


1 Answers

Actually, contrary to what was said in the other reply, there's a way to do this without a nuspec file.

Refer here: https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#pack-target

NuGet has support for most nuspec elements through csproj as well.

So in your csproj, you would have something like:

<PackageTags>MyTag1;MyTag2</PackageTags>

like image 126
imps Avatar answered Sep 10 '25 08:09

imps