Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow modifying certain files post-build without forcing BlazorCacheBootResources=false #45687

Closed
1 task done
igotinfected opened this issue Dec 20, 2022 · 5 comments
Closed
1 task done
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue.

Comments

@igotinfected
Copy link

igotinfected commented Dec 20, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

Hi! I've been following this issue to allow us to easily use the lb_LU date format, month/day names and so on. Given that the language isn't used very much, it does not seem like it'll be included by default anytime soon, so the proposed solution for my case was to use our custom icudt.dat file that does include the complete lb_LU locale.

After messing around a little I found that I could replace the icu files with the following afterbuild target:

<Target Name="CopyLocalizationFiles" AfterTargets="AfterBuild">
    <Message Text="Copying localization files to output folder..." Importance="High" />

    <Copy SourceFiles="Localization\icudt.dat" DestinationFolder="$(OutputPath)" ContinueOnError="false" />
    <Copy SourceFiles="Localization\icudt.dat" DestinationFolder="$(OutputPath)\wwwroot\_framework" ContinueOnError="false" />
    <Copy SourceFiles="Localization\icudt.dat.gz" DestinationFolder="$(OutputPath)\wwwroot\_framework" ContinueOnError="false" />

    <Message Text="Localization files copied!" Importance="High" />
</Target>

This seems like it works post-publish, as I assume the integrity hash is recalculated with the new icu files somewhere along the Publish flow? But this doesn't work if I run the project locally, the usual integrity-check failure occurs on the icudt.dat file.

Describe the solution you'd like

An ideal solution would be something that doesn't require me to lose the benefits of BlazorCacheBootResource and no need for custom icudt.dat versions & copy targets. Maybe a way to exclude files from integrity checks? I don't know enough about the Build/Publish + integrity hash generation process to propose something more in-depth.

Additional context

I'd like to be able to fully use the lb_LU locale with Blazor as I have the requirement to support 4 languages (English, French, German, and Luxembourgish). Currently if I use the lb_LU locale it defaults to en_US values (I suppose, it's the US date format e.g.).

@TanayParikh TanayParikh added the area-blazor Includes: Blazor, Razor Components label Dec 20, 2022
@ilonatommy ilonatommy self-assigned this Dec 20, 2022
@ilonatommy
Copy link
Member

Can be reproduced using manual compression in a Blazor template. Error screenshot:
image

@ilonatommy
Copy link
Member

@TanayParikh, could you help here?

@javiercn javiercn added feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly and removed arch-wasm labels Dec 20, 2022
@javiercn
Copy link
Member

javiercn commented Dec 20, 2022

@igotinfected thanks for contacting us.

The right way to approach this is to integrate the custom icudt file in the build pipeline. It likely involves replacing the file on the ReferenceCopyLocalPaths or WasmNativeAsset itemgroup after the target where they are defined (which I do not know exactly which is).

You can figure out the target to attach to, by capturing a binary log and using msbuild structured log viewer. You also likely have to intercept the publish process and do something similar to replace the file inside ResolvedFileToPublish.

To summarize, you need to do this before Blazor processes the file both during build and publish, the targets to do so are part of the runtime, so they will be in a better position to guide you on how to do so. We do not plan to change how BlazorCacheBootResources=false works because we do not think this is the right solution to the problem you are trying to solve (providing your own icudt file).

@ilonatommy ilonatommy removed their assignment Dec 20, 2022
@javiercn javiercn added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Dec 20, 2022
@ghost
Copy link

ghost commented Dec 20, 2022

Hi @igotinfected. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@igotinfected
Copy link
Author

Makes sense to me! Thanks for the swift response 😊 I'll try getting this to work tonight and update in the previously mentioned issue for future generations.

@ghost ghost locked as resolved and limited conversation to collaborators Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue.
Projects
None yet
Development

No branches or pull requests

4 participants