We would like to support the building (and inclusion) of software whose build systems require .nupkg versions of referenced libraries in order to build. .nupkg files are packages containing .NET assemblies required for a given package to be built, usually downloaded on demand by the build system (much like Maven).

Typical consumer workflow

By default, ?NuGet is configured with the main nuget.org package repository. An app's build system includes a "nuget restore" invocation (usually in the .csproj) which will parse the list of packages in the packages.config file in the project source, download from any available repository (including dependencies), and unpack into the packages/ folder. Assembly references in the software's .csproj will reference the assemblies in packages/

directhex@marceline:~/Projects/monodevelop/main/external/fsharpbinding/monodevelop/MonoDevelop.FSharpBinding$ nuget restore MonoDevelop.FSharp.mac-linux.sln 
Installing 'Fantomas 1.4.0'.
Successfully installed 'Fantomas 1.4.0'.
Installing 'FSharp.Compiler.Service 0.0.60'.
Installing 'Mono.Cecil 0.9.5.4'.
Successfully installed 'Mono.Cecil 0.9.5.4'.
Installing 'FSharp.Compiler.Service 0.0.57'.
Successfully installed 'FSharp.Compiler.Service 0.0.60'.
Installing 'FsUnit 1.2.1.0'.
Successfully installed 'FsUnit 1.2.1.0'.
Installing 'NUnit 2.6.2'.
Successfully installed 'NUnit 2.6.2'.
Successfully installed 'FSharp.Compiler.Service 0.0.57'.

Adapting NuGet for Debian

For Debian use, we need to support offline operation entirely. Our builders do not support internet access during builds, so cannot download .nupkg files.

Configure NuGet to look for packages on disk

OK

We need ?NuGet to use a file:/// repository in preference to the default https:// one. The default configuration should be adjusted accordingly.

directhex@marceline:/tmp/womble$ ls
NuGet.CommandLine.2.8.1.nupkg
directhex@marceline:/tmp/womble$ nuget sources Add -Name DebianLocal -Source file:///tmp/womble
Package Source with Name: DebianLocal added successfully.
directhex@marceline:/tmp/womble$ nuget sources Disable -Name https://www.nuget.org/api/v2/
Package source with Name: https://www.nuget.org/api/v2/ disabled successfully.
directhex@marceline:/tmp/womble$ nuget list
NuGet.CommandLine 2.8.1

By changing the HOME environment used by all calls to "nuget", we can disable the default repository and add the on-disk repositories on a per-build basis.

A common location for offline .nupkg files

OK

/usr/share/nupkg for platform-agnostic nupkgs

/usr/lib/nupkg for nupkgs with platform-specific code (i.e. which must be arch:any). We don't yet have an example case for these.

Building .nupkg files

OK

.nupkg files are built from .nuspec manifest files, via the "nuget pack" command. ?NuSpec files may need gentle massaging, e.g to handle directory separator characters; command lines may need gentle massaging to execute successfully.

directhex@marceline:/tmp/nuget-2.8.1+md54+dhx3$ nuget pack -BasePath src/CommandLine/bin/Release/ src/CommandLine/Properties/NuGet.CommandLine.nuspec
Attempting to build package from 'NuGet.CommandLine.nuspec'.
Successfully created package '/tmp/nuget-2.8.1+md54+dhx3/NuGet.CommandLine.2.8.1.nupkg'.

By default, "nuget" has a blacklist of paths. All <file> stanzas in a nuspec are relative to the nuspec - there is no way to pass a fully qualified path (bug?). Relative paths are not possible, as paths with a leading . are blacklisted - but passing -?NoDefaultExcludes avoids this issue.

Packaging .nupkg files

OK

The .nupkg file should simply be dropped inside the package, and spat out on disk in the previously discussed location(s).

Package naming

OK

?NuGet packages should be named in the format nupkg-foo.bar.baz.version.

Package dependencies

DISCUSS

Should nupkgs have dependencies? They're just zip files. Is it a nupkg package's responsibility to track the external deps of its own contents?