Description
Describe the bug
I'm running dotnet watch
in the directory of an ASP.NET Core 8.0 application using the .NET 9 SDK.
My app generates non-code files in the ~\App_Data
directory as part of a background process (this includes binary, xml, json, and other non code files). When this happens, dotnet watch
records the files being created or modified and will even hot reload
For example
dotnet watch ⌚ Files added: .\App_Data\LuceneSearch\QANDA_SEARCH\i-g0000059-p_False\write.lock, .\App_Data\LuceneSearch\QANDA_SEARCH\i-g0000059-p_False_taxonomy\write.lock
dotnet watch ⌚ Files added: .\App_Data\LuceneSearch\QANDA_SEARCH\i-g0000059-p_False\write.lock, .\App_Data\LuceneSearch\QANDA_SEARCH\i-g0000059-p_False_taxonomy\write.lock
dotnet watch ⌚ No hot reload changes to apply.
I have tried ignoring specific files but none of the recommendations work. Even if they did work, there's no reason I should have to explicitly ignore some .txt
files in App_Data
to keep my app from reloading.
To Reproduce
- Clone https://github.com/seangwright/dotnet-watch-dotnet-sdk9-bug
- Run
dotnet watch
- See home page load in browser
- See infinite number of .txt files created in
App_Data\Test
becausedotnet watch
keeps reloading the page
Exceptions (if any)
dotnet watch
should not process files that have nothing to do with rebuilding or hot-reloading my .NET application.
Further technical details
.NET SDK:
Version: 9.0.100
Commit: 59db016f11
Workload version: 9.0.100-manifests.c6f19616
MSBuild version: 17.12.7+5b8665660
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.100\
.NET workloads installed:
[aspire]
Installation Source: VS 17.12.35506.116
Manifest Version: 8.2.2/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json
Install Type: Msi
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.0
Architecture: x64
Commit: 9d5a6a9aa4
.NET SDKs installed:
8.0.404 [C:\Program Files\dotnet\sdk]
9.0.100 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
E:\workspace\dotnet\ASPNETMVC8_NET9SDK\global.json
This bug negatively impacts any project that generates files in the project during runtime - ASPNET Core apps with client assets, files uploaded/imported to the file system, log files, ect...