Skip to content

.Net5.0 not respecting StaticWebAssetBasePath on publish of Blazor WASM project #27776

@chris03

Description

@chris03

Describe the bug

After upgrading to .Net5.0 I noticed that when publishing (dotnet publish) a Blazor WASM project the StaticWebAssetBasePath is not taken into account.
The files inside wwwroot are not put in the specified base folder.
However, when the project is run, the framework files are correctly located.

I'm following this documentation about <StaticWebAssetBasePath>
https://docs.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly?view=aspnetcore-5.0#hosted-deployment-with-multiple-blazor-webassembly-apps

To Reproduce

Run: dotnet new blazorwasm
Open the .csproj file
Add <StaticWebAssetBasePath>test</StaticWebAssetBasePath> inside <PropertyGroup>
Save & Run: dotnet publish
Look at the content of: bin\Debug\net5.0\publish\wwwroot

Current result: Most files are incorrectly located in wwwroot and some files are inside wwwroot\test
Expected result: All files (framework,css,...) should be inside wwwroot\test
image

I get the expected result when running the same steps with .NetCore 3.1 (dotnet new blazorwasm -f netcoreapp3.1)
image

Further technical details

  • .Net 5.0
dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.100
 Commit:    5044b93829

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19041
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.100\

Host (useful for support):
  Version: 5.0.0
  Commit:  cf258a14b7

.NET SDKs installed:
  5.0.100 [C:\Program Files\dotnet\sdk]

I ran the commands on the command line.

Metadata

Metadata

Assignees

Labels

DoneThis issue has been fixedServicing-considerShiproom approval is required for the issuearea-blazorIncludes: Blazor, Razor Componentsarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesbugThis issue describes a behavior which is not expected - a bug.feature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssembly

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions