Skip to content

dotnet watch doesn't react when changing .razor files in referenced projects #22219

@SteveSandersonMS

Description

@SteveSandersonMS

dotnet watch is meant to identify files in referenced projects that should trigger a refresh. This does work correctly for .cs files, but not for .razor files.

Repro

Using .NET Core 3.1.300 (on Mac, but probably is the same on other platforms):

  • dotnet new blazorwasm --hosted -o MyApp
  • cd MyApp
  • dotnet watch -p Server --list

Expected result: Lists the files (including .razor files from the Client project)

Actual: Gets the paths wrong. Output is:

path/MyApp/Server/Pages/Error.cshtml
path/MyApp/Server/Pages/Shared/_Layout.cshtml
path/MyApp/Server/Controllers/WeatherForecastController.cs
path/MyApp/Server/Pages/Error.cshtml.cs
path/MyApp/Server/Program.cs
path/MyApp/Server/Startup.cs
path/MyApp/Server/MyApp.Server.csproj
path/MyApp/Server/App.razor
path/MyApp/Server/Pages/Counter.razor
path/MyApp/Server/Pages/FetchData.razor
path/MyApp/Server/Pages/Index.razor
path/MyApp/Server/Shared/MainLayout.razor
path/MyApp/Server/Shared/NavMenu.razor
path/MyApp/Server/Shared/SurveyPrompt.razor
path/MyApp/Server/_Imports.razor
path/MyApp/Client/Program.cs
path/MyApp/Client/MyApp.Client.csproj
path/MyApp/Shared/WeatherForecast.cs
path/MyApp/Shared/MyApp.Shared.csproj

Notice Server/Pages/Counter.razor? This should be Client/Pages/Counter.razor. I'm not sure how it's computing these incorrect paths to non-existent files.

Also if you try editing and saving one of the Client/**/*.razor files, dotnet watch won't respond.

Metadata

Metadata

Assignees

Labels

area-blazorIncludes: Blazor, Razor Componentsarea-commandlinetoolsIncludes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPIenhancementThis issue represents an ask for new feature or an enhancement to an existing one

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions