Skip to content

Use three-dot diff in ProjectCapability detection workflow#52986

Open
Copilot wants to merge 5 commits intomainfrom
copilot/document-project-capability-items
Open

Use three-dot diff in ProjectCapability detection workflow#52986
Copilot wants to merge 5 commits intomainfrom
copilot/document-project-capability-items

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

The workflow was using two-dot diff syntax, which includes commits from the target branch not present in the PR, potentially causing false positives in capability detection.

Changes

Changed git diff syntax in .github/workflows/detect-project-capabilities.yml:

- git diff ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
+ git diff ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}

Three-dot diff shows only commits unique to the PR (changes since the merge base), while two-dot diff shows all commits reachable from head but not base, including unrelated target branch commits.

Original prompt

This section details on the original issue you should resolve

<issue_title>We need to document the ProjectCapability Items that the .NET SDK (and other SDKs in this repo) provide</issue_title>
<issue_description>### Is your feature request related to a problem? Please describe.

ProjectCapability MSBuild Items are declarative data that IDEs and CLI experiences (like SDK Container publishing and dotnet run) use to determine if a specific action or feature can be used by a given project. This set is documented somewhat at https://github.com/microsoft/vsprojectsystem/blob/master/doc/overview/project_capabilities.md, but we've certainly added more over time. We should have a place to document these items, what they mean, and what experiences (IDE and CLI) they enable.

Describe the solution you'd like

We need two things:

  • new in-repo documentation for the project capabilities provided in the .NET SDK, with separate documentation files for each 'MSBuild SDK' that provides capabilities. This gets us 'green' with the current state.
  • a new github actions workflow that detects when a PR includes a new ProjectCapability and reminds the author to add/update the existing in-repo documentation. This keeps us 'green' for the future.
    </issue_description>

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


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 11, 2026 18:02
- Add comprehensive documentation for ProjectCapability items across all SDKs
- Create GitHub Actions workflow to detect new capabilities in PRs
- Update documentation index with link to project capabilities docs

Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
- Update SDK-PR-guide.md with section on adding ProjectCapabilities
- Add comprehensive README to project-capabilities directory
- Improve navigation and discoverability of documentation

Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
The target name in the source code has a typo (Declartions instead of Declarations).
Document the actual name as it exists while noting the typo.

Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Copilot AI changed the title [WIP] Document ProjectCapability items in .NET SDK Document ProjectCapability items and add PR detection workflow Feb 11, 2026
Copilot AI requested a review from baronfel February 11, 2026 18:10
Change from two-dot (..) to three-dot (...) diff syntax to show only
PR changes without including unrelated target branch changes. This
follows GitHub workflow best practices.

Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Copilot AI changed the title Document ProjectCapability items and add PR detection workflow Use three-dot diff in ProjectCapability detection workflow Feb 13, 2026
@baronfel baronfel marked this pull request as ready for review March 2, 2026 14:47
Copilot AI review requested due to automatic review settings March 2, 2026 14:47
@baronfel baronfel enabled auto-merge (squash) March 2, 2026 14:48
@baronfel baronfel requested a review from a team March 2, 2026 14:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces in-repo documentation for MSBuild ProjectCapability items across the SDKs in this repo and adds a GitHub Actions workflow that detects newly-added capabilities in PRs (using a three-dot diff) to prompt authors to update that documentation.

Changes:

  • Add a Project Capabilities documentation landing page plus per-SDK capability docs.
  • Update existing documentation indices/guidance to point to the new capability docs.
  • Add a pull_request_target workflow to detect new ProjectCapability items via git diff ... and apply a label + reminder comment.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
.github/workflows/detect-project-capabilities.yml Adds workflow to diff .targets changes and detect new ProjectCapability includes, then label/comment.
documentation/README.md Links the new Project Capabilities documentation from the documentation index.
documentation/project-docs/SDK-PR-guide.md Adds contributor guidance for documenting newly-added ProjectCapability items.
documentation/project-docs/project-capabilities.md Adds an overview/entry point that links to each per-SDK capability doc.
documentation/project-docs/project-capabilities/README.md Adds a readme describing the per-SDK docs and how to contribute/update them.
documentation/project-docs/project-capabilities/Microsoft.NET.Sdk.md Documents capabilities defined by Microsoft.NET.Sdk targets.
documentation/project-docs/project-capabilities/Microsoft.NET.Sdk.Web.md Documents capabilities defined by Web SDK project-system/design-time targets.
documentation/project-docs/project-capabilities/Microsoft.NET.Sdk.Worker.md Documents capabilities defined by Worker SDK targets.
documentation/project-docs/project-capabilities/Microsoft.NET.Sdk.Razor.md Documents capabilities defined by Razor SDK design-time targets.
documentation/project-docs/project-capabilities/Microsoft.NET.Publish.md Documents publish-related capabilities added by Microsoft.NET.Publish.targets.
documentation/project-docs/project-capabilities/Microsoft.NET.Build.Containers.md Documents container build capability(ies) added by container targets.

