Is there an automated way to generate NuGet package ready for publishing to nuget.org from VS project

StackOverflow https://stackoverflow.com/questions/23612800

Question

When I have a .csproj class library project, it already has some NuGet Dependencies and output files. (At least ProjectName.dll).

I've learned that I need to create a .nuspec file (as one of the steps) in order to publish the NuGet Package to a global repository.

.nuspec file will include metadata for the project + dependencies (another NuGet Packages) that are added along with my NuGet Package.

Is the a way (a tool, an app) that will automatically generate a .nuspec file for me, to include at least the dependencies, so I don't have to manually get an ID of each one and put then into .xml?

Was it helpful?

Solution

Generating a .nuspec file based on your project is not supported by NuGet.exe but you could write one. I do not know of anything that does this. However did you look at using the nuget pack command line?

nuget pack YourProject.csproj

This will generate your NuGet package file (.nupkg) and automatically add any dependencies for NuGet packages your project references.

You can include extra metadata in your .nuspec or just use the metadata in your compiled project binary.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top