Matthew Layton
Matthew Layton

Reputation: 42229

Publishing NuGet packages with custom metadata with .NET Core

I read this beforehand (works a treat!)

How to Create NuGet Packages From .Net Core RC2 Class Libraries

I'm not sure how to add metadata, though. My current process uses Nuget Package Explorer. I'm currently having to do this manually, and I really shouldn't have to!

Here is an example of what I would like to add to my project, without the UI

enter image description here

Is it possible to add this information anywhere inside my VS2015 solution, and have it added to my nuget package automatically?

P.S. if the answer is "you need a .nuspec file..." can you document the process of how this works in VS2015, because I don't see how VS would respect the contents of the file.

Upvotes: 2

Views: 949

Answers (1)

Nate Barbettini
Nate Barbettini

Reputation: 53600

You don't need a .nuspec file, just a project.json file (which you should already have).

The equivalent properties to your screenshot would be:

{
  "name": "NewCo",
  "authors": [ "NewCo" ],
  "description": "Core",
  "packOptions": {
    "owners": [ "NewCo" ],
  },
  "version": "1.0.0"
}

And of course, all the other project.json stuff like dependencies (which I've left out of the above for brevity). The project.json reference is helpful here.

When you use dotnet pack, the above properties are parsed and used for the package metadata.

Upvotes: 2

Related Questions