dotnet / dotnet/aspnetcore

`dotnet watch` ignores `StaticWebAssetBasePath` for third-party library

Open
#47,802 4 comments 1 reaction 0 assignees View on GitHub
area-commandlinetools feature-hot-reload investigate triaged
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

I try to host a Blazor WASM app under the path `/dev` using the property `dev`. My project is also referencing the third-party library `MudBlazor` and when I do `dotnet publish -c Debug -o ` the output is just fine, i.e. MudBlazor is below the `dev/_content` folder:

![grafik](https://user-images.githubusercontent.com/20972129/233334293-cd632aa2-72e8-4715-828c-37eac70c0054.png)

But when I run `dotnet watch` the files are not located under the `dev/_content` path but directly under `_content` (
the target framework is `net7.0`):
![grafik](https://user-images.githubusercontent.com/20972129/233333259-3dbc5888-48f0-4cef-9074-51ee9b7db2c6.png)

### Expected Behavior

I expect that `dev` is also applied to third-party libraries when running `dotnet watch`.

### Steps To Reproduce

1. Run
```bash
dotnet new blazorwasm
dotnet add package MudBlazor
```

2. Edit the `.csproj` file and add `dev`.
3. Run `dotnet publish`
4. Have look into the published folder, it looks fine (`_content/MudBlazor` is located under `wwwroot/dev`).
5. Run `dotnet watch`
6. Try to load the file `http://localhost:/dev/_content/MudBlazor/MudBlazor.min.js`: it fails
7. Try to load the file `http://localhost:/_content/MudBlazor/MudBlazor.min.js`: it succeeds

### Exceptions (if any)

_No response_

### .NET Version

7.0.101

### Anything else?

## VS Code watch task

The project `Veltrup.Server` references and serves the WASM client project.

![grafik](https://user-images.githubusercontent.com/20972129/233336283-11f2ef62-981c-4c25-b8f6-63248b934c36.png)

## `dotnet --info`
.NET SDK:
Version: 7.0.101
Commit: bb24aafa11

Laufzeitumgebung:
OS Name: ubuntu
OS Version: 22.10
OS Platform: Linux
RID: linux-x64
Base Path: /home/vincent/Dokumente/Software/dotnet/sdk/7.0.101/

Host:
Version: 7.0.1
Architecture: x64
Commit: 97203d38ba

.NET SDKs installed:
5.0.408 [/home/vincent/Dokumente/Software/dotnet/sdk]
6.0.404 [/home/vincent/Dokumente/Software/dotnet/sdk]
7.0.101 [/home/vincent/Dokumente/Software/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.17 [/home/vincent/Dokumente/Software/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.12 [/home/vincent/Dokumente/Software/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.1 [/home/vincent/Dokumente/Software/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.17 [/home/vincent/Dokumente/Software/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.12 [/home/vincent/Dokumente/Software/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.1 [/home/vincent/Dokumente/Software/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
DOTNET_ROOT [/home/vincent/Dokumente/Software/dotnet]

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

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.