Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 11, 2025

Summary

.NET 10 SDK introduced support for using DefaultItemExcludes to exclude files from dotnet watch, preventing unwanted restarts. The existing documentation only covered the Watch="false" attribute approach.

Added new section documenting:

  • DefaultItemExcludes property usage for folder/pattern exclusion
  • App_Data folder example addressing unwanted page reloads in ASP.NET Core apps
  • Multiple pattern exclusion syntax
  • Comparison with Watch="false" attribute for choosing the right approach
  • Cross-reference to MSBuild properties documentation

Example from the new section:

<PropertyGroup>
  <DefaultItemExcludes>$(DefaultItemExcludes);**/App_Data/**</DefaultItemExcludes>
</PropertyGroup>
Original prompt

This section details on the original issue you should resolve

<issue_title>Mention use of DefaultItemExcludes to exclude items from dotnet watch</issue_title>
<issue_description>### Type of issue

Missing information

Description

In .NET 10, dotnet watch was improved to optionally exclude items from watch that are not relevant to the compilation.

As an example, this could include files in the App_Data folder of an ASP.NET Core application. If these files are updated as the app runs the developer will experience unwanted page reloads under .NET 9.

Under the .NET 10 SDK, something like this could be added to the project to prevent this behavior.

<PropertyGroup>
    <DefaultItemExcludes>$(DefaultItemExcludes);**/App_Data/**</DefaultItemExcludes>
</PropertyGroup>

The current documentation only details how to ignore Compile and EmbeddedResource items.

Page URL

https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-watch

Content source URL

https://github.com/dotnet/docs/blob/main/docs/core/tools/dotnet-watch.md

Document Version Independent Id

218d2a4d-2ff3-8e4d-1f06-bbb3710878fe

Platform Id

2254bd0c-661a-635e-3711-7e40a13c787d

Article author

@meaghanlewis

Metadata

  • ID: 16f49f1b-261c-8cd0-a024-32c2535d0a0f
  • PlatformId: 2254bd0c-661a-635e-3711-7e40a13c787d
  • Service: dotnet-fundamentals

Related Issues


Associated WorkItem - 509069</issue_description>

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


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


Internal previews

📄 File 🔗 Preview link
docs/core/project-sdk/msbuild-props.md MSBuild reference for .NET SDK projects
docs/core/tools/dotnet-watch.md dotnet watch command

Copilot AI changed the title [WIP] Mention use of DefaultItemExcludes for dotnet watch Document DefaultItemExcludes for dotnet watch file exclusion Dec 11, 2025
Copilot AI requested a review from meaghanlewis December 11, 2025 17:55
Updated the documentation for DefaultItemExcludes to clarify the reference link.
@meaghanlewis meaghanlewis marked this pull request as ready for review December 11, 2025 18:56
@meaghanlewis meaghanlewis requested a review from a team as a code owner December 11, 2025 18:56
Copilot AI review requested due to automatic review settings December 11, 2025 18:56
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 adds documentation for the .NET 10 SDK feature that allows using DefaultItemExcludes property to exclude files and folders from dotnet watch monitoring. This addresses a gap where previously only the Watch="false" attribute approach was documented.

Key Changes:

  • Added new section explaining DefaultItemExcludes property usage for excluding folders and file patterns
  • Included practical example addressing the App_Data folder reload issue in ASP.NET Core apps
  • Provided comparison between DefaultItemExcludes and Watch="false" attribute approaches

Clarify the usage of DefaultItemExcludes for excluding files and folders in dotnet watch.
@meaghanlewis meaghanlewis merged commit 5269b4c into main Dec 11, 2025
11 checks passed
@meaghanlewis meaghanlewis deleted the copilot/update-default-item-excludes branch December 11, 2025 23:13
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.

Mention use of DefaultItemExcludes to exclude items from dotnet watch

3 participants