Skip to content

Fingerprinting client-side assets using the old school hosted approach #121993

Closed
dotnet/sdk
#55907

Description

@Vizual-Dev

I am using the old school hosted WASM approach for a Blazor application.

After upgrading to .NET 10 I have implemented Fingerprint client-side static assets in standalone Blazor WebAssembly apps.

When running the project from Visual Studio I and viewing the page source in the browser, I can see the import map and the fingerprinted assets:

Image

The documentation says, "In standalone Blazor WebAssembly apps during build/publish, the framework overrides placeholders in index.html with values computed during build to fingerprint static assets for client-side rendering.".

When I publish my application via the Demo.Server project the placeholders are not overridden. The index.html in the published wwwroot still contains the placeholders:

Image

If I publish the Demo.Client project directly the placeholders are overriden.

Is it possible for me to build the Demo.Server but also replace the placeholders in Demo.Client?

I have created a minimal repo to demonstrate the problem: https://github.com/Vizual-Dev/ImportMapDemo

Activity

  1. added
    untriaged
    on Nov 26, 2025
  2. added
    needs-area-label
    on Nov 26, 2025
  3. MihuBot commented on Nov 26, 2025

    @MihuBot

    I'm a bot. Here is a possible related and/or duplicate issue (I may be wrong):

  4. changed the title [-]Fingerprinting client-sdie assests using the old school hosted approach[/-] [+]Fingerprinting client-side assets using the old school hosted approach[/+] on Nov 26, 2025
  5. aligin commented on Dec 1, 2025

    @aligin

    I've temporary resolved this issue in super hacky way (don't blame me please).

    Place this to Server.csproj

    BlazorWebKit - it's my project name, replace it with your own.

    <Target Name="PublishBlazorWasmClient" AfterTargets="Publish">
        <MSBuild Projects="..\BlazorWebKit.Client\BlazorWebKit.Client.csproj"
                 Targets="Publish"
                 Properties="Configuration=$(Configuration);
                            RuntimeIdentifier=$(RuntimeIdentifier);
                            _IsPublishing=true;
                            OverrideHtmlAssetPlaceholders=true;
                            PublishDir=/tmp/blazor/client"/>
    
        <!-- Clean the server's wwwroot directory before copying new files -->
        <RemoveDir Directories="$(PublishDir)wwwroot" ContinueOnError="true" />
    
        <!-- Copy the client's published output (with replaced fingerprints) to server's wwwroot -->
        <ItemGroup>
          <ClientPublishedFiles Include="/tmp/blazor/client/wwwroot/**/*.*" />
        </ItemGroup>
    
        <Copy SourceFiles="@(ClientPublishedFiles)"
              DestinationFolder="$(PublishDir)wwwroot\%(RecursiveDir)"
              SkipUnchangedFiles="true" />
      </Target>
    

    /tmp/blazor/client - cause of linux CI builder. I can't debug the structure of the client published directory on linux and decided to use hardcoded path (docker container with temp published files dies after building).

  6. added
    os-browser
    and removed
    needs-area-label
    on Dec 4, 2025
  7. added this to the 10.0.x milestone on Dec 4, 2025
  8. removed
    untriaged
    on Dec 4, 2025
  9. maraf commented on Dec 8, 2025

    @maraf
    Member

    Thank you for contacting us. I'm looking for the fix.

    The underlaying problem is when WebAssembly project is referenced by Server project, MSBuild calls into the referenced project several times. The instance of the project is recreated for each call and so the collection of @(_HtmlStaticWebAssets) is not shared between Build and Publish.

  10. Vizual-Dev commented on Feb 5, 2026

    @Vizual-Dev
    Author

    Is there any update on this issue? I am still unable to do a production build.

  11. MarkusRodler commented on Feb 5, 2026

    @MarkusRodler

    Is there any update on this issue? I am still unable to do a production build.

    We've got the same problem -.-

  12. maraf commented on Feb 10, 2026

    @maraf
    Member

    @Vizual-Dev You can workaround the issue for now by opting-out from overriding asset placeholders, by removing <OverrideHtmlAssetPlaceholders>true</OverrideHtmlAssetPlaceholders> and updating index.html accordingly

  13. nahuegallinoti commented on Feb 11, 2026

    @nahuegallinoti

    @maraf If you remove that attribute, the fingerprint for static files won't work, right? Is there a plan to fix this problem?

    Thank you!

  14. maraf commented on Feb 16, 2026

    @maraf
    Member

    @nahuegallinoti Sorry for late reply. You will loose fingerprint on dotnet.js and blazor.webassembly.js scripts, which is the same situation as we had in .NET 9. Fortunately in hosted scenario, you can control server sent headers for caching

  15. Blackclaws commented on Mar 11, 2026

    @Blackclaws

    Also just ran into this as we basically did the net 10 upgrade to MapStaticAssets and fingerprinting and got totally blindsided by this. Please add a disclaimer to the documents explaining the migration that states that this is incompatible if serving blazor wasm from an aspnetcore server via project includes. A shame as the fingerprinting would have been nice to have. I hope this gets fixed soon.

  16. nahuegallinoti commented on May 7, 2026

    @nahuegallinoti

    Is there any update on this issue?

  17. Seth-Harlaar commented on Jul 22, 2026

    @Seth-Harlaar

    Is there any update on this issue?

  18. locked and limited conversation to collaborators on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

arch-wasmarea-VM-meta-monoos-browser

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions