The process of creating a package always begins with creating a
.nuspec package manifest file that describes your package contents. This manifest drives the creation of the package as well as its usage when installed into a project.
The role and structure of the .nuspec file
A .nuspec is an XML manifest file that describes a package’s contents and drives the process of creating a NuGet package. At a minimum, the manifest includes the package identifier, version number, the title that appears in a gallery, author and owner information, and a long description. It can also include release notes, copyright information, a short description for the Package Manager UI in Visual Studio, a locale ID, home page and license URLs, an icon URL, lists of dependencies and references, tags that assist in gallery searches, and more.
How to create a new Nuget Package
- Open visual studio 2015, make sure you have installed the following extensions.
- Create new project of type NuGet Packager
- Add the required dlls for which package to be created, in the lib folder within project.
- add the code in Package.nuspec as required.
for example, if you want to create a NuGet package for Sitecore Forms 8.2, following is the code for that.
- Build the solution
- Sitecore.Forms.8.2.1.nupkg file gets created in the project root folder in the excluded fashion. Include them into the project.
Update NuGet Packlage on NuGet Server
- Go to the project root folder in command prompt and run the following command. Make sure you have the Nuget server url and API Key
nuget.exe push Sitecore.Forms.8.2.1.nupkg -Source http://xxx.azurewebsites.net/ -ApiKey xxxx