The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,839 other subscribers

Hopefully by now the Chocolatey .nuspec extensions and limitations are documented in a more central way

Posted by jpluimers on 2025/08/08

Chocolatey extends the NuGet file format .nuspec based XML files as base for their packages with at the time of writing very sparse and limited documentation in what it extends, why it does that and what extra limitations it imposes on the fields used inside .nuspec files.

Hopefully by now that has improved, so this post is a reminder to myself to check that out eventually.

At the time of writing, the NuGet .nuspec documentation was at [Wayback/Archive] .nuspec File Reference for NuGet | Microsoft Learn and the file format at [Wayback/Archive] NuGet.Client/nuspec.xsd at dev · NuGet/NuGet.Client. Most fields are defined as primitive data types xs:boolean, xs:string and xs:anyURI (of the 19 available primitive XML SChema (W3C) types). Some composite data types are are composed from them using local and global complexType, most using xs:all, xs:attribute or single-type unbounded xs:sequence (which all imply no particular order).

Since an XML Schema allows to both use restriction and extension on data types (the eXtensible in XML!), making them more strict is a relatively straight-forward operation and has the benefit of having these in a central place.

In the past for more than 5 years [Wayback/Archive] Is there a specification for the package format? · Issue #379 · chocolatey/choco was just pointing to the NuGet .nuspec format, but after a request to re-open new comments were made pointing to a current issue (basically a stub, but still) and a Chocolatey nuspec.xsd file, yay!

Still it was a quest to figure out the additional rules they have added, especially since the documentation was sparse and sloppy.

This made figuring out what and how to change the .nuspec files to fix [Wayback/Archive] Fix issues raised after initial 1.24.1 submission to Chocolatey · Issue #4 · corbob/ChocoPackages was a much harder job than anticipated:

It took quite some effort to figure out where the new fieldnames were introduced. Somehow my Google Fu was not on pare for this endeavour. Anyway, these searches helped me:

It made me find these GitHub issues

Some of the above also made it to the [Wayback/Archive] Thread by @jpluimers on Thread Reader App.

All of this could have been so much easier with proper rule enforcement in a Chocolatey specific nuspec.xsd file: you can add documentation there (xs:annotation, xs:appinfo, xs:documentation) parse those and generate documentation web-pages from them (I had forgotten which ones; [Wayback/Archive] site:https://www.oreilly.com/library/view/xml-schema “xs:documentation” – Google Search helped me find them).

I tried to advocate for that by following-up at [Wayback/Archive] Is there a specification for the package format? · Issue #379 · chocolatey/choco, so I was happy to learn that:

  1. There is a documentation issue at [Wayback/Archive] Create Nuspec Document · Issue #374 · chocolatey/docs which back then was still kind of a stub, but a much fresher one and with a positive phrasing.
  2. There is a Chocolatey specific nuspec XSD file at [Wayback/Archive] nuget-chocolatey/nuspec.xsd at 2.11_adds · chocolatey/nuget-chocolatey which is a modified copy of [Wayback/Archive] NuGet.Client/nuspec.xsd at dev · NuGet/NuGet.Client.
    I posted the results of a diff between [Wayback/Archive] raw.githubusercontent.com/chocolatey/nuget-chocolatey/2.11_adds/src/Core/Authoring/nuspec.xsd and [Wayback/Archive] raw.githubusercontent.com/NuGet/NuGet.Client/dev/src/NuGet.Core/NuGet.Packaging/compiler/resources/nuspec.xsd as a comment to [Wayback/Archive] Create Nuspec Document · Issue #374 · chocolatey/docs.

XML Schema links

To help one understand the above XML Schema types, here are some links:

If you are really in a hardcore mood, you can also look these up in the official [Wayback/Archive] W3C XML Schema Definition Language (XSD) 1.1 Part 1: Structures.

–jeroen

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.