Skip to content

Enable EnablePackageValidation for all src packages with 1.0.0 baseline#1330

Merged
stephentoub merged 4 commits intomainfrom
copilot/enable-package-validation
Feb 25, 2026
Merged

Enable EnablePackageValidation for all src packages with 1.0.0 baseline#1330
stephentoub merged 4 commits intomainfrom
copilot/enable-package-validation

Conversation

Copy link
Contributor

Copilot AI commented Feb 20, 2026

Opts into EnablePackageValidation so the build catches API breaking changes automatically against the published 1.0.0 stable baseline.

Changes

  • src/Directory.Build.props: Adds EnablePackageValidation=true and PackageValidationBaselineVersion=1.0.0 — applies to all three packable projects (ModelContextProtocol.Core, ModelContextProtocol, ModelContextProtocol.AspNetCore)

Any new breaking change introduced going forward will fail dotnet pack unless explicitly suppressed.

Original prompt

This section details on the original issue you should resolve

<issue_title>Opt in to EnablePackageValidation to catch breaking changes</issue_title>
<issue_description>Skills aside, we should enable the EnablePackageValidation property in the main projects so that breaking changes are caught by the build process itself. That should provide much stronger feedback to LLMs as well.

Originally posted by @eiriktsarpalis in #1328 (comment)
</issue_description>

<agent_instructions>The 0.9.0-preview.1 version should be used as the baseline to establish for package validation. Validation should be enabled for all packages produced in the src build.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…src packages

Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com>
Copilot AI changed the title [WIP] Add package validation to catch breaking changes Enable EnablePackageValidation for all src packages with 0.9.0-preview.1 baseline Feb 20, 2026
Copilot AI requested a review from jeffhandley February 20, 2026 13:42
@jeffhandley jeffhandley marked this pull request as ready for review February 20, 2026 13:45
@jeffhandley jeffhandley requested a review from ericstj February 20, 2026 13:45
eiriktsarpalis
eiriktsarpalis previously approved these changes Feb 20, 2026
@jeffhandley jeffhandley marked this pull request as draft February 21, 2026 01:57
@stephentoub
Copy link
Contributor

@copilot since this PR was created, the libraries have moved to a stable 1.0.0 release. Please update this PR accordingly, including resetting the baselining which should no longer be necessary.

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 25, 2026

@copilot since this PR was created, the libraries have moved to a stable 1.0.0 release. Please update this PR accordingly, including resetting the baselining which should no longer be ...

Updated in 1c81385 — baseline is now 1.0.0 and the CompatibilitySuppressions.xml has been removed since no suppressions are needed against the stable release.

Copilot AI changed the title Enable EnablePackageValidation for all src packages with 0.9.0-preview.1 baseline Enable EnablePackageValidation for all src packages with 1.0.0 baseline Feb 25, 2026
Copilot AI requested a review from stephentoub February 25, 2026 13:11
@stephentoub stephentoub marked this pull request as ready for review February 25, 2026 13:19
@stephentoub
Copy link
Contributor

@copilot can you temporarily make a breaking API change and validate that the build fails / catches it?

Copy link
Contributor Author

Copilot AI commented Feb 25, 2026

@copilot can you temporarily make a breaking API change and validate that the build fails / catches it?

Verified — I temporarily changed Annotations.Priority from public to internal and ran dotnet pack. The build compiled fine but package validation caught it with CP0002 errors across all four TFMs:

error CP0002: Member 'float? ModelContextProtocol.Protocol.Annotations.Priority.get' exists on [Baseline] lib/net8.0/ModelContextProtocol.Core.dll but not on lib/net8.0/ModelContextProtocol.Core.dll
error CP0002: Member 'void ModelContextProtocol.Protocol.Annotations.Priority.set' exists on [Baseline] lib/net8.0/ModelContextProtocol.Core.dll but not on lib/net8.0/ModelContextProtocol.Core.dll

(repeated for net9.0, net10.0, and netstandard2.0)

Ending with: error : API breaking changes found. If those are intentional, the APICompat suppression file can be updated by rebuilding with '/p:ApiCompatGenerateSuppressionFile=true'

The temporary change has been reverted — no code changes needed.

@stephentoub stephentoub merged commit a7df425 into main Feb 25, 2026
11 checks passed
@stephentoub stephentoub deleted the copilot/enable-package-validation branch February 25, 2026 15:11
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.

Opt in to EnablePackageValidation to catch breaking changes

4 participants