dotnet / dotnet/aspnetcore

dotnet watch not loading ASPNETCORE_HOSTINGSTARTUPASSEMBLIES

Open
#64,519 5 comments 1 reaction 0 assignees View on GitHub
area-commandlinetools
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

I'm the author of [tailwind-dotnet](https://github.com/kallebysantos/tailwind-dotnet?tab=readme-ov-file#installing-the-tailwindcss-integration) library that easily adds tailwindcss support for .net apps.

The lib its based in two packages:
1. Msbuild - To compile on build/publish ✅
2. Hosting startup - To launch tailwindcss cli process in watch mode. ❌

When I do `dotnet run` its successfully starts the tailwindcss Hosting assembly and I can see the css building logs correctly.

run logs

```
❯ dotnet run
Using launch settings from /Users/kallebysantos/projects/personal/tailwind-dotnet/examples/BlazorNet10/Properties/launchSettings.json...
Building...
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5293
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: /Users/kallebysantos/projects/personal/tailwind-dotnet/examples/BlazorNet10
≈ tailwindcss v4.1.17

Done in 28ms
Done in 2ms
Done in 3ms
```

But when I do `dotnet watch` or `dotnet watch run` console only shows the default .net messages and editing a file doesn't trigger css building. Only works when `Ctrl-R` that forces rebuilding and triggers the MSBuild part.

I did also tried manually specif the `--launch-profile` but the problem persists.

watch logs

```
❯ dotnet watch run
dotnet watch 🔥 Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload.
dotnet watch 💡 Press Ctrl+R to restart.
dotnet watch 🔨 Building /Users/kallebysantos/projects/personal/tailwind-dotnet/examples/BlazorNet10/BlazorNet10.csproj ...
dotnet watch 🔨 Build succeeded: /Users/kallebysantos/projects/personal/tailwind-dotnet/examples/BlazorNet10/BlazorNet10.csproj
Using launch settings from /Users/kallebysantos/projects/personal/tailwind-dotnet/examples/BlazorNet10/Properties/launchSettings.json...
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5293
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: /Users/kallebysantos/projects/personal/tailwind-dotnet/examples/BlazorNet10
warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
Failed to determine the https port for redirect.
dotnet watch ⌚ Files updated: ./Components/Pages/4913, ./Components/Pages/Home.razor
dotnet watch ⌚ File deleted: ./Components/Pages/Home.razor~
dotnet watch 🔥 [BlazorNet10 (net10.0)] Hot reload succeeded.
dotnet watch ⌚ Files updated: ./Components/Pages/4913, ./Components/Pages/Home.razor
dotnet watch ⌚ No C# changes to apply.
dotnet watch ⌚ Files updated: ./Components/Pages/4913, ./Components/Pages/Home.razor
dotnet watch ⌚ File deleted: ./Components/Pages/Home.razor~
dotnet watch ⌚ No C# changes to apply.
```

### Expected Behavior

.net `watch` command to also start the `ASPNETCORE_HOSTINGSTARTUPASSEMBLIES`

### Steps To Reproduce

Follow [tailwind-dotnet Getting Started](https://github.com/kallebysantos/tailwind-dotnet?tab=readme-ov-file#creating-a-new-project)

### Exceptions (if any)

_No response_

### .NET Version

10.0.100

### Anything else?

dotnet info

```
10.0.100
❯ dotnet --info
.NET SDK:
Version: 10.0.100
Commit: b0f34d51fc
Workload version: 10.0.100-manifests.4c0ca8ba
MSBuild version: 18.0.2+b0f34d51f

Runtime Environment:
OS Name: Mac OS X
OS Version: 26.1
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/10.0.100/

.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.

Host:
Version: 10.0.0
Architecture: arm64
Commit: b0f34d51fc

.NET SDKs installed:
8.0.412 [/usr/local/share/dotnet/sdk]
8.0.415 [/usr/local/share/dotnet/sdk]
9.0.306 [/usr/local/share/dotnet/sdk]
10.0.100-preview.4.25258.110 [/usr/local/share/dotnet/sdk]
10.0.100 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.18 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.21 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.10 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0-preview.4.25258.110 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.15 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.18 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.20 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.21 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0-preview.4.25258.110 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

```

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.