The template doesn’t work for me as-is. Here is how to fix it
- Create a new solution using the template React and ASP.NET Core.
- Make sure you check Enlist in Aspire.
- Add a project reference from the AppHost to the client project.
- Add a NuGet reference from AppHost to Aspire.Hosting.NodeJS.
- Edit AppHost.cs, delete
builder.AddProject("reactapp10-server"); - And replace it with the following code:
var apiApp = builder.AddProject<Projects.ReactApp11_Server>("api");
var clientApp = builder.AddNpmApp("client", "../reactapp11.client", "dev")
.WithReference(apiApp)
.WaitFor(apiApp)
.WithHttpsEndpoint(env: "DEV_SERVER_PORT")
.WithExternalHttpEndpoints();
You can now run your AppHost project and see the React app listed, running, and with a valid URL exposed.

Comments