dotnet / dotnet/aspnetcore

Adding a .razor file causes `dotnet watch` to rebuild without prompting the user

Open
#33,740 4 comments 1 reaction 0 assignees View on GitHub
area-commandlinetools feature-hot-reload
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

Repro steps:

- Install .NET 6 Preview 6 (6.0.100-preview.6.21321.10)
- `dotnet new blazorserver -o BlazorApp`
- `cd BlazorApp`
- `dotnet watch`
- Add a .razor file

Expected result: Hot reload of new component type.

Actual result: App rebuilds and restarts without prompting the user:

```
watch : New file: C:\Users\daroth\desktop\BlazorApp\Shared\Component2.razor. Rebuilding the application.
watch : Killing process 7400

watch : Process id 7400 ran for 34849ms
watch : Exited
watch : Evaluating dotnet-watch file set.
watch : Running MSBuild target 'GenerateWatchList' on 'C:\Users\daroth\desktop\BlazorApp\BlazorApp.csproj'
watch : Started 'C:\Program Files\dotnet\dotnet.exe' '' with process id 13020
watch : Process id 13020 ran for 305ms
watch : Watching 32 file(s) for changes
watch : Building...
watch : Started 'C:\Program Files\dotnet\dotnet.exe' '' with process id 10312
Determining projects to restore...
All projects are up-to-date for restore.
You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
BlazorApp -> C:\Users\daroth\desktop\BlazorApp\bin\Debug\net6.0\BlazorApp.dll
watch : Process id 10312 ran for 598ms
watch : HotReloadProfile: Default.
watch : Started 'C:\Users\daroth\desktop\BlazorApp\bin\Debug\net6.0\Blazorwatch : Running BlazorApp with the following arguments: run
watch : Started
info: Microsoft.Hosting.Lifetime[14]
Now listening on: https://localhost:5001
watch : Reloading browser.
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: C:\Users\daroth\desktop\BlazorApp
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.