Building the NuGet Package

As our NuGet spec file is ready, it's time for us to create the NuGet package from the nuspec file. Use the nuget pack command followed by the nuspec file name to start creating the project. Enter the following command in the console window:

    nuget pack NuGetDemoLibrary.nuspec

This will create a NuGet package file with the extension .nupkg in the same directory:

The file name will be a combination of the ID and the version that we specified in the .nuspec file. In our case, it generates the file Demo.Packt.Kunal.NuGetDemoLibrary.1.0.0-alpha.nupkg, as you can see in the preceding screenshot.

You will also see a warning message on-screen, which says one issue found as the assembly is not inside a framework folder. As we have placed the DLL under the lib folder of the target location directly, it generates this error. NuGet recommends putting the assemblies inside a framework-specific folder. You can ignore this if this assembly is targeted for multiple frameworks. But if you want to build multiple binaries for different frameworks with the same name and embed them in the same package, continue reading.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.140.5