Ole Albers
Ole Albers

Reputation: 9285

Publishing to NuGet using csProj: How to add Metadata?

I use Azure DevOps to pack and push my project to NuGet. Here I got two options: Use the .csproj - file as information what to push or use a .nuspec

What I like about the .csproj - approach is that I don't have to care about dependencies when I update them as the csproj is always up-to-date. The nuspec would have to be maintained additionally.

I use the following yaml:

steps:
- task: NuGetCommand@2
  displayName: 'NuGet pack'
  inputs:
    command: pack
    packagesToPack: myProject/O365/myProject.O365.csproj
    versioningScheme: byPrereleaseNumber
    majorVersion: 0
    minorVersion: 9

But what about the additional metadata like Author, license- and projecturl which I can store in the nuspec-file. Can these informations be stored in the csproj, too? So I have accurate Informations when publishing?

Upvotes: 4

Views: 2593

Answers (1)

D.J.
D.J.

Reputation: 4034

These metainfos can be stored in the csproj.

Here are a few properties that you can use in a propertyGroup in a csproj -> https://learn.microsoft.com/en-us/dotnet/core/tools/csproj#nuget-metadata-properties

Upvotes: 3

Related Questions