To automatically add files / folders to the nuget package, I wrote a small tool called NuGetLib .
Global variables are automatically set by the installer.
In my .gitlab-ci.yml only these 4 lines are needed to build the nuget package with all the dependencies and the tool folder:
# create output directory - mkdir nuget
You can download it here: Download
Readme
NuGetLib
Command line tool for additional operations with nuget packages
It is written in C # and needs .Net-Framework 4.6.1 to run. On Linux, it must also be executed using Mono (not yet tested).
Using
nugetlib about
nugetlib about
Displays current version information.
nugetlib add
nugetlib add [-t <path to the target file or folder>] [-f <path to the file/folder to add>]
Adds a file or folder to an existing nuget package file ( .nupkg ). If you send the folder as a target, a new * is automatically created . Nupkg file.
NuGetLib uses 7zip to manage packages. The -f is passed directly to the 7zip library:
add command
Adds files to the archive.
Examples
nugetlib add -t example.nupkg subdir\
Adds all files and subfolders from the subdir folder to the example.nupkg archive. File names in the archive will contain the subdir \ prefix.
nugetlib add -t example.nupkg .\subdir\*
Adds all files and subfolders from the subdir folder to the example.nupkg archive. File names in the archive will not contain the subdir \ prefix.
nugetlib add -t example.nupkg .\subdir\tools\
adds the tools folder to the example.nupkg archive. File names in the archive will not contain the subdir \ prefix.
cd /D c:\dir1\
nugetlib add -t example.nupkg dir2\dir3\
The file names in the example.nupkg archive will contain dir2 \ dir3 \ prefix, but they will not contain c: \ dir1 \ prefix.