dotnet watch does not watch custom file patterns from referenced projects
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
**dotnet version**: 5.0.400
**issue**: I'm trying to use `dotnet watch test` to run unit tests whenever I modify a file in my csproj, including certain json files. I have two projects: Core.SDK.csproj and Core.SDK.Tests.csproj. The JSON files exist in Core.SDK.csproj, so I would like the unit test to run if those json files are modified. I run `dotnet watch -p Core.SDK.Tests.csproj test` and tests are run when .cs files are modified, but not the json files.
```xml
netstandard2.1
```
```xml
net5.0
```
**my investigation**: I ran `dotnet watch -p --list` to see the exact files that dotnet watch is looking. For the CoreSDK project, everything looks as expected.
```
dotnet watch -p .\SDK.Core --list
...
.\platform\SDK.Core\bin\Debug\netstandard2.1\Manifest\BuiltIn\standard.manifest.json
.\platform\SDK.Core\Manifest\BuiltIn\standard.manifest.json
...
```
For the CoreSDK.Tests project, I see an issue, the files show as existing under the "SDK.Core.Tests" directory!
```
dotnet watch -p .\SDK.Core.Tests\ --list
...
.\platform\SDK.Core.Tests\bin\Debug\netstandard2.1\Manifest\BuiltIn\standard.manifest.json
.\platform\SDK.Core.Tests\Manifest\BuiltIn\standard.manifest.json
...
```
**conclusion**: Based on this output, dotnet watch thinks that `standard.manifest.json` should exist in directory of the test project. This path that it spit out does not exist, so it never sees a change in the file, and hence doesn't run tests when the actual json file from the CoreSDK project changes.
Contributor guide
Assessment
This issue has not been assessed yet.