Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a nuspec from csproj with GUI

I have a C# project which has a 2 Project References from projects within my Solution.

It also has 5 NuGet package references from packages in my NuGet repository. Given the .csproj, How can I generate or create the nuspec file using NuGet Project Explorer tool?

And how to validate if this nuspec is indeed correct?

like image 888
GilliVilla Avatar asked Aug 12 '14 15:08

GilliVilla


People also ask

How do I create a Nupkg file?

Run the pack command Select Build > Configuration Manager, and then set the Active solution configuration to Release. Select the AppLogger project in Solution Explorer, and then select Build > Pack. Visual Studio builds the project and creates the . nupkg file.

What is a Nuspec file?

A . nuspec file is an XML manifest that contains package metadata. This manifest is used both to build the package and to provide information to consumers. The manifest is always included in a package.


1 Answers

You can do this using NuGet.exe with the command line similar to:

NuGet.exe spec Project.csproj

To do this from within Visual Studio you could add a new External Tool (from the Tools menu) which uses NuGet.exe.

NuGet Project Explorer supports NuGet packages but not project files so one of the above techniques would be simpler. For the NuGet Project Explorer you would need to write a custom addin.

For validation, NuGet.exe will generate the .nuspec file so it should be valid. Also when you use NuGet.exe pack YourNuspec.nuspec it will be validated when you create a NuGet package with warnings output to the console.

like image 164
Matt Ward Avatar answered Sep 28 '22 05:09

Matt Ward