-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
.net 8 P4 Brotli compress task not functioning as in previous previews #48308
Comments
Thanks for reaching out, @MarkStega. The However, we now have public APIs that can be used to mark assets for compression. Could you please try replacing your code with the following? <ItemGroup>
<AssetToCompress Include="@(MyStaticFiles)" />
</ItemGroup> |
Hi @MarkStega. 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. |
Thanks for the prompt reply. I had a whole section of csproj modeled after something I found on the .Net Foundation web site. The 'AssetToCompress' worked perfectly once and I was excited to be able to remove about 50 lines of 'cruft' from the custom csproj elements. Unfortunately, after removing the unused code, the 'AssetToCompress' stopped functioning. Here is the current csproj section:
The logging shows:
This shows the correct count of files to compress (2 .js and 3 .css). However, there are no brotli or gzip files being produced. Any thoughts? |
I also use this msbuild task and would love for this to be baked into the Blazor SDK. This way we can use the manual startup process documented here https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly?view=aspnetcore-7.0#compression and have the most size efficient static sites. |
@MarkStega, defining |
@IvanJosipovic, is there a reason why defining compressed assets via |
Thanks for the hint, I changed my csproj to have:
The log output shows:
Looking at the wwwroot directory there are no compressed files. Is there a better 'BeforeTargets for the prep stage? |
@MarkStega Sorry, I just realized that your Rather than using <PropertyGroup>
<CompressionIncludePatterns>$(CompressionIncludePatterns);$(ProjectDir)/wwwroot/**/*.css;$(ProjectDir)/wwwroot/**/*.js</CompressionIncludePatterns>
</PropertyGroup> |
@MackinnonBuck No luck:
|
@MarkStega Could you define the Also just to confirm: This is a Blazor WebAssembly app you're working with? If this still doesn't work, you could try generating a binlog and making sure the |
No, the particular csproj is a "Microsoft.NET.Sdk.Razor" project that produces a dll that can be used by either a server hosted or wasm hosted blazor app. Moving the CompressionIncludePatterns outside of the targetdidn't help. Earlier in the same csproj is code to build the js & css files that are to be compressed. (As an aside, I wish that #38445 wasn't getting kicked down the road yet again. It was a nice hint of things to come in Net6, it got deferred at the end of Net 6, all of Net 7, and looks like the same will happen in Net 8) Anyhow, since the property is moved out of the target and it fails I'll get the binlog and see what is going on and report back. |
I haven't turned on the high resolution mode yet but I can see that the _ResolveCompressedFiles and _CompressFile targets are executing before the GZBRCompressionSetup target. I changed the 'BeforeTargets' to 'UpdateExistingPackageStaticWebAssets' which brought it to the correct location. I'll turn on the detailed logs tomorrow and actually examine the values. I did notice that the _CompressFiles target only does a BrotliCompress in this csproj while in the project that build the Blazor dll that both Brotli & GZip compression tasks are run. |
I'm thinking the issue is probably that there's something wrong with the include pattern. I just tried creating a RazorClassLibrary (from <PropertyGroup>
<CompressionIncludePatterns>$(CompressionIncludePatterns);*.png</CompressionIncludePatterns>
</PropertyGroup> This resulted in You could try changing the include patterns to just
Hm, not sure why only Brotli compression would run. The default behavior is that Gzip compression runs during build and both Gzip and Brotli run during publish. You can configure this via the <PropertyGroup>
<BuildCompressionFormats>gzip</BuildCompressionFormats>
<PublishCompressionFormats>gzip;brotli</PublishCompressionFormats>
</PropertyGroup> |
The change to the pattern resulted in compressed files getting created and changing the BuildCompressionFormats to add brotli also worked. However, the compressed files in the artifact 'compressed' directory have lost their original names and the results are not getting copied to wwwroot Also, what is getting compressed includes the files in 'staticwebassets'. So it appears that trying to use the public APIs is the wrong approach for the build. The good news is that I can use the detailed log to understand the parameters to the internal gzip & brotli tasks so I can revert to a custom build step (unless you have a better idea). CentralNode_devenv_PID=20484_x64_BuildManager_Default.zip [EDIT] I may have spoken too soon about the public apis not being useful. I published the server project (that uses ICEBG.Client) and the publish directory for content (C:\Solutions\OHI\ICEBG-P12.5.artifacts\publish\ICEBG.Web.UserInterface\devserver\wwwroot_content\ICEBG.Client) and I see that properly named btotli & gzip files exist. So a series of questions:
|
Thank you for contacting us. Due to a lack of activity on this discussion issue we're closing it in an effort to keep our backlog clean. If you believe there is a concern related to the ASP.NET Core framework, which hasn't been addressed yet, please file a new issue. This issue will be locked after 30 more days of inactivity. If you still wish to discuss this subject after then, please create a new issue! |
Is there an existing issue for this?
Describe the bug
I have a Brotli compress task in a number of projects in the form of
This work through DN8P3 but is broken in DN8P4. It errors with
I see the 'compress' directory does get created under the 'obj'
Expected Behavior
I expect that the task completes as it did previously.
Steps To Reproduce
https://github.com/MarkStega/ICEBG branch vNext
Just clone, checkout the vNext branch, and do a build from within VS (I 1m using 17.7 P1)
Exceptions (if any)
No response
.NET Version
8.0.100-preview.4.23260.5
Anything else?
No response
The text was updated successfully, but these errors were encountered: