dotnet / dotnet/sdk

Blazor wasm publish: MSB4018 ApplyCompressionNegotiation

Open
#56,235 8 comments 0 reactions 1 assignee Claimed by @lewing View on GitHub
Area-StaticWebAssets Area-WebSDK Bug
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

We have a blazor wasm application that uses Razor class libraries.

When we publish the application , this error message comes up:

turning off compression by doing
```xml
false
```
in the .csproj makes it not fail, but we really really want compression.

we're on .net 10.0.10, using SDK 10.0.302

I've read preliminarily into https://github.com/dotnet/aspnetcore/issues/59291 but couldn't find an actual mitigation, so i checked the no-existing-issues checkbox.

@javiercn pinging you since you closed the previously mentioned issue
@AdmiralSnyder pinging you to get notified
```
C:\Program Files\dotnet\sdk\10.0.302\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.Compression.targets(379,5): error MSB4018:
The "ApplyCompressionNegotiation" task failed unexpectedly.
System.InvalidOperationException: Endpoints not found for compressed asset: X:\DevTools\Projects\DotNet\CODie\CODi
eClientApp\CODieClientAppWasm\obj\Release\net10.0\net10.0\compressed\wprw9cngr2-{0}-fdkerjavvt-fdkerjavvt.gz
at Microsoft.AspNetCore.StaticWebAssets.Tasks.ApplyCompressionNegotiation.ResolveEndpoints(IDictionary2 assets
ById, IDictionary2 endpointsByAsset, StaticWebAsset compressedAsset)
at Microsoft.AspNetCore.StaticWebAssets.Tasks.ApplyCompressionNegotiation.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecutionHost taskExecutionHost, TaskLogging
Context taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)
```

### Expected Behavior

publishing the application should work with compression enabled.

### Steps To Reproduce

this is not an open source project, i'm fine to show parts live on discord, but there's no way i can create a smaller repro, sorry.

### Exceptions (if any)

MSB4018:
The "ApplyCompressionNegotiation" task failed unexpectedly.
System.InvalidOperationException: Endpoints not found for compressed asset: X:\DevTools\Projects\DotNet\CODie\CODi
eClientApp\CODieClientAppWasm\obj\Release\net10.0\net10.0\compressed\wprw9cngr2-{0}-fdkerjavvt-fdkerjavvt.gz
at Microsoft.AspNetCore.StaticWebAssets.Tasks.ApplyCompressionNegotiation.ResolveEndpoints(IDictionary2 assets
ById, IDictionary2 endpointsByAsset, StaticWebAsset compressedAsset)
at Microsoft.AspNetCore.StaticWebAssets.Tasks.ApplyCompressionNegotiation.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecutionHost taskExecutionHost, TaskLogging
Context taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)

### .NET Version

10.0.10, sdk 10.0.302

### Anything else?

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.