Skip to content

Restore ability to compress all files during dotnet publish for Blazor wasm applications #46603

@SwissJimmy

Description

@SwissJimmy

This issue was previously raised as a bug but was closed as an intentional change.

#3783

Now, only files in _framework folder and appsettings files are compressed.

Regardless, the switch from .net 5 to .net 6 has a subtle breaking change for deployed applications.

Steps to recreate:

  1. Using .net 5, deploy a .js file within the "_content" folder.

  2. The .br and .gz files will be served when requesting .js file

  3. Change the .js file

  4. Using .net 6 deploy the same project to the same location

  5. The .js file will be changed to the latest version but .br and .gz will remain as older version

  6. The .br and .gz files will continue to be served. The changes to .js will be ignored

In addition, the inability to compress all files as part of "dotnet publish" introduces the need for extra scripting to compress files as part of the deploy process. This is particularly important for web applications that depend on large .js or .css files and where there is great pressure to minimize the initial load times of Blazor apps.

Given that there is a project file option to disable compression, perhaps it would be appropriate to add a new option such as:
<CompressAllPublishedFiles>true</CompressAllPublishedFiles>

It certainly is possible to hack the .targets file to compress all files but a more stable solution is required.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions