dotnet publish: The "ApplyCompressionNegotiation" task failed unexpectedly.
Which Contentment version are you using?
6.0.0-alpha
Which Umbraco version are you using? For example: 13.2.1 - don't just write v13
15.1.1
Bug summary
I have a project with 4 projects like: Core UmbracoProject Backoffice (RCL) Data (ClassLibrary)
I've added a reference to contentment on my Core project since that's the output from my generated Umbraco models and I need the contentment types. All projects reference the Core project.
When I run dotnet publish I get the following error for both the Backoffice and the Data project
Adding to both of the offending projects results in the publish command working as expected.
<CompressionEnabled>false</CompressionEnabled>
This seems similar to https://github.com/leekelleher/umbraco-contentment/issues/361 but probably unrelated
Steps to reproduce
Create a project with the structure above and run dotnet publish.
Expected result / actual result
No response
Do you have Umbraco ModelsBuilder enabled?
- [x] Yes, it is enabled.
What browsers are you seeing the problem on?
No response
@krebil Thanks for reporting this.
My personal knowledge of how dotnet publish works with library references using Static Web Assets is fairly limited.
A quick search finds this .NET 9 issue: https://github.com/dotnet/aspnetcore/issues/59291. I'd be happy to try out various things from there.
Out of interest, this comment of running .NET 9 MSBuild with a .NET 8 project - could this apply to your project? 🤔
I'm open to any advice and feedback on how I could resolve this.
@leekelleher I don't think so, my project is targeting .NET 9.
I'm not sure how to fix this, but a workaround could be to have a separate NuGet package with just the types and public services
I am the person who reported that bug (https://github.com/dotnet/aspnetcore/issues/59291). If your issue is caused by the same bug I reported, targeting .Net 8 in the Blazor App fixes the problem. Microsoft has not fixed the issue in .Net 9 yet.
I believe your issue is being triggered by https://github.com/leekelleher/umbraco-contentment/blob/d0593b2879146acea8e0b52753c8001009bddb0c/src/Umbraco.Community.Contentment/Umbraco.Community.Contentment.csproj#L8
Which is being improperly handled by the .Net 9 publish system when targeting .Net 9 Blazor apps.
I use <StaticWebAssetBasePath> in some of my Nuget packaged Blazor WebAssembly libraries and my users are seeing this issue when they target .Net 9 in their apps. That is how I discovered the issue.
Please report your issue on the issue page I started. It will help Microsoft understand this is a big enough issue to actually get fixed before they release .Net 10. When I first reported this issue, the stated it wouldn't be fixed until .Net 10 which could mean it just doesn't get fixed. (Like threading was suppose to be in .Net7, then .Net 8, then .Net 9 Blazor... and we still don't have it.)
Sorry, I had forgotten that disabling compression was another way I found to workaround the bug.
I'll close this off, as appears to be outside the remit of Contentment itself.
Thanks to @LostBeard for updates and cross-referencing. 🌟