Comment on lines +213 to +217
const { data: comments } = await github.rest.issues.listComments({
owner,
repo,
issue_number
});
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

issues.listComments is called without pagination; by default GitHub returns only the first page (typically 30 comments). On PRs with many comments, the existing reminder comment may not be found, causing duplicates to be posted instead of updated. Use Octokit pagination (or request per_page: 100 and iterate pages) when searching for an existing comment containing the identifier.

Suggested change
const { data: comments } = await github.rest.issues.listComments({
owner,
repo,
issue_number
});
const comments = await github.paginate(
github.rest.issues.listComments,
{
owner,
repo,
issue_number,
per_page: 100
}
);

Copilot uses AI. Check for mistakes.
Comment on lines +170 to +177
| Capability | Always Added | Conditional | Purpose |
|------------|--------------|-------------|---------|
| `CrossPlatformExecutable` | No | .NET Core executables | Indicates cross-platform executable |
| `NativeAOT` | No | .NET 8+ (non-WPF/WinForms) | Enables Native AOT UI features |
| `SupportsComputeRunCommand` | Yes | - | Supports customizable run protocol |
| `GenerateDocumentationFile` | Yes | - | Supports XML documentation generation |
| `SupportsHotReload` | No | C#/VB .NET 6+ | Enables Hot Reload functionality |
| `ReferenceManagerAssemblies` (removed) | N/A | .NET Core projects | Hides legacy reference UI |
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

The markdown table has an extra leading | (rows start with || ...), which renders as an unintended empty first column in GitHub Markdown. Change these rows to start with a single | so the table columns align correctly.

Copilot uses AI. Check for mistakes.
Comment on lines +191 to +206
## Summary Table

| Capability | Always Added | Conditional | Purpose |
|------------|--------------|-------------|---------|
| `DotNetCoreWeb` | Yes | - | Primary web project identifier |
| `AspNetCore` | Yes | - | ASP.NET Core framework indicator |
| `Web` | Yes | - | General web project features |
| `AppServicePublish` | Yes | - | Azure App Service publishing |
| `AspNetCoreInProcessHosting` | No | .NET Core 3.0+ | IIS in-process hosting support |
| `SupportHierarchyContextSvc` | Yes* | Not in VS designtime | Hierarchy context service |
| `DynamicDependentFile` | Yes* | Not in VS designtime | Dynamic dependent file tracking |
| `DynamicFileNesting` | Yes* | Not in VS designtime | File nesting rules |
| `LocalUserSecrets` | No | When user secrets configured | User Secrets management |

\* These capabilities are added by the SDK if not already provided by Visual Studio's design-time targets.

Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

The summary table has an extra leading | (it uses || at the start of rows), which renders as an empty first column in Markdown. Use a single leading | for each row to avoid misaligned columns.

Copilot uses AI. Check for mistakes.
Comment on lines +157 to +168
## Summary Table

| Capability | Always Added | Conditional | Purpose |
|------------|--------------|-------------|---------|
| `DotNetCoreRazor` | Yes | - | Core Razor support indicator |
| `DotNetCoreRazorConfiguration` | No | Razor 3.0+ | Advanced language service config |
| `WebNestingDefaults` | Yes | - | Web-style file nesting |
| `SupportsTypeScriptNuGet` | Yes | - | TypeScript NuGet support |
| `SupportHierarchyContextSvc` | No | Non-Web SDK projects only | Hierarchy context service |
| `DynamicDependentFile` | No | Non-Web SDK projects only | Dependent file tracking |
| `DynamicFileNesting` | No | Non-Web SDK projects only | File nesting rules |

Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

The markdown table in this section starts each row with ||, which creates an unintended blank first column when rendered on GitHub. Update the table rows to start with a single | so the table formats correctly.

Copilot uses AI. Check for mistakes.
Comment on lines +219 to +226
| Capability | Trigger Property | Minimum TFM | Purpose |
|------------|------------------|-------------|---------|
| `IsAotCompatible` | `IsAotCompatible=true` | .NET 7.0 | Library AOT compatibility marker |
| `IsTrimmable` | `IsTrimmable=true` or `IsAotCompatible=true` | .NET 6.0 | Library trim compatibility marker |
| `PublishAot` | `PublishAot=true` | .NET 7.0 | Native AOT compilation |
| `PublishReadyToRun` | `PublishReadyToRun=true` | .NET Core 3.0 | ReadyToRun pre-compilation |
| `PublishSingleFile` | `PublishSingleFile=true` | .NET Core 3.0 | Single-file bundling |
| `PublishTrimmed` | `PublishTrimmed=true` | .NET Core 3.0 | IL trimming |
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

In this table, the “Minimum TFM” column is potentially misleading: the capabilities in Microsoft.NET.Publish.targets are added based on publish-related properties, without any TFM gating at the point where the ProjectCapability items are created. Consider renaming the column (e.g., “Feature introduced” / “Recommended minimum TFM”) or clarifying that the capability is still added even when targeting older TFMs (and tooling/targets may warn/ignore accordingly).

Copilot uses AI. Check for mistakes.
Comment on lines +193 to +198
## Summary Table

