- NuGet Command Line Tool must be installed and accessible through
- PowerShell - for supplied scripting examples, but Batch prompt can also be used
NuGet specification for project(s)
In order to make project visible to NuGet packager it is necessary to have
*.nuspec file created
side by side with
*.csproj file. File names should be aligned as well, such that if project file
Logging.csproj then NuGet specification file should be named
Let’s assume that Logging project is dependent on another project in the solution called Core as well as on third party library, NLog. NuGet specification for such project will look like following:
Important things to note here are placeholder variables like $id$, $version$, $author$, etc. Values for these placeholders will be extracted from assembly information for Logging project by NuGet during packaging process in runtime.
Such NuGet specification files should be produced for each and every project in your solution that you would like to pack and deploy to NuGet repository.
You could find more detailed information on Nuspec Reference.
Packing and Deploying NuGet Packages
The gist of NuGet packing process is very simple:
- Build your solution in Debug or Release mode
- Run NuGet.exe against project files with NuGet specification enabled
In order to submit single package to a repository the following command can be issued:
In order to submit all the configured NuGet packages to a repository some scripting might be handy. The following powershell script executed from the folder holding solution file, should pack and deploy all the NuGet packages in your solution:
Author Roman Kuznetsov
License Roman Kuznetsov