Skip to content

(#66) Add supportsInstances Nuspec Metadata Field - #67

Merged
gep13 merged 1 commit into
chocolatey:developfrom
gep13:package-instances
Nov 5, 2026
Merged

gep13 merged 1 commit into
chocolatey:developfrom
gep13:package-instances

Conversation

@gep13

@gep13 gep13 commented Nov 4, 2026

Copy link
Copy Markdown
Member

Description Of Changes

Adds the supportsInstances nuspec metadata field to the NuGet.Packaging library in this fork.

  • Reads supportsInstances from the nuspec (ChocolateyNuspecReader.GetSupportsInstances and ManifestReader).
  • Carries it through ManifestMetadata and PackageBuilder, including the copy paths, and writes it back out when it is set (PackageMetadataXmlExtensions).
  • Adds the element to the nuspec schema (nuspec.xsd).
  • Records the new public members in PublicAPI.Unshipped.txt for net472, netstandard2.0 and netcoreapp5.0.
  • Deliberately leaves the field off the IPackageMetadata interface. The copy paths read it from the concrete types, and a comment on the interface says to add it at the next breaking release of Chocolatey CLI (3.x).

Motivation and Context

Chocolatey package instances let a package declare that it may be installed more than once, and that declaration lives in the nuspec. Without a field for it, packing through this fork silently dropped the value, so every instance gate downstream read it as not declared.

Package Instances have to ship in a 2.x release of Chocolatey CLI, which cannot take breaking changes in the dependencies it uses. Adding a member to IPackageMetadata would break every external implementer, so the value travels on the concrete types only, and any other implementer of the interface yields false.

Testing

This will need to be tested in conjunction with PR's into CLI and CLE.

Operating Systems Testing

  • Dev VM 4

Change Types Made

  • Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • Breaking change (fix or feature that could cause existing functionality to change).
  • Documentation changes.
  • PowerShell code changes.

Change Checklist

  • Requires a change to the documentation.
  • Documentation has been updated.
  • Tests to cover my changes, have been added.
  • All new and existing tests passed?
  • PowerShell code changes: PowerShell v3 compatibility checked?
  • Significant design decisions: ADR has been created by a Chocolatey team member?
  • All items are complete on the Definition of Done.

Related Issue

Fixes #66

Chocolatey package instances let a package declare that it may be
installed more than once, and that declaration lives in the nuspec.
Without a field for it, packing through this fork silently dropped the
value, so every instance gate downstream read it as not declared.

Read supportsInstances from the nuspec, carry it through
ManifestMetadata and PackageBuilder, write it back out when set, and add
it to the nuspec schema.

It is deliberately kept off the IPackageMetadata interface: adding a
member there breaks every external implementer. Package Instances have
to ship in a 2.x release of Chocolatey CLI, which cannot take breaking
changes in the dependencies it uses, so the copy paths read the value
from the concrete types instead. A comment on the interface records
that it should be added at the next breaking release of Chocolatey CLI
(3.x).

@vexx32 vexx32 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good, but I do have one question about the direction taken here.

@vexx32 vexx32 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, great work ^^

@gep13 gep13 added this to the 3.6.0 milestone Nov 5, 2026
@gep13
gep13 merged commit 0041e97 into chocolatey:develop Nov 5, 2026
1 check passed
@gep13
gep13 deleted the package-instances branch November 5, 2026 17:04
@gep13 gep13 removed this from the 3.6.0 milestone Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a supportsInstances nuspec metadata field

2 participants