| Capability | Always Added | Conditional | Purpose |
|------------|--------------|-------------|---------|
| `NetSdkOCIImageBuild` | Yes | - | OCI/Docker container build support |

Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

The summary table row starts with ||, which creates an extra empty first column in rendered Markdown. Use a single leading | for the table rows to keep the columns aligned.

Copilot uses AI. Check for mistakes.
Comment on lines +94 to +101
// Pattern to match ProjectCapability Include="..."
// Matches: <ProjectCapability Include="CapabilityName" />
// Also handles: <ProjectCapability Include="CapabilityName">...</ProjectCapability>
const capabilityPattern = /<ProjectCapability\s+Include=["']([^"']+)["']/gi;

// Pattern to match ProjectCapability Remove="..."
// We'll track these separately but won't flag them as needing docs
const removePattern = /<ProjectCapability\s+Remove=["']([^"']+)["']/gi;
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

The regex used to detect newly-added capabilities only matches when the Include attribute immediately follows <ProjectCapability (e.g., <ProjectCapability Include="..." ...>). In this repo there are valid patterns where another attribute comes first (e.g., Condition before Include in Microsoft.NET.Publish.targets), which means this workflow will miss some new capabilities. Update the pattern to match Include anywhere within the opening tag (e.g., scan <ProjectCapability tags and then extract Include= regardless of attribute order).

Suggested change
// Pattern to match ProjectCapability Include="..."
// Matches: <ProjectCapability Include="CapabilityName" />
// Also handles: <ProjectCapability Include="CapabilityName">...</ProjectCapability>
const capabilityPattern = /<ProjectCapability\s+Include=["']([^"']+)["']/gi;
// Pattern to match ProjectCapability Remove="..."
// We'll track these separately but won't flag them as needing docs
const removePattern = /<ProjectCapability\s+Remove=["']([^"']+)["']/gi;
// Pattern to match ProjectCapability Include="..." where Include can appear in any attribute order
// Matches: <ProjectCapability Include="CapabilityName" />, <ProjectCapability Condition="..." Include="CapabilityName" />, etc.
// Also handles: <ProjectCapability Include="CapabilityName">...</ProjectCapability>
const capabilityPattern = /<ProjectCapability\b[^>]*\bInclude=["']([^"']+)["']/gi;
// Pattern to match ProjectCapability Remove="..." where Remove can appear in any attribute order
// We'll track these separately but won't flag them as needing docs
const removePattern = /<ProjectCapability\b[^>]*\bRemove=["']([^"']+)["']/gi;

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +24
name: Detect New ProjectCapability Items

on:
# Use pull_request_target for safe execution from forks
# This runs in the context of the base branch, not the PR head
pull_request_target:
types: [opened, synchronize]
branches:
- main
- release/*

Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

The PR title/description indicates this change is limited to switching git diff from two-dot to three-dot syntax, but this PR also adds substantial new documentation and a new workflow. Please update the PR title/description to reflect the full scope (or consider splitting into separate PRs) so reviewers and release notes tooling aren’t misled.

Copilot uses AI. Check for mistakes.
Comment on lines +149 to +160
## Summary Table

| Capability | Always Added | Conditional | Purpose |
|------------|--------------|-------------|---------|
| `DotNetCoreWorker` | Yes | - | Primary worker service identifier |
| `SupportHierarchyContextSvc` | Yes | - | Hierarchy context service |
| `DynamicDependentFile` | Yes | - | Dynamic dependent file tracking |
| `DynamicFileNesting` | Yes | - | File nesting rules |
| `LocalUserSecrets` | Yes | - | User Secrets management |
| `WebNestingDefaults` | Yes | - | Web-style file nesting patterns |
| `DynamicFileNestingEnabled` | Yes | - | File nesting enabled flag |

Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

The markdown summary table rows start with || ..., which produces an empty first column when rendered. Update the table to use a single leading | per row so the columns align as intended.

Copilot uses AI. Check for mistakes.
Comment on lines +217 to +227
## Summary Table

| Capability | Trigger Property | Minimum TFM | Purpose |
|------------|------------------|-------------|---------|
| `IsAotCompatible` | `IsAotCompatible=true` | .NET 7.0 | Library AOT compatibility marker |
| `IsTrimmable` | `IsTrimmable=true` or `IsAotCompatible=true` | .NET 6.0 | Library trim compatibility marker |
| `PublishAot` | `PublishAot=true` | .NET 7.0 | Native AOT compilation |
| `PublishReadyToRun` | `PublishReadyToRun=true` | .NET Core 3.0 | ReadyToRun pre-compilation |
| `PublishSingleFile` | `PublishSingleFile=true` | .NET Core 3.0 | Single-file bundling |
| `PublishTrimmed` | `PublishTrimmed=true` | .NET Core 3.0 | IL trimming |

Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

The summary table uses || at the start of rows, which renders with an empty first column in GitHub Markdown. Change the table to use a single leading | per row so it formats correctly.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

We need to document the ProjectCapability Items that the .NET SDK (and other SDKs in this repo) provide

4 participants