dotnet / dotnet/aspnetcore

Hot Reload breaks when a web api project references and uses a class from a blazor.client project

Open
#63,119 1 comment 0 reactions 1 assignee Claimed by @tmat View on GitHub
area-commandlinetools feature-hot-reload
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

Hot reload works in a project until a web api project references and uses a class/record in a blazor.client project. The output of the hot reload windows will begin to classify the web api project as a Web Assembly project and it will break hot reload for the web assembly / server / interactive host project and the web api project.

https://github.com/chenegathoffman/hot-reload-is-broken/commits/master/

Before moving the record to the .client project.

Image

After moving the record to the .client project.

Image

### Expected Behavior

I would expect that the Web Api project to continue to be classified as a (Web Server) project.

### Steps To Reproduce

Create new blazor interactive project. Add a new web api project (minimal api template is fine). Add a reference to the .client project in the web api project. Set the solution to start up the blazor host and the web api project. Make a change to the weather forecast api endpoint and observe that it hot reloads. Move the WeatherForecast record into the .client project. Run the solution again, make the change to the web api and hot reload will break because it classifies the web api project as a Web Assembly project.

### Exceptions (if any)

_No response_

### .NET Version

.net core 9

### Anything else?

_No response_

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.