I have a build pipeline created on AzureDevops for Blazor solution. The build agent is running on my server. About a month ago I updated all my projects to .NET 9 and ran a build. The build time went up from about 10 minutes to 30+ minutes. The delay was caused by "Publish" step that now takes over 20 minutes.
No other changes other then updating to .NET 9 have been made.
Why does publish step take about 20 minutes when targeting .NET 9 as opposed to 1 minute when targeting .NET 8 and how to fix it?
There is nothing unusual in the logs
Starting: Publish==============================================================================Task : .NET CoreDescription : Build, test, package, or publish a dotnet application, or run a custom dotnet commandVersion : 2.247.3Author : Microsoft CorporationHelp : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli==============================================================================C:\Windows\system32\chcp.com 65001Active code page: 65001Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version."C:\Program Files\dotnet\dotnet.exe" publish C:\BuildAgent\_work\38\s\Api.csproj --configuration Release --output C:\BuildAgent\_work\38\a\Api --no-restore --no-build Api -> C:\BuildAgent\_work\38\a\Api\"C:\Program Files\dotnet\dotnet.exe" publish C:\BuildAgent\_work\38\s\BlazorClient\BlazorClientServerEntryPoint\BlazorClientServerEntryPoint.csproj --configuration Release --output C:\BuildAgent\_work\38\a\BlazorClientServerEntryPoint --no-restore --no-build Adding WebOptimizer cache files to publish output BlazorClientServerEntryPoint -> C:\BuildAgent\_work\38\a\BlazorClientServerEntryPoint\"C:\Program Files\dotnet\dotnet.exe" publish C:\BuildAgent\_work\38\s\BlazorClient\BlazorClientStyles\BlazorClientStyles.csproj --configuration Release --output C:\BuildAgent\_work\38\a\BlazorClientStyles --no-restore --no-build BlazorClientStyles -> C:\BuildAgent\_work\38\a\BlazorClientStyles\"C:\Program Files\dotnet\dotnet.exe" publish C:\BuildAgent\_work\38\s\BlazorClient\BlazorClientComponents\BlazorClientComponents.csproj --configuration Release --output C:\BuildAgent\_work\38\a\BlazorClientComponents --no-restore --no-build BlazorClientComponents -> C:\BuildAgent\_work\38\a\BlazorClientComponents\"C:\Program Files\dotnet\dotnet.exe" publish C:\BuildAgent\_work\38\s\BlazorClient\BlazorClientInfrastructure\BlazorClientInfrastructure.csproj --configuration Release --output C:\BuildAgent\_work\38\a\BlazorClientInfrastructure --no-restore --no-build BlazorClientInfrastructure -> C:\BuildAgent\_work\38\a\BlazorClientInfrastructure\Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshootingFinishing: PublishI'm using .NET Core task version 2.* and have added --no-restore and --no-build arguments. It had no impact. I have also tried the Azure Pipelines agent with the same result