dotnet / dotnet/sdk

OverrideHtmlAssetPlaceholders=true causes publish conflict for index.html when using StaticWebAssetBasePath

Open
#52,274 1 comment 0 reactions 0 assignees View on GitHub
Area-WebSDK StaticWebAssets untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

**Problem:**
When `OverrideHtmlAssetPlaceholders=true` and a non-empty `StaticWebAssetBasePath` is set (e.g., App1), the `OverrideHtmlAssetPlaceholders` task correctly removes the original index.html from the `StaticWebAsset` collection via its `HtmlFilesToRemove` output. However, the file is **not** removed from `ContentWithTargetPath`, causing `dotnet publish` to fail with `NETSDK1152: Found multiple publish output files with the same relative path` when hosting multiple Blazor WebAssembly apps in a single ASP.NET Core host.

**Root Cause:**
The `HtmlFilesToRemove` output only removes items from the static web assets pipeline. The original index.html remains in `ContentWithTargetPath` with index.html, ignoring the `StaticWebAssetBasePath` setting. When multiple Blazor WASM projects each have their own index.html, they all try to publish to the same path.

**Workaround:**
Add a target to manually remove index.html from `ContentWithTargetPath`:

```xml



```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how the OverrideHtmlAssetPlaceholders task's HtmlFilesToRemove output is applied and how ContentWithTargetPath is populated after AssignTargetPaths. Reproduce the publish conflict with multiple Blazor WebAssembly apps using a non-empty StaticWebAssetBasePath. Done means the original index.html no longer causes NETSDK1152 while the static web asset base path is respected.